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

Bogdan-Andrei Iancu bogdan at voice-system.ro
Thu Nov 19 13:00:02 CET 2009


Hi Takeshi,

Indeed, the NAT logic should be triggered by network information (and 
not SIP path) - information from the network level or from the SIP 
package itself.

Regards,
Bogdan

mayamatakeshi wrote:
>
> On Tue, Nov 17, 2009 at 12:00 AM, Bogdan-Andrei Iancu 
> <bogdan at voice-system.ro <mailto:bogdan at voice-system.ro>> wrote:
>
>     Hi Takeshi,
>
>     First of all, you want to do the detection for the initial requests or
>     for sequential requests only?
>
>
> Hi Bogdan,
> I needed to check and change both initial and subsequent requests.
>  
>
>
>     But going to the bottom, you should do the fixing only if the contact
>     show "signs" of NAT presence (network level or private ips) - so you
>     should not rely on the position of your proxy in the chain, but on the
>     actual information from the messages.
>
>
> 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.
> 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).
> So i just have to use is_from_gw (drouting) or from_gw (lcr) and 
> everything is fine now.
>
> br,
> takeshi
>  
>
>
>
>     mayamatakeshi wrote:
>     >
>     > On Fri, Oct 30, 2009 at 7:54 PM, mayamatakeshi
>     > <mayamatakeshi at gmail.com <mailto:mayamatakeshi at gmail.com>
>     <mailto:mayamatakeshi at gmail.com <mailto: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.
>     >
>
>     --
>     Bogdan-Andrei Iancu
>     www.voice-system.ro <http://www.voice-system.ro>
>
>
>     _______________________________________________
>     Users mailing list
>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro




More information about the Users mailing list