Hello all. I use rtpengine and rtpproxy-ng module at kamailio for proxying RTP and modifying SDP between endpoints. I use two types of clients - such as WSS based and UDP based clients.
I have a trouble with append_branch and rtpengine handling for this packets.
I try to implement this logic of my script
Logic of my script:
--checking location table for rows with needed account --get info from contact at loop
for every step
--check technology (sip or ws) --append_branch with existing destination for this account --rewrite packet with rtpengine to needed technology
after loop forward packets via t_relay
At listing bellow rtpproxy_manage have no flag "b" that implement needed functionality. It not included at the script because I tried include it but rtpengine says that ca nnot handle this request. As i understand this flag worked with rtpproxy and rtpproxy-ng apps only. Not with rtpengine.
At my test I have 2 endpoints with WS and UDP phones (at fist step ir WS and 2 step it UDP). All calls going form asterisk via UDP. When I do these steps (at my script) I see packet at TCP dump and saw that sended only one packet to UDP but body of packet is WS. Then I saw log of kamailio. I see that at second step packet changed body to WS body (so strange because other steps before and after goes for UDP (as at logic of script))
If I set "b" flag I can call only UDP endpoint, but at log I see as I say that rtpengine can not do thomething with SIP packets and send with t_relay uncghanged UDP packet only.
sql_query("ca", "select contact from location where username='$tU'", "ra"); xlog("rows: $dbr(ra=>rows) cols: $dbr(ra=>cols)\n"); if($dbr(ra=>rows)>0){ $var(i)=0; while($var(i)<$dbr(ra=>rows)){ xlog("L_INFO","SQL query return contact {$dbr(ra=>[$var(i),0])} for {$tU} at step {$var(i)}\n"); if ($dbr(ra=>[$var(i),0])=~"transport=ws"){ xlog("L_INFO", "This is a Websocket call to endpoint"); sql_pvquery("ca", "select received from location where contact='$dbr(ra=>[$var(i),0])'","$var(recieved)"); xlog("L_INFO","SQL query return recieved {$var(recieved)} for {$tU}\n"); $du=$var(recieved); xlog("L_INFO", "Request going FROM ASTERISK to WS. Destination is {$du}\n"); xlog("L_INFO","Websocket Destination URI is {$var(recieved)} for {$tU}\n"); rtpproxy_manage("froc+SP"); t_on_reply("REPLY_FROM_WS"); append_branch("sip:$tU@$du"); $var(i) = $var(i) + 1; } else { xlog("L_INFO", "This is a classic UDP call to endpoint"); $du="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@}); xlog("L_INFO","Classic Destination URI is {$dbr(ra=>[$var(i),0])} for {$tU}\n"); rtpproxy_manage("co"); t_on_reply("MANAGE_CLASSIC_REPLY"); append_branch("sip:$tU@$du"); $var(i) = $var(i) + 1; } #append_branch("sip:$tU@$du"); } } return 1;
So it customised schema of standart example
seturi("sip:a@example.com https://e.mail.ru/compose/?mailto=mailto%3asip%253Aa@example.com"); append_branch("sip:b@example.com https://e.mail.ru/compose/?mailto=mailto%3asip%253Ab@example.com"); append_branch("sip:c@example.com https://e.mail.ru/compose/?mailto=mailto%3asip%253Ac@example.com"); append_branch("sip:d@example.com https://e.mail.ru/compose/?mailto=mailto%3asip%253Ad@example.com");
t_relay();
I need fro advice how to fix this may be with another applications or with another steps. Thanks.
On 10/23/14 06:03, Yuriy Gorlichenko wrote:
Hello all. I use rtpengine and rtpproxy-ng module at kamailio for proxying RTP and modifying SDP between endpoints. I use two types of clients - such as WSS based and UDP based clients.
I have a trouble with append_branch and rtpengine handling for this packets.
I try to implement this logic of my script
Logic of my script:
--checking location table for rows with needed account --get info from contact at loop
for every step
--check technology (sip or ws) --append_branch with existing destination for this account --rewrite packet with rtpengine to needed technology
after loop forward packets via t_relay
At listing bellow rtpproxy_manage have no flag "b" that implement needed functionality. It not included at the script because I tried include it but rtpengine says that ca nnot handle this request. As i understand this flag worked with rtpproxy and rtpproxy-ng apps only. Not with rtpengine.
At my test I have 2 endpoints with WS and UDP phones (at fist step ir WS and 2 step it UDP). All calls going form asterisk via UDP. When I do these steps (at my script) I see packet at TCP dump and saw that sended only one packet to UDP but body of packet is WS. Then I saw log of kamailio. I see that at second step packet changed body to WS body (so strange because other steps before and after goes for UDP (as at logic of script))
If I set "b" flag I can call only UDP endpoint, but at log I see as I say that rtpengine can not do thomething with SIP packets and send with t_relay uncghanged UDP packet only.
If you include the full set of flags in both cases, it should work without the "b" flag. IOW, include "-sp" when sending to an RTP endpoint (or perhaps "+sp") and "+SP" when sending to a WebRTC endpoint.
cheers
What you mean under "full set of flags"? At reply I use mirror (+/-) flags off course. More, it work without branches fine ( i select only one endpoint). I have issue only with branches. 23.10.2014 18:56 пользователь "Richard Fuchs" rfuchs@sipwise.com написал:
On 10/23/14 06:03, Yuriy Gorlichenko wrote:
Hello all. I use rtpengine and rtpproxy-ng module at kamailio for proxying RTP and modifying SDP between endpoints. I use two types of clients - such as WSS based and UDP based clients.
I have a trouble with append_branch and rtpengine handling for this packets.
I try to implement this logic of my script
Logic of my script:
--checking location table for rows with needed account --get info from contact at loop
for every step
--check technology (sip or ws) --append_branch with existing destination for this account --rewrite packet with rtpengine to needed technology
after loop forward packets via t_relay
At listing bellow rtpproxy_manage have no flag "b" that implement needed functionality. It not included at the script because I tried include it but rtpengine says that ca nnot handle this request. As i understand this flag worked with rtpproxy and rtpproxy-ng apps only. Not with rtpengine.
At my test I have 2 endpoints with WS and UDP phones (at fist step ir WS and 2 step it UDP). All calls going form asterisk via UDP. When I do these steps (at my script) I see packet at TCP dump and saw that sended only one packet to UDP but body of packet is WS. Then I saw log of kamailio. I see that at second step packet changed body to WS body (so strange because other steps before and after goes for UDP (as at logic of script))
If I set "b" flag I can call only UDP endpoint, but at log I see as I say that rtpengine can not do thomething with SIP packets and send with t_relay uncghanged UDP packet only.
If you include the full set of flags in both cases, it should work without the "b" flag. IOW, include "-sp" when sending to an RTP endpoint (or perhaps "+sp") and "+SP" when sending to a WebRTC endpoint.
cheers
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On 10/23/14 12:17, Yuriy Gorlichenko wrote:
What you mean under "full set of flags"? At reply I use mirror (+/-) flags off course. More, it work without branches fine ( i select only one endpoint). I have issue only with branches.
I mean that instead of using rtpproxy_manage("co") you should use rtpproxy_manage("co-sp").
cheers
Oh. Ok. I will try. Thanks for advice. I very hope it hepls.
2014-10-23 20:18 GMT+04:00 Richard Fuchs rfuchs@sipwise.com:
On 10/23/14 12:17, Yuriy Gorlichenko wrote:
What you mean under "full set of flags"? At reply I use mirror (+/-) flags off course. More, it work without branches fine ( i select only one endpoint). I have issue only with branches.
I mean that instead of using rtpproxy_manage("co") you should use rtpproxy_manage("co-sp").
cheers
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Still have same error... Now rtpproxy_manage("co-sp") for classic call. At log I see that rtpproxy wirked gine. For each step it generate write body, but t_Relay still send strange "compinated" packet to UDP with SDP for WS...
2014-10-23 20:42 GMT+04:00 Yuriy Gorlichenko ovoshlook@gmail.com:
Oh. Ok. I will try. Thanks for advice. I very hope it hepls.
2014-10-23 20:18 GMT+04:00 Richard Fuchs rfuchs@sipwise.com:
On 10/23/14 12:17, Yuriy Gorlichenko wrote:
What you mean under "full set of flags"? At reply I use mirror (+/-) flags off course. More, it work without branches fine ( i select only one endpoint). I have issue only with branches.
I mean that instead of using rtpproxy_manage("co") you should use rtpproxy_manage("co-sp").
cheers
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On 10/23/14 15:06, Yuriy Gorlichenko wrote:
Still have same error... Now rtpproxy_manage("co-sp") for classic call. At log I see that rtpproxy wirked gine. For each step it generate write body, but t_Relay still send strange "compinated" packet to UDP with SDP for WS...
Do you mean that the outgoing packet contains two SDP bodies? This has been discussed and solved in this thread: http://lists.sip-router.org/pipermail/sr-dev/2014-July/024507.html
cheers
No SDP body only one. but packet like this
INVITE sip:device-200@sip:1.21.10.2:45437;rinstance=07f88c423145358e;transport=UDP SIP/2.0 Record-Route: sip:sip.myservice.com:5068;nat=yes;ftag=as1be940e5;lr=on Via: SIP/2.0/UDP sip.myservice.com:5068 ;branch=z9hG4bKca7d.2d16143316e23fac46bf686bb41780b3.2 Via: SIP/2.0/UDP 17.74.28.7:50600;branch=z9hG4bK22c67800;rport=50600 Max-Forwards: 70 From: "Name" sip:1001@17.74.28.7:50600;tag=as1be940e5 To: sip:device-200@sip.myservice.com:5068 Contact: sip:1001@17.74.28.7:50600 Call-ID: 5ee58acd136888261e85d91e345e7ba1@17.74.28.7:50600 CSeq: 102 INVITE User-Agent: Asterisk PBX 12.6.1 Date: Thu, 23 Oct 2014 19:27:54 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer Content-Type: application/sdp Content-Length: 1044
v=0 o=root 1195474335 1195474335 IN IP4 2.10.39.16 s=Asterisk PBX 12.6.1 c=IN IP4 2.10.39.16 t=0 0 a=ice-lite m=audio 30614 RTP/SAVPF 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=ptime:20 a=maxptime:150 a=sendrecv a=rtcp:30615 a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:OY72ZDHa+E3avlHwschrdBMe00qDfkN0BUyOxT1C a=setup:actpass a=fingerprint:sha-1 07:3D:B4:B0:0E:0D:87:39:C3:83:10:E2:B8:B8:2C:0C:0D:59:EF:4C a=ice-ufrag:Wudfwh08 a=ice-pwd:VoamuFVRrAXOhUaeD6tA3PcXhndL a=candidate:8jYonvAy1KGkAdP3 1 UDP 213070
2014-10-23 23:25 GMT+04:00 Richard Fuchs rfuchs@sipwise.com:
On 10/23/14 15:06, Yuriy Gorlichenko wrote:
Still have same error... Now rtpproxy_manage("co-sp") for classic call. At log I see that rtpproxy wirked gine. For each step it generate write body, but t_Relay still send strange "compinated" packet to UDP with SDP for WS...
Do you mean that the outgoing packet contains two SDP bodies? This has been discussed and solved in this thread: http://lists.sip-router.org/pipermail/sr-dev/2014-July/024507.html
cheers
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
And what returns prtpengine at log when changing this packet.
Returning to SIP proxy: d3:sdp316:v=0#015#012o=root 1195474335 1195474335 IN IP4 2.10.39.16#015#012s=Asterisk PBX 12.6.1#015#012c=IN IP4 2.10.39.16#015#012t=0 0#015#012m=audio 30614 RTP/AVP 8 3 0 101#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:3 GSM/8000#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=ptime:20#015#012a=maxptime:150#015#012a=sendrecv#015#012a=rtcp:30615#015#0126:result2:oke
So it looks like that Destination sets from second append_branch at second step (to UDP) and body sets as body of first step (for WS packet)
2014-10-23 23:36 GMT+04:00 Yuriy Gorlichenko ovoshlook@gmail.com:
No SDP body only one. but packet like this
INVITE sip:device-200@sip:1.21.10.2:45437;rinstance=07f88c423145358e;transport=UDP SIP/2.0 Record-Route: sip:sip.myservice.com:5068;nat=yes;ftag=as1be940e5;lr=on Via: SIP/2.0/UDP sip.myservice.com:5068 ;branch=z9hG4bKca7d.2d16143316e23fac46bf686bb41780b3.2 Via: SIP/2.0/UDP 17.74.28.7:50600;branch=z9hG4bK22c67800;rport=50600 Max-Forwards: 70 From: "Name" sip:1001@17.74.28.7:50600;tag=as1be940e5 To: sip:device-200@sip.myservice.com:5068 Contact: sip:1001@17.74.28.7:50600 Call-ID: 5ee58acd136888261e85d91e345e7ba1@17.74.28.7:50600 CSeq: 102 INVITE User-Agent: Asterisk PBX 12.6.1 Date: Thu, 23 Oct 2014 19:27:54 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer Content-Type: application/sdp Content-Length: 1044
v=0 o=root 1195474335 1195474335 IN IP4 2.10.39.16 s=Asterisk PBX 12.6.1 c=IN IP4 2.10.39.16 t=0 0 a=ice-lite m=audio 30614 RTP/SAVPF 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=ptime:20 a=maxptime:150 a=sendrecv a=rtcp:30615 a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:OY72ZDHa+E3avlHwschrdBMe00qDfkN0BUyOxT1C a=setup:actpass a=fingerprint:sha-1 07:3D:B4:B0:0E:0D:87:39:C3:83:10:E2:B8:B8:2C:0C:0D:59:EF:4C a=ice-ufrag:Wudfwh08 a=ice-pwd:VoamuFVRrAXOhUaeD6tA3PcXhndL a=candidate:8jYonvAy1KGkAdP3 1 UDP 213070
2014-10-23 23:25 GMT+04:00 Richard Fuchs rfuchs@sipwise.com:
On 10/23/14 15:06, Yuriy Gorlichenko wrote:
Still have same error... Now rtpproxy_manage("co-sp") for classic call. At log I see that rtpproxy wirked gine. For each step it generate write body, but t_Relay still send strange "compinated" packet to UDP with SDP for WS...
Do you mean that the outgoing packet contains two SDP bodies? This has been discussed and solved in this thread: http://lists.sip-router.org/pipermail/sr-dev/2014-July/024507.html
cheers
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
I fixed this. rtpengine must handle each of branches at branch_route(). Not that is fine. Thanks for link. It was not my issue but with it i find right way.
Can you help with these problem? We have 5-7 Seconds voice delay. This happened only for from webphone. But it is not client issue as i see. Wireshark at client side shows that RTP starts as soon I pick up call. So rtp leaves rtpengine and goes to the destination with delay... We use WSS and think that problem at handshake.
There are some statisticcs after call finished (as example). You may see that one of streams created after 5 seconds delay.
P. S. Must we create new list for this?
Oct 26 22:15:31 Kamailio2 rtpengine[35466]: [ 28ed5c035d4b8a1c5383360e4d3677af@10.0.1.6:5060] --- Tag 'rsik48leli', created 1:12 ago, in dialogue with 'as7b4cb593' Oct 26 22:15:31 Kamailio2 rtpengine[35466]: [ 28ed5c035d4b8a1c5383360e4d3677af@10.0.1.6:5060] ------ Media #1, port 34178 <> 8.2.10.25:52463, 340 p, 58032 b, 0 e Oct 26 22:15:31 Kamailio2 rtpengine[35466]: [ 28ed5c035d4b8a1c5383360e4d3677af@10.0.1.6:5060] ------ Media #1, port 34179 <> 8.2.10.25:52468 (RTCP), 10 p, 960 b, 0 e Oct 26 22:15:31 Kamailio2 rtpengine[35466]: [ 28ed5c035d4b8a1c5383360e4d3677af@10.0.1.6:5060] --- Tag 'as7b4cb593', created 1:12 ago, in dialogue with 'rsik48leli' Oct 26 22:15:31 Kamailio2 rtpengine[35466]: [ 28ed5c035d4b8a1c5383360e4d3677af@10.0.1.6:5060] ------ Media #1, port 34194 <> 10.0.1.6:16376, 201 p, 36582 b, 0 e Oct 26 22:15:31 Kamailio2 rtpengine[35466]: [ 28ed5c035d4b8a1c5383360e4d3677af@10.0.1.6:5060] ------ Media #1, port 34195 <> 10.0.1.6:16377 (RTCP), 1 p, 78 b, 0 e Oct 26 22:15:31 Kamailio2 rtpengine[35466]: [iunge05ber6sqlc7qs6b] Final packet stats: Oct 26 22:15:31 Kamailio2 rtpengine[35466]: [iunge05ber6sqlc7qs6b] --- Tag 'as3af30098', created 1:17 ago, in dialogue with 'bqinihbhsf' Oct 26 22:15:31 Kamailio2 rtpengine[35466]: [iunge05ber6sqlc7qs6b] ------ Media #1, port 34142 <> 10.0.1.6:17258, 200 p, 35200 b, 0 e Oct 26 22:15:31 Kamailio2 rtpengine[35466]: [iunge05ber6sqlc7qs6b] ------ Media #1, port 34143 <> 10.0.1.6:17259 (RTCP), 1 p, 78 b, 0 e Oct 26 22:15:31 Kamailio2 rtpengine[35466]: [iunge05ber6sqlc7qs6b] --- Tag 'bqinihbhsf', created 1:12 ago, in dialogue with 'as3af30098' Oct 26 22:15:31 Kamailio2 rtpengine[35466]: [iunge05ber6sqlc7qs6b] ------ Media #1, port 34162 <> 8.2.10.25:52453, 216 p, 36768 b, 0 e Oct 26 22:15:31 Kamailio2 rtpengine[35466]: [iunge05ber6sqlc7qs6b] ------ Media #1, port 34163 <> 8.2.10.25:52453 (RTCP),
2014-10-23 23:39 GMT+04:00 Yuriy Gorlichenko ovoshlook@gmail.com:
And what returns prtpengine at log when changing this packet.
Returning to SIP proxy: d3:sdp316:v=0#015#012o=root 1195474335 1195474335 IN IP4 2.10.39.16#015#012s=Asterisk PBX 12.6.1#015#012c=IN IP4 2.10.39.16#015#012t=0 0#015#012m=audio 30614 RTP/AVP 8 3 0 101#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:3 GSM/8000#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=ptime:20#015#012a=maxptime:150#015#012a=sendrecv#015#012a=rtcp:30615#015#0126:result2:oke
So it looks like that Destination sets from second append_branch at second step (to UDP) and body sets as body of first step (for WS packet)
2014-10-23 23:36 GMT+04:00 Yuriy Gorlichenko ovoshlook@gmail.com:
No SDP body only one. but packet like this
INVITE sip:device-200@sip:1.21.10.2:45437;rinstance=07f88c423145358e;transport=UDP SIP/2.0 Record-Route: sip:sip.myservice.com:5068;nat=yes;ftag=as1be940e5;lr=on Via: SIP/2.0/UDP sip.myservice.com:5068 ;branch=z9hG4bKca7d.2d16143316e23fac46bf686bb41780b3.2 Via: SIP/2.0/UDP 17.74.28.7:50600;branch=z9hG4bK22c67800;rport=50600 Max-Forwards: 70 From: "Name" sip:1001@17.74.28.7:50600;tag=as1be940e5 To: sip:device-200@sip.myservice.com:5068 Contact: sip:1001@17.74.28.7:50600 Call-ID: 5ee58acd136888261e85d91e345e7ba1@17.74.28.7:50600 CSeq: 102 INVITE User-Agent: Asterisk PBX 12.6.1 Date: Thu, 23 Oct 2014 19:27:54 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer Content-Type: application/sdp Content-Length: 1044
v=0 o=root 1195474335 1195474335 IN IP4 2.10.39.16 s=Asterisk PBX 12.6.1 c=IN IP4 2.10.39.16 t=0 0 a=ice-lite m=audio 30614 RTP/SAVPF 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=ptime:20 a=maxptime:150 a=sendrecv a=rtcp:30615 a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:OY72ZDHa+E3avlHwschrdBMe00qDfkN0BUyOxT1C a=setup:actpass a=fingerprint:sha-1 07:3D:B4:B0:0E:0D:87:39:C3:83:10:E2:B8:B8:2C:0C:0D:59:EF:4C a=ice-ufrag:Wudfwh08 a=ice-pwd:VoamuFVRrAXOhUaeD6tA3PcXhndL a=candidate:8jYonvAy1KGkAdP3 1 UDP 213070
2014-10-23 23:25 GMT+04:00 Richard Fuchs rfuchs@sipwise.com:
On 10/23/14 15:06, Yuriy Gorlichenko wrote:
Still have same error... Now rtpproxy_manage("co-sp") for classic call. At log I see that rtpproxy wirked gine. For each step it generate write body, but t_Relay still send strange "compinated" packet to UDP with SDP for WS...
Do you mean that the outgoing packet contains two SDP bodies? This has been discussed and solved in this thread: http://lists.sip-router.org/pipermail/sr-dev/2014-July/024507.html
cheers
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On Monday, October 27, 2014 02:20:52 AM Yuriy Gorlichenko wrote:
I fixed this. rtpengine must handle each of branches at branch_route(). Not that is fine. Thanks for link. It was not my issue but with it i find right way.
Yuriy, I'm fairly new to Kamailio and have been following your issue as I may be seeing something similar when I try to parallel fork a call which issues RTP/AVP to one branch and RTP/SAVP to another (group call with various endpoints).
It may be related to https://github.com/sipwise/rtpengine/issues/39 but to be honest, I'm not certain I've got Kamilio set up properly.
Would you mind sharing your kamilio.cfg routes related to rtpengine and branch_route?
Thanks. -A
Hello Antony. This my customised cfg sample. After this you should call t_relay() func: One thing - you should handle ACK messages for WS at loose_route. thomething like this: if (is_request()) { if (!has_totag()) { if(t_is_branch_route()) { add_rr_param(";nat=yes"); } xlog("L_INFO","first {$rm}"); } xlog("L_INFO","It Is request {$rm}"); if ($ru =~ "transport=ws"){ $var(received)=0; #$var(to_uri)=$(ru{s.select,0,@}); sql_pvquery("ca","select received from location where contact like '$(ru{s.select,0,@})%'","$var(received)"); xlog("L_INFO","RECIEVED for {$rm} = {$var(received)}"); $du=$var(received); } }
It is very important because ACK message sends to UDP endpoint by default, so you should change $du for this packet, or your call will bend after few seconds (if WS socket picked up) with message "transaction does not exists". Because ACK messages will be send to UDP endpoint or nowere because contact field at location for WS endpoint have thomething like "dsfs353fwrf@ivalid.sddfsdg:transport=ws". Offcourse this will not be resolve. You need data from received field with right destination address. there is main cfg sql_query("ca", "select contact from location where username='$tU'", "ra"); xlog("rows: $dbr(ra=>rows) cols: $dbr(ra=>cols)\n"); if($dbr(ra=>rows)>0){ $var(i)=0; while($var(i)<$dbr(ra=>rows)){ xlog("L_INFO","SQL query return contact {$dbr(ra=>[$var(i),0])} for {$tU} at step {$var(i)}\n"); if ($dbr(ra=>[$var(i),0])=~"transport=ws"){ xlog("L_INFO", "This is a Websocket call to endpoint"); sql_pvquery("ca", "select received from location where contact='$dbr(ra=>[$var(i),0])'","$var(recieved)"); $du=$var(recieved); xlog("L_INFO","SQL query return recieved {$var(recieved)} for {$tU}. Destination is {$du}\n"); append_branch("sip:$tU@$(du{s.select,1,:})"); } else { xlog("L_INFO", "This is a classic UDP call to endpoint"); $du="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@}); $var(UDP_contact)="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@}); append_branch("sip:$tU@$(du{s.select,1,:})"); xlog("L_INFO","Classic Destination URI is {$dbr(ra=>[$var(i),0])} for {$tU}}. Destination is {$du}\n"); } $var(i) = $var(i) + 1; } } t_on_branch("1"); return; } }
}
branch_route[1]{
if($du=~"transport=ws"){ xlog("L_INFO","Websocket Branch is {$du} for {$tU}\n"); rtpproxy_manage("froc+SP"); t_on_reply("REPLY_FROM_WS"); } else{ xlog("L_INFO","UDP Branch is {$du)} for {$tU}\n"); rtpproxy_manage("co-sp"); t_on_reply("MANAGE_CLASSIC_REPLY"); } }
2014-10-27 2:34 GMT+04:00 Anthony Messina amessina@messinet.com:
On Monday, October 27, 2014 02:20:52 AM Yuriy Gorlichenko wrote:
I fixed this. rtpengine must handle each of branches at branch_route().
Not
that is fine. Thanks for link. It was not my issue but with it i find
right
way.
Yuriy, I'm fairly new to Kamailio and have been following your issue as I may be seeing something similar when I try to parallel fork a call which issues RTP/AVP to one branch and RTP/SAVP to another (group call with various endpoints).
It may be related to https://github.com/sipwise/rtpengine/issues/39 but to be honest, I'm not certain I've got Kamilio set up properly.
Would you mind sharing your kamilio.cfg routes related to rtpengine and branch_route?
Thanks. -A
-- Anthony - https://messinet.com/ - https://messinet.com/~amessina/gallery 8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On October 26, 2014 9:16:10 PM CDT, Yuriy Gorlichenko ovoshlook@gmail.com wrote:
Hello Antony. This my customised cfg sample. After this you should call t_relay() func: One thing - you should handle ACK messages for WS at loose_route. thomething like this: if (is_request()) { if (!has_totag()) { if(t_is_branch_route()) { add_rr_param(";nat=yes"); } xlog("L_INFO","first {$rm}"); } xlog("L_INFO","It Is request {$rm}"); if ($ru =~ "transport=ws"){ $var(received)=0; #$var(to_uri)=$(ru{s.select,0,@}); sql_pvquery("ca","select received from location where contact like '$(ru{s.select,0,@})%'","$var(received)"); xlog("L_INFO","RECIEVED for {$rm} = {$var(received)}"); $du=$var(received); } }
It is very important because ACK message sends to UDP endpoint by default, so you should change $du for this packet, or your call will bend after few seconds (if WS socket picked up) with message "transaction does not exists". Because ACK messages will be send to UDP endpoint or nowere because contact field at location for WS endpoint have thomething like "dsfs353fwrf@ivalid.sddfsdg:transport=ws". Offcourse this will not be resolve. You need data from received field with right destination address. there is main cfg sql_query("ca", "select contact from location where username='$tU'", "ra"); xlog("rows: $dbr(ra=>rows) cols: $dbr(ra=>cols)\n"); if($dbr(ra=>rows)>0){ $var(i)=0; while($var(i)<$dbr(ra=>rows)){ xlog("L_INFO","SQL query return contact {$dbr(ra=>[$var(i),0])} for {$tU} at step {$var(i)}\n"); if ($dbr(ra=>[$var(i),0])=~"transport=ws"){ xlog("L_INFO", "This is a Websocket call to endpoint"); sql_pvquery("ca", "select received from location where contact='$dbr(ra=>[$var(i),0])'","$var(recieved)"); $du=$var(recieved); xlog("L_INFO","SQL query return recieved {$var(recieved)} for {$tU}. Destination is {$du}\n"); append_branch("sip:$tU@$(du{s.select,1,:})"); } else { xlog("L_INFO", "This is a classic UDP call to endpoint"); $du="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@}); $var(UDP_contact)="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@}); append_branch("sip:$tU@$(du{s.select,1,:})"); xlog("L_INFO","Classic Destination URI is {$dbr(ra=>[$var(i),0])} for {$tU}}. Destination is {$du}\n"); } $var(i) = $var(i) + 1; } } t_on_branch("1"); return; } }
}
branch_route[1]{
if($du=~"transport=ws"){ xlog("L_INFO","Websocket Branch is {$du} for {$tU}\n"); rtpproxy_manage("froc+SP"); t_on_reply("REPLY_FROM_WS"); } else{ xlog("L_INFO","UDP Branch is {$du)} for {$tU}\n"); rtpproxy_manage("co-sp"); t_on_reply("MANAGE_CLASSIC_REPLY"); } }
2014-10-27 2:34 GMT+04:00 Anthony Messina amessina@messinet.com:
On Monday, October 27, 2014 02:20:52 AM Yuriy Gorlichenko wrote:
I fixed this. rtpengine must handle each of branches at
branch_route().
Not
that is fine. Thanks for link. It was not my issue but with it i
find
right
way.
Yuriy, I'm fairly new to Kamailio and have been following your issue
as I
may be seeing something similar when I try to parallel fork a call which
issues
RTP/AVP to one branch and RTP/SAVP to another (group call with
various
endpoints).
It may be related to https://github.com/sipwise/rtpengine/issues/39
but
to be honest, I'm not certain I've got Kamilio set up properly.
Would you mind sharing your kamilio.cfg routes related to rtpengine
and
branch_route?
Thanks. -A
-- Anthony - https://messinet.com/ -
https://messinet.com/~amessina/gallery
8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
list
sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Thanks a lot Yuriy. I'll try to learn from your config. -A