<div dir="ltr"><font color="#3366ff"><font><font face="tahoma,sans-serif">Okay, it seems we&#39;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="&#39;courier new&#39;, monospace">        if (is_method(&quot;INVITE|SUBSCRIBE&quot;)){</font></div>



<div><font face="&#39;courier new&#39;, monospace">                $avp(s:fs) = $fs;</font></div><div><font face="&#39;courier new&#39;, monospace">                $avp(s:Rp) = $Rp;</font></div><div><font face="&#39;courier new&#39;, monospace">                avp_subst(&quot;$avp(s:fs)&quot;, &quot;/(.*):(.*):(.*)/\3/&quot;);</font></div>



<div><font face="&#39;courier new&#39;, monospace">                #xlog(&quot;fs: $avp(s:fs) | Rp: $avp(s:Rp)&quot;);</font></div><div><font face="&#39;courier new&#39;, monospace">                if ($avp(s:fs) == $avp(s:Rp)) {</font></div>



<div><font face="&#39;courier new&#39;, monospace">                        record_route_preset(&quot;PUBLIC_IP:$avp(s:fs)&quot;);</font></div><div><font face="&#39;courier new&#39;, monospace">                        return;</font></div>



<div><font face="&#39;courier new&#39;, monospace">                }</font></div><div><font face="&#39;courier new&#39;, monospace">                record_route_preset(&quot;PUBLIC_IP:$avp(s:fs)&quot;, &quot;PUBLIC_IP:$avp(s:Rp)&quot;);</font></div>



<div><font face="&#39;courier new&#39;, monospace">        }</font></div><div><font face="&#39;courier new&#39;, 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&#39;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">&lt;<a href="mailto:osas@voipembedded.com" target="_blank">osas@voipembedded.com</a>&gt;</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 &lt;<a href="mailto:reda.aouad@gmail.com" target="_blank">reda.aouad@gmail.com</a>&gt; wrote:<br>
&gt; Thank you for your reply. I tried what you suggested.<br>
&gt;<br>
&gt; The problem is when there are multiple locations/registrations per AOR on<br>
&gt; different ports and doing parallel forking.<br>
&gt; Accessing $fs only gives one of the sockets (first or last?), not all of<br>
&gt; them.<br>
&gt; Accessing $sndfrom gives all of the used outgoing sockets, because it&#39;s<br>
&gt; populated in the onsedn_route route, which is called for every outgoing<br>
&gt; packet, but in onsend_route I can&#39;t use record_route functions, neither<br>
&gt; mangle with the SIP header anymore in any way. It&#39;s too late by the time I<br>
&gt; get to onsend_route...<br>
&gt;<br>
&gt; No solution so far..<br>
&gt;<br>
&gt;<br>
&gt; Reda<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Jan 17, 2012 at 21:47, Ovidiu Sas &lt;<a href="mailto:osas@voipembedded.com" target="_blank">osas@voipembedded.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; When you route through usrloc, there is a PV that should be set - forced<br>
&gt;&gt; socket:<br>
&gt;&gt; <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>
&gt;&gt; You can check the socket via &#39;kamctl ul show&#39; command.<br>
&gt;&gt; If the PV is not populated, check the send attributes:<br>
&gt;&gt;<br>
&gt;&gt; <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>
&gt;&gt; Based on that, you should know through which interface the INVITE<br>
&gt;&gt; should be sent and therefore you should be able to set the proper<br>
&gt;&gt; Record-Route header.<br>
&gt;&gt;<br>
&gt;&gt; Regards,<br>
&gt;&gt; Ovidiu Sas<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; VoIP Embedded, Inc.<br>
&gt;&gt; <a href="http://www.voipembedded.com" target="_blank">http://www.voipembedded.com</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Tue, Jan 17, 2012 at 3:01 PM, Reda Aouad &lt;<a href="mailto:reda.aouad@gmail.com" target="_blank">reda.aouad@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt; I just tried the record_route_advertised_address(&quot;public_ip&quot;).<br>
&gt;&gt; &gt; It doesn&#39;t add the port number of the outgoing socket.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Any suggestions?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; RA<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Mon, Jan 16, 2012 at 15:57, Reda Aouad &lt;<a href="mailto:reda.aouad@gmail.com" target="_blank">reda.aouad@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; I know about record_route_advertised_address(&quot;ip:port&quot;) function. If I<br>
&gt;&gt; &gt;&gt; understood correctly, it inserts a top-most RR header with the public<br>
&gt;&gt; &gt;&gt; IP if<br>
&gt;&gt; &gt;&gt; double RR is enabled. But that doesn&#39;t solve the multiple ports<br>
&gt;&gt; &gt;&gt; problem. I<br>
&gt;&gt; &gt;&gt; would get in the SIP header :<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Record-Route: &lt;public_ip;lr=on&gt;<br>
&gt;&gt; &gt;&gt; Record-Route: &lt;private_ip:port;lr=on&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; If user B sees the first Record-Route header, it remembers port=5060<br>
&gt;&gt; &gt;&gt; for<br>
&gt;&gt; &gt;&gt; future requests.<br>
&gt;&gt; &gt;&gt; I cannot manually set the port in the config file since it depends on<br>
&gt;&gt; &gt;&gt; which port user B is registered, which I don&#39;t have a way to find it.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; RA<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On Mon, Jan 16, 2012 at 15:51, Andrew Pogrebennyk<br>
&gt;&gt; &gt;&gt; &lt;<a href="mailto:apogrebennyk@sipwise.com" target="_blank">apogrebennyk@sipwise.com</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; Hi,<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; On 01/16/2012 03:41 PM, Reda Aouad wrote:<br>
&gt;&gt; &gt;&gt;&gt; &gt; I suggest that the function record_route( ) takes a public IP<br>
&gt;&gt; &gt;&gt;&gt; &gt; address<br>
&gt;&gt; &gt;&gt;&gt; &gt; as<br>
&gt;&gt; &gt;&gt;&gt; &gt; a parameter, still doing what it does (correct record routing and<br>
&gt;&gt; &gt;&gt;&gt; &gt; cookie<br>
&gt;&gt; &gt;&gt;&gt; &gt; addition did=xxx and loose route lr=on), but only replacing the<br>
&gt;&gt; &gt;&gt;&gt; &gt; private<br>
&gt;&gt; &gt;&gt;&gt; &gt; IP address on which Kamailio listens with a public IP address. Or<br>
&gt;&gt; &gt;&gt;&gt; &gt; that<br>
&gt;&gt; &gt;&gt;&gt; &gt; the record_route( ) function uses the advertised_address to<br>
&gt;&gt; &gt;&gt;&gt; &gt; construct<br>
&gt;&gt; &gt;&gt;&gt; &gt; the RR header.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; maybe you are looking for the function<br>
&gt;&gt; &gt;&gt;&gt; record_route_advertised_address()<br>
&gt;&gt; &gt;&gt;&gt; which is available in git master:<br>
&gt;&gt; &gt;&gt;&gt; <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>