[SR-Users] Kamailio appends firs inserted branch twice
Yuriy Gorlichenko
ovoshlook at gmail.com
Tue Feb 10 15:13:15 CET 2015
I need to handle every route with rtpengine depending websocket it or not
(branch_route[1] at my first message). Lookup keep handling close with
branch route. So I can not understand how send to branch_route with lookup
function.
2015-02-10 14:17 GMT+03:00 Daniel-Constantin Mierla <miconda at gmail.com>:
> Hello,
>
> r-uri itself is a branch. Practically, an append_branch() in request_route
> is adding a new destination in addition to r-uri address.
>
> Maybe you can explain why lookup("location") is not working for you, as it
> is updates the branch for r-uri as well as adds the other contacts as extra
> branches.
>
> You may want to set a branch flag when processing the REGISTER to know
> that it is a websocket. Then, you can test the same branch flag in
> branch_route to discover if the destination is over websocket or not.
>
> Cheers,
> Daniel
>
>
> On 10/02/15 12:01, Yuriy Gorlichenko wrote:
>
> Hello I use this version of kamailio
>
> kamailio -v
> version: kamailio 4.3.0-dev3 (x86_64/linux) 8cdbe7
> flags: STATS: Off, USE_TCP, USE_TLS, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC, DBG_F_MALLOC, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
> ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
> poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
> id: 8cdbe7
> compiled on 17:54:50 Jan 20 2015 with gcc 4.8.2
>
> I hav an issue with append branches to branch route when I need fork call
> to one endpoint woth different destionations.
>
> I use my own algorithm for call to this devices because with
> lookup("location") I can not use RTPENGINE for different types of endpoints
> (web endoints and standart UDP endpoints)
>
> My alg is here:
>
> {
>
> sql_query("ca", "select contact from location where username='$tU'", "ra");
> xlog("L_INFO","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");
> $var(recieved)='';
> 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)}");
> if ($var(recieved)==0){
> xlog("L_INFO", "Recieved string is EMPTY");
> $du="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@});
> }
> else {
> xlog("L_INFO", "Recieved string is {$var(recieved)}");
> $du=$var(recieved);
> }
> $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;
>
> }
> }
> else{
> exit;
> }
> t_on_branch("1");
> return;
>
> }
> }
>
> }
>
>
> branch_route[1]{
>
> if($du=~"transport=ws"){
> xlog("L_INFO","Websocket Branch is {$du} for {$tU}\n");
>
> rtpengine_manage("internal extenal force trust-address replace-origin replace-session-connection ICE=force RTP/SAVPF");
> t_on_reply("REPLY_FROM_WS");
>
> }
> else{
> xlog("L_INFO","UDP Branch is {$du)} for {$tU}\n");
>
> rtpengine_manage("replace-origin replace-session-connection ICE=remove RTP/AVP");
> t_on_reply("MANAGE_CLASSIC_REPLY");
> }
> }
>
> So as you see I choose array of devices and then set its to branches.
>
> At the kamailio console I see output
>
> This is output of alg that above.
>
> I have 3 devices: 2 websocket devices and 1 udp
> But when you look at dump where rtpengine make changes with packets you
> can see that it runs for 4 devices and 1 and 4 devices is the same.
> You can see start of every branch from words of log "Websocket Branch is"
> or "UDP Branch is"
>
> So this bug gives a mistake because some of hardphones can not handlie
> double INVITE and kamilio response for this devices cancel with 200 cause
> because hardphone set 482 reply to kamialio.
> (you can see it reply at the log)
>
> Feb 8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: rows: 3 cols: 1
> Feb 8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: SQL query return contact {sip:5ue13vsh at 2t4iielj109h.invalid;transport=ws} for {123455678} at step {0}
> Feb 8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: This is a Websocket call to endpoint
> Feb 8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: SQL query return recieved {sip:85.6.14.8:4328;transport=WS} for {123455678}. Destination is {sip:85.6.14.8:4328;transport=WS}
> Feb 8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: SQL query return contact {sip:a7uo9vsq at 7c0oo5kvc71e.invalid;transport=ws} for {123455678} at step {1}
> Feb 8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: This is a Websocket call to endpoint
> Feb 8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: SQL query return recieved {sip:85.2.10.3:58509;transport=WS} for {123455678}. Destination is {sip:85.2.10.3:58509;transport=WS}
> Feb 8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: SQL query return contact {sip:upsjchv2 at 5c88tisd29d4.invalid;transport=ws} for {123455678} at step {2}
> Feb 8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: This is a Websocket call to endpoint
> Feb 8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: SQL query return recieved {sip:18.9.18.10:56917;transport=WS} for {123455678}. Destination is {sip:18.9.18.10:56917;transport=WS}
> Feb 8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: Websocket Branch is {sip:18.9.18.10:56917;transport=WS} for {123455678}
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: Got valid command from 127.0.0.1:52689: offer - { "sdp": "v=0#015#012o=root 1141861088 1141861088 IN IP4 12.34.56.78#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 12.34.56.78#015#012t=0 0#015#012m=audio 12230 RTP/AVP 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012", "ICE": "force", "direction": [ "internal" ], "flags": [ "extenal", "force", "trust-address" ], "replace": [ "origin", ...
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: ... "session-connection" ], "transport-protocol": "RTP/SAVPF", "call-id": "220725c425526bc941dff8e972bd9458 at 12.34.56.78:50600", "received-from": [ "IP4", "12.34.56.78" ], "from-tag": "as4f0c032f", "command": "offer" }
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'extenal'
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'force'
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: [220725c425526bc941dff8e972bd9458 at 12.34.56.78:50600] Creating new call
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: [220725c425526bc941dff8e972bd9458 at 12.34.56.78:50600] Returning to SIP proxy: d3:sdp747:v=0#015#012o=root 1141861088 1141861088 IN IP4 23.101.139.216#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 23.101.139.216#015#012t=0 0#015#012a=ice-lite#015#012m=audio 38518 RTP/SAVPF 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012a=rtcp:38519#015#012a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:f31jYQjjKBdYoqWYijx0V/ZtTfP17pTVW8NJGVQ4#015#012a=setup:actpass#015#012a=fingerprint:sh ...
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: [220725c425526bc941dff8e972bd9458 at 12.34.56.78:50600] ... a-1 00:E3:0F:B6:C0:9F:D4:16:52:D2:41:A8:01:24:51:CD:3F:FB:B2:55#015#012a=ice-ufrag:VfqUSGBP#015#012a=ice-pwd:t5bLzDaNcqWUwzh7iEtyAZfweGo6#015#012a=candidate:04GQy5683m4TP1Da 1 UDP 2130706431 23.101.139.216 38518 typ host#015#012a=candidate:04GQy5683m4TP1Da 2 UDP 2130706430 23.101.139.216 38519 typ host#015#0126:result2:oke
> Feb 8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: Websocket Branch is {sip:85.6.14.8:4328;transport=WS} for {123455678}
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: Got valid command from 127.0.0.1:52689: offer - { "sdp": "v=0#015#012o=root 1141861088 1141861088 IN IP4 12.34.56.78#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 12.34.56.78#015#012t=0 0#015#012m=audio 12230 RTP/AVP 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012", "ICE": "force", "direction": [ "internal" ], "flags": [ "extenal", "force", "trust-address" ], "replace": [ "origin", ...
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: ... "session-connection" ], "transport-protocol": "RTP/SAVPF", "call-id": "220725c425526bc941dff8e972bd9458 at 12.34.56.78:50600", "received-from": [ "IP4", "12.34.56.78" ], "from-tag": "as4f0c032f", "command": "offer" }
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'extenal'
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'force'
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: [220725c425526bc941dff8e972bd9458 at 12.34.56.78:50600] Returning to SIP proxy: d3:sdp747:v=0#015#012o=root 1141861088 1141861088 IN IP4 23.101.139.216#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 23.101.139.216#015#012t=0 0#015#012a=ice-lite#015#012m=audio 38518 RTP/SAVPF 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012a=rtcp:38519#015#012a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:f31jYQjjKBdYoqWYijx0V/ZtTfP17pTVW8NJGVQ4#015#012a=setup:actpass#015#012a=fingerprint:sh ...
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: [220725c425526bc941dff8e972bd9458 at 12.34.56.78:50600] ... a-1 00:E3:0F:B6:C0:9F:D4:16:52:D2:41:A8:01:24:51:CD:3F:FB:B2:55#015#012a=ice-ufrag:VfqUSGBP#015#012a=ice-pwd:t5bLzDaNcqWUwzh7iEtyAZfweGo6#015#012a=candidate:04GQy5683m4TP1Da 1 UDP 2130706431 23.101.139.216 38518 typ host#015#012a=candidate:04GQy5683m4TP1Da 2 UDP 2130706430 23.101.139.216 38519 typ host#015#0126:result2:oke
> Feb 8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: Websocket Branch is {sip:85.2.10.3:58509;transport=WS} for {123455678}
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: Got valid command from 127.0.0.1:52689: offer - { "sdp": "v=0#015#012o=root 1141861088 1141861088 IN IP4 12.34.56.78#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 12.34.56.78#015#012t=0 0#015#012m=audio 12230 RTP/AVP 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012", "ICE": "force", "direction": [ "internal" ], "flags": [ "extenal", "force", "trust-address" ], "replace": [ "origin", ...
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: ... "session-connection" ], "transport-protocol": "RTP/SAVPF", "call-id": "220725c425526bc941dff8e972bd9458 at 12.34.56.78:50600", "received-from": [ "IP4", "12.34.56.78" ], "from-tag": "as4f0c032f", "command": "offer" }
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'extenal'
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'force'
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: [220725c425526bc941dff8e972bd9458 at 12.34.56.78:50600] Returning to SIP proxy: d3:sdp747:v=0#015#012o=root 1141861088 1141861088 IN IP4 23.101.139.216#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 23.101.139.216#015#012t=0 0#015#012a=ice-lite#015#012m=audio 38518 RTP/SAVPF 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012a=rtcp:38519#015#012a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:f31jYQjjKBdYoqWYijx0V/ZtTfP17pTVW8NJGVQ4#015#012a=setup:actpass#015#012a=fingerprint:sh ...
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: [220725c425526bc941dff8e972bd9458 at 12.34.56.78:50600] ... a-1 00:E3:0F:B6:C0:9F:D4:16:52:D2:41:A8:01:24:51:CD:3F:FB:B2:55#015#012a=ice-ufrag:VfqUSGBP#015#012a=ice-pwd:t5bLzDaNcqWUwzh7iEtyAZfweGo6#015#012a=candidate:04GQy5683m4TP1Da 1 UDP 2130706431 23.101.139.216 38518 typ host#015#012a=candidate:04GQy5683m4TP1Da 2 UDP 2130706430 23.101.139.216 38519 typ host#015#0126:result2:oke
> Feb 8 23:04:43 Kamailio2 kamailio[59406]: INFO: <script>: Websocket Branch is {sip:18.9.18.10:56917;transport=WS} for {123455678}
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: Got valid command from 127.0.0.1:52689: offer - { "sdp": "v=0#015#012o=root 1141861088 1141861088 IN IP4 12.34.56.78#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 12.34.56.78#015#012t=0 0#015#012m=audio 12230 RTP/AVP 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012", "ICE": "force", "direction": [ "internal" ], "flags": [ "extenal", "force", "trust-address" ], "replace": [ "origin", ...
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: ... "session-connection" ], "transport-protocol": "RTP/SAVPF", "call-id": "220725c425526bc941dff8e972bd9458 at 12.34.56.78:50600", "received-from": [ "IP4", "12.34.56.78" ], "from-tag": "as4f0c032f", "command": "offer" }
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'extenal'
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: Unknown flag encountered: 'force'
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: [220725c425526bc941dff8e972bd9458 at 12.34.56.78:50600] Returning to SIP proxy: d3:sdp747:v=0#015#012o=root 1141861088 1141861088 IN IP4 23.101.139.216#015#012s=Asterisk PBX 13.1.0#015#012c=IN IP4 23.101.139.216#015#012t=0 0#015#012a=ice-lite#015#012m=audio 38518 RTP/SAVPF 9 8 107 0 101#015#012a=rtpmap:9 G722/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:107 opus/48000/2#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=maxptime:60#015#012a=sendrecv#015#012a=rtcp:38519#015#012a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:f31jYQjjKBdYoqWYijx0V/ZtTfP17pTVW8NJGVQ4#015#012a=setup:actpass#015#012a=fingerprint:sh ...
> Feb 8 23:04:43 Kamailio2 rtpengine[55410]: [220725c425526bc941dff8e972bd9458 at 12.34.56.78:50600] ... a-1 00:E3:0F:B6:C0:9F:D4:16:52:D2:41:A8:01:24:51:CD:3F:FB:B2:55#015#012a=ice-ufrag:VfqUSGBP#015#012a=ice-pwd:t5bLzDaNcqWUwzh7iEtyAZfweGo6#015#012a=candidate:04GQy5683m4TP1Da 1 UDP 2130706431 23.101.139.216 38518 typ host#015#012a=candidate:04GQy5683m4TP1Da 2 UDP 2130706430 23.101.139.216 38519 typ host#015#0126:result2:oke
> Feb 8 23:04:43 Kamailio2 kamailio[59438]: INFO: <script>: Reply from webrtc client {18.9.18.10:56917} for method {INVITE}: 100
> Feb 8 23:04:43 Kamailio2 kamailio[59438]: INFO: <script>: Manage_Reply from webrtc client {18.9.18.10:56917} for method {INVITE}: 100
>
> Feb 8 23:04:43 Kamailio2 kamailio[59438]: INFO: <script>: Reply from webrtc client {18.9.18.10:56917} for method {INVITE}: 180
> Feb 8 23:04:43 Kamailio2 kamailio[59438]: INFO: <script>: Manage_Reply from webrtc client {18.9.18.10:56917} for method {INVITE}: 180
>
> Feb 8 23:04:43 Kamailio2 kamailio[59438]: INFO: <script>: Reply from webrtc client {18.9.18.10:56917} for method {INVITE}: 482
> Feb 8 23:04:43 Kamailio2 kamailio[59442]: INFO: <script>: Reply from webrtc client {85.2.10.3:58509} for method {INVITE}: 100
> Feb 8 23:04:43 Kamailio2 kamailio[59442]: INFO: <script>: Manage_Reply from webrtc client {85.2.10.3:58509} for method {INVITE}: 100
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users at lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
> --
> Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
> Kamailio World Conference, May 27-29, 2015
> Berlin, Germany - http://www.kamailioworld.com
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150210/8f1582f4/attachment.html>
More information about the sr-users
mailing list