<br><div class="gmail_quote">On Tue, Nov 17, 2009 at 12:00 AM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Takeshi,<br>
<br>
First of all, you want to do the detection for the initial requests or<br>
for sequential requests only?<br></blockquote><div><br>Hi Bogdan,<br>I needed to check and change both initial and subsequent requests.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<br>
But going to the bottom, you should do the fixing only if the contact<br>
show &quot;signs&quot; of NAT presence (network level or private ips) - so you<br>
should not rely on the position of your proxy in the chain, but on the<br>
actual information from the messages.<br></blockquote><div><br>Yes, but in my case, the downstream proxy bridges public and private networks and so some private ips showing up in the Contact header were valid and should not be modified and this was causing problems.<br>
So, I decided to check and fix the header Contact only if the source of the message is not in the GW tables (in this table I put all proxies and GWs I interconnect with). <br>So i just have to use is_from_gw (drouting) or from_gw (lcr) and everything is fine now.<br>
<br>br,<br>takeshi<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<div class="im"><br>
mayamatakeshi wrote:<br>
&gt;<br>
&gt; On Fri, Oct 30, 2009 at 7:54 PM, mayamatakeshi<br>
</div><div><div></div><div class="h5">&gt; &lt;<a href="mailto:mayamatakeshi@gmail.com">mayamatakeshi@gmail.com</a> &lt;mailto:<a href="mailto:mayamatakeshi@gmail.com">mayamatakeshi@gmail.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     Hello,<br>
&gt;     is there an easy way to check if my opensips instance is the last<br>
&gt;     proxy before the UAS?<br>
&gt;     I need this to avoid calling nat_uac_test/fix_nated_contact in my<br>
&gt;     onreply_route in case I&#39;m receiving a response relayed by another<br>
&gt;     proxy.<br>
&gt;     I was thinking I could test if i&#39;m in the top-most Record-Route in<br>
&gt;     the reply, but I was unable to figure out how to do it.<br>
&gt;<br>
&gt;<br>
&gt; Reading the page about transformations, I think something like this<br>
&gt; would work:<br>
&gt;<br>
&gt; if ( $(hdr(Record-Route)[0]{uri.host}) == myself ) {<br>
&gt;    ....<br>
&gt; }<br>
&gt;<br>
&gt; However, I think to implement a generic way to handle this would<br>
&gt; become very convoluted: I was thinking that I should do this<br>
&gt; considering the possibility of dealing with redirection and downstream<br>
&gt; proxies that would do not record_route or would do it conditionally.<br>
&gt; So I would have to check this, set some parameter in Record-Route,<br>
&gt; take care in case of branching and checking the Route header etc, etc.<br>
&gt; But I think this is a lot of trouble and will not actually happen in<br>
&gt; our network.<br>
&gt; So I will write my cfg just testing:<br>
&gt;<br>
&gt; if ( !from_gw() ) {<br>
&gt;   fix_nated_contact();<br>
&gt; }<br>
&gt;<br>
&gt; because I just need to fix the contact of the registered users.<br>
&gt;<br>
<br>
</div></div>--<br>
Bogdan-Andrei Iancu<br>
<a href="http://www.voice-system.ro" target="_blank">www.voice-system.ro</a><br>
<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div><br>