[OpenSIPS-Users] NAT handling on a chain of proxies

mayamatakeshi mayamatakeshi at gmail.com
Sat Oct 31 09:32:30 CET 2009


On Fri, Oct 30, 2009 at 7:54 PM, mayamatakeshi <mayamatakeshi at gmail.com>wrote:

> Hello,
> is there an easy way to check if my opensips instance is the last proxy
> before the UAS?
> I need this to avoid calling nat_uac_test/fix_nated_contact in my
> onreply_route in case I'm receiving a response relayed by another proxy.
> I was thinking I could test if i'm in the top-most Record-Route in the
> reply, but I was unable to figure out how to do it.
>

Reading the page about transformations, I think something like this would
work:

if ( $(hdr(Record-Route)[0]{uri.host}) == myself ) {
   ....
}

However, I think to implement a generic way to handle this would become very
convoluted: I was thinking that I should do this considering the possibility
of dealing with redirection and downstream proxies that would do not
record_route or would do it conditionally. So I would have to check this,
set some parameter in Record-Route, take care in case of branching and
checking the Route header etc, etc.
But I think this is a lot of trouble and will not actually happen in our
network.
So I will write my cfg just testing:

if ( !from_gw() ) {
  fix_nated_contact();
}

because I just need to fix the contact of the registered users.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20091031/78ace6a8/attachment.htm 


More information about the Users mailing list