[SR-Users] rtpengine not working with append_branch

Yuriy Gorlichenko ovoshlook at gmail.com
Mon Oct 27 03:16:10 CET 2014


 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 at 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 at 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 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/20141027/1965eae9/attachment.html>


More information about the sr-users mailing list