<div dir="ltr"><font color="#3366ff"><font><font face="tahoma,sans-serif">Okay, it seems we're on the right track.. BUT</font></font></font><div><font color="#3366ff"><font><font face="tahoma,sans-serif"><br></font></font></font></div>
<div><font color="#3366ff"><font><font face="tahoma,sans-serif">This is my code in the branch_route</font></font></font></div><div><font color="#3366ff"><font><br><div><font face="'courier new', monospace"> if (is_method("INVITE|SUBSCRIBE")){</font></div>
<div><font face="'courier new', monospace"> $avp(s:fs) = $fs;</font></div><div><font face="'courier new', monospace"> $avp(s:Rp) = $Rp;</font></div><div><font face="'courier new', monospace"> avp_subst("$avp(s:fs)", "/(.*):(.*):(.*)/\3/");</font></div>
<div><font face="'courier new', monospace"> #xlog("fs: $avp(s:fs) | Rp: $avp(s:Rp)");</font></div><div><font face="'courier new', monospace"> if ($avp(s:fs) == $avp(s:Rp)) {</font></div>
<div><font face="'courier new', monospace"> record_route_preset("PUBLIC_IP:$avp(s:fs)");</font></div><div><font face="'courier new', monospace"> return;</font></div>
<div><font face="'courier new', monospace"> }</font></div><div><font face="'courier new', monospace"> record_route_preset("PUBLIC_IP:$avp(s:fs)", "PUBLIC_IP:$avp(s:Rp)");</font></div>
<div><font face="'courier new', monospace"> }</font></div><div><font face="'courier new', monospace"> return;</font></div><div style="font-family:tahoma,sans-serif"><br></div></font></font></div>
<div><font color="#3366ff" face="tahoma, sans-serif">$avp(s:fs) is the outbound socket, on which I apply the avp_subst function to extract only the outbound port number Kamailio should send from.</font></div><div><font color="#3366ff" face="tahoma, sans-serif">$avp(s:Rp) is the inbound port, the port on which Kamailio received the INVITE.</font></div>
<div><font color="#3366ff" face="tahoma, sans-serif">Then if the above port numbers are equal, I do only one record route. If not, I do double record routing, one per port number.</font></div>
<div><font color="#3366ff"><font><font face="tahoma,sans-serif"><br></font></font></font></div><div><font color="#3366ff"><font><font face="tahoma,sans-serif">The problem is that for the first branch, everything works fine. But for the subsequent branches, I get the following error :</font></font></font></div>
<div><font color="#3366ff"><font><font face="tahoma,sans-serif"> ERROR: rr [rr_mod.c:256]: Duble attempt to record-route</font></font></font></div><div><font color="#3366ff"><font><font face="tahoma,sans-serif"><br>
</font></font></font></div><div><font color="#3366ff"><font><font face="tahoma,sans-serif">It seems that for subsequent branches, Kamailio detects that it already record routed the first branch, so gives an error and doesn't record route.</font></font></font></div>
<div><font color="#3366ff"><font><font face="tahoma,sans-serif"><br clear="all"></font></font></font><div dir="ltr"><font color="#3366ff" face="tahoma, sans-serif"><br>
</font><div><font color="#3366ff" face="tahoma, sans-serif">Reda</font></div></div><br>
<br><br><div class="gmail_quote">On Wed, Jan 18, 2012 at 23:45, Ovidiu Sas <span dir="ltr"><<a href="mailto:osas@voipembedded.com" target="_blank">osas@voipembedded.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Test them in branch_route:<br>
<a href="http://www.kamailio.org/wiki/cookbooks/3.2.x/core#branch_route" target="_blank">http://www.kamailio.org/wiki/cookbooks/3.2.x/core#branch_route</a><br>
and set the Record-Route header there, for each individual branch.<br>
<div><br>
Regards,<br>
Ovidiu Sas<br>
<br>
--<br>
VoIP Embedded, Inc.<br>
<a href="http://www.voipembedded.com" target="_blank">http://www.voipembedded.com</a><br>
<br>
<br>
</div><div><div>On Wed, Jan 18, 2012 at 5:37 PM, Reda Aouad <<a href="mailto:reda.aouad@gmail.com" target="_blank">reda.aouad@gmail.com</a>> wrote:<br>
> Thank you for your reply. I tried what you suggested.<br>
><br>
> The problem is when there are multiple locations/registrations per AOR on<br>
> different ports and doing parallel forking.<br>
> Accessing $fs only gives one of the sockets (first or last?), not all of<br>
> them.<br>
> Accessing $sndfrom gives all of the used outgoing sockets, because it's<br>
> populated in the onsedn_route route, which is called for every outgoing<br>
> packet, but in onsend_route I can't use record_route functions, neither<br>
> mangle with the SIP header anymore in any way. It's too late by the time I<br>
> get to onsend_route...<br>
><br>
> No solution so far..<br>
><br>
><br>
> Reda<br>
><br>
><br>
><br>
> On Tue, Jan 17, 2012 at 21:47, Ovidiu Sas <<a href="mailto:osas@voipembedded.com" target="_blank">osas@voipembedded.com</a>> wrote:<br>
>><br>
>> When you route through usrloc, there is a PV that should be set - forced<br>
>> socket:<br>
>> <a href="http://www.kamailio.org/wiki/cookbooks/devel/pseudovariables#forced_socket" target="_blank">http://www.kamailio.org/wiki/cookbooks/devel/pseudovariables#forced_socket</a><br>
>> You can check the socket via 'kamctl ul show' command.<br>
>> If the PV is not populated, check the send attributes:<br>
>><br>
>> <a href="http://www.kamailio.org/wiki/cookbooks/devel/pseudovariables#send_address_attributes" target="_blank">http://www.kamailio.org/wiki/cookbooks/devel/pseudovariables#send_address_attributes</a><br>
>> Based on that, you should know through which interface the INVITE<br>
>> should be sent and therefore you should be able to set the proper<br>
>> Record-Route header.<br>
>><br>
>> Regards,<br>
>> Ovidiu Sas<br>
>><br>
>> --<br>
>> VoIP Embedded, Inc.<br>
>> <a href="http://www.voipembedded.com" target="_blank">http://www.voipembedded.com</a><br>
>><br>
>><br>
>> On Tue, Jan 17, 2012 at 3:01 PM, Reda Aouad <<a href="mailto:reda.aouad@gmail.com" target="_blank">reda.aouad@gmail.com</a>> wrote:<br>
>> > I just tried the record_route_advertised_address("public_ip").<br>
>> > It doesn't add the port number of the outgoing socket.<br>
>> ><br>
>> > Any suggestions?<br>
>> ><br>
>> > RA<br>
>> ><br>
>> ><br>
>> ><br>
>> > On Mon, Jan 16, 2012 at 15:57, Reda Aouad <<a href="mailto:reda.aouad@gmail.com" target="_blank">reda.aouad@gmail.com</a>> wrote:<br>
>> >><br>
>> >> I know about record_route_advertised_address("ip:port") function. If I<br>
>> >> understood correctly, it inserts a top-most RR header with the public<br>
>> >> IP if<br>
>> >> double RR is enabled. But that doesn't solve the multiple ports<br>
>> >> problem. I<br>
>> >> would get in the SIP header :<br>
>> >><br>
>> >> Record-Route: <public_ip;lr=on><br>
>> >> Record-Route: <private_ip:port;lr=on><br>
>> >><br>
>> >> If user B sees the first Record-Route header, it remembers port=5060<br>
>> >> for<br>
>> >> future requests.<br>
>> >> I cannot manually set the port in the config file since it depends on<br>
>> >> which port user B is registered, which I don't have a way to find it.<br>
>> >><br>
>> >> RA<br>
>> >><br>
>> >><br>
>> >><br>
>> >> On Mon, Jan 16, 2012 at 15:51, Andrew Pogrebennyk<br>
>> >> <<a href="mailto:apogrebennyk@sipwise.com" target="_blank">apogrebennyk@sipwise.com</a>> wrote:<br>
>> >>><br>
>> >>> Hi,<br>
>> >>><br>
>> >>> On 01/16/2012 03:41 PM, Reda Aouad wrote:<br>
>> >>> > I suggest that the function record_route( ) takes a public IP<br>
>> >>> > address<br>
>> >>> > as<br>
>> >>> > a parameter, still doing what it does (correct record routing and<br>
>> >>> > cookie<br>
>> >>> > addition did=xxx and loose route lr=on), but only replacing the<br>
>> >>> > private<br>
>> >>> > IP address on which Kamailio listens with a public IP address. Or<br>
>> >>> > that<br>
>> >>> > the record_route( ) function uses the advertised_address to<br>
>> >>> > construct<br>
>> >>> > the RR header.<br>
>> >>><br>
>> >>> maybe you are looking for the function<br>
>> >>> record_route_advertised_address()<br>
>> >>> which is available in git master:<br>
>> >>> <a href="http://web.archiveorange.com/archive/v/jZFTGE0yjPqCTTcAkzuf" target="_blank">http://web.archiveorange.com/archive/v/jZFTGE0yjPqCTTcAkzuf</a><br>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</div></div></blockquote></div><br></div></div>