<br><div class="gmail_quote">On Tue, Nov 17, 2009 at 12:00 AM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>></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 "signs" 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>
><br>
> On Fri, Oct 30, 2009 at 7:54 PM, mayamatakeshi<br>
</div><div><div></div><div class="h5">> <<a href="mailto:mayamatakeshi@gmail.com">mayamatakeshi@gmail.com</a> <mailto:<a href="mailto:mayamatakeshi@gmail.com">mayamatakeshi@gmail.com</a>>> wrote:<br>
><br>
> Hello,<br>
> is there an easy way to check if my opensips instance is the last<br>
> proxy before the UAS?<br>
> I need this to avoid calling nat_uac_test/fix_nated_contact in my<br>
> onreply_route in case I'm receiving a response relayed by another<br>
> proxy.<br>
> I was thinking I could test if i'm in the top-most Record-Route in<br>
> the reply, but I was unable to figure out how to do it.<br>
><br>
><br>
> Reading the page about transformations, I think something like this<br>
> would work:<br>
><br>
> if ( $(hdr(Record-Route)[0]{uri.host}) == myself ) {<br>
> ....<br>
> }<br>
><br>
> However, I think to implement a generic way to handle this would<br>
> become very convoluted: I was thinking that I should do this<br>
> considering the possibility of dealing with redirection and downstream<br>
> proxies that would do not record_route or would do it conditionally.<br>
> So I would have to check this, set some parameter in Record-Route,<br>
> take care in case of branching and checking the Route header etc, etc.<br>
> But I think this is a lot of trouble and will not actually happen in<br>
> our network.<br>
> So I will write my cfg just testing:<br>
><br>
> if ( !from_gw() ) {<br>
> fix_nated_contact();<br>
> }<br>
><br>
> because I just need to fix the contact of the registered users.<br>
><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>