[OpenSIPS-Users] Contact problems using nat_traversal

Dan Pascu dan at ag-projects.com
Mon Aug 30 12:13:12 CEST 2010


On 29 Aug 2010, at 23:47, Yaniv Vaknin wrote:

>
> Hi,
> I have two Opensips servers, both with public IP's, I use them as an
> outbound proxy.
> both servers are running version 1.6.2, the difference is that they  
> run
> different OS and that one of them installed via SVN.
> The problem is that when I register a client via one server the  
> contact
> field is set to my server instead of the client IP address.

You need to call nat_keepalive() on the border server that's the entry  
point, not later.

Phone -> Pa -> Pb -> Pc -> Destination

Pa needs to call nat_keepalive() in the above example, not Pb nor Pc.  
Also call it the first time the SIP message enters the proxy, not  
later after you maybe looped the message through the proxy and it  
comes from itself.



> I copied the configuration file from the working server but the  
> problem
> persist...
>
> I use the following :
>
> loadmodule "nat_traversal.so"
> modparam("nat_traversal", "keepalive_interval", 90)
> modparam("nat_traversal", "keepalive_method", "NOTIFY")
>
> if (client_nat_test("3")) {
> xlog ("L_WARN", "source uri is.....$source_uri\n\n\n");
> force_rport();
>     fix_contact();
>
>     if ((method=="REGISTER"  ||(method=="INVITE" && !has_totag())) )
>  {
>      nat_keepalive();
>  }
> }
>
> here is the asterisk sip trace:
>
> 1.1.1.1 - Asterisk server
> 2.2.2.2 - Opensips server
>
> REGISTER sip:1.1.1.1 SIP/2.0
> Via: SIP/2.0/UDP 2.2.2.2;branch=z9hG4bKaf29.e5f35d04.0
> Via: SIP/2.0/UDP
> 192.168.5.102:5060;received=84.108.207.103;branch=z9hG4bK- 
> ln3bfw2dzns8;rport=1201
> From: <sip:201 at 1.1.1.1>;tag=z1vu2n07nk
> To: <sip:201 at 1.1.1.1>
> Call-ID: 3c26c9e8ac62-3f9tq2ss8sef
> CSeq: 143 REGISTER
> Max-Forwards: 69
> Contact:
> <sip:201 at 2.2.2.2:1201>;reg-id=1;q=1.0;+sip.instance="<urn:uuid:403adde2-966a-4810-9884-1297ab488584 
> > 
> ";audio 
> ;mobility 
> = 
> "fixed 
> ";duplex 
> = 
> "full 
> ";description 
> = 
> "snom320 
> ";actor 
> = 
> "principal 
> ";events 
> = 
> "dialog 
> ";methods 
> = 
> "INVITE 
> ,ACK,CANCEL,BYE,REFER,OPTIONS,NOTIFY,SUBSCRIBE,PRACK,MESSAGE,INFO"
> User-Agent: snom320/7.3.30
> Supported: gruu
> Allow-Events: dialog
> X-Real-IP: 192.168.5.102
> Expires: 0
> Content-Length: 0
>
>
> And here is the correct packet from asterisk:
>
> REGISTER sip:1.1.1.1 SIP/2.0
> Via: SIP/2.0/UDP 2.2.2.2;branch=z9hG4bK7c0e.d7ff3973.0
> Via: SIP/2.0/UDP
> 192.168.5.102:5060;received=84.108.207.103;branch=z9hG4bK- 
> gjsza8t89n7x;rport=1201
> From: <sip:201 at 1.1.1.1>;tag=oa2wzegbv1
> To: <sip:201 at 1.1.1.1>
> Call-ID: 3c26c27d340f-t3j6g9ehuz4q
> CSeq: 123 REGISTER
> Max-Forwards: 69
> Contact:
> <sip:201 at 84.108.207.103:1201>;reg-id=1;q=1.0;+sip.instance="<urn:uuid:c6252d37-19ae-47b6-982b-3932725a444c 
> > 
> ";audio 
> ;mobility 
> = 
> "fixed 
> ";duplex 
> = 
> "full 
> ";description 
> = 
> "snom320 
> ";actor 
> = 
> "principal 
> ";events 
> = 
> "dialog 
> ";methods 
> = 
> "INVITE 
> ,ACK,CANCEL,BYE,REFER,OPTIONS,NOTIFY,SUBSCRIBE,PRACK,MESSAGE,INFO"
> User-Agent: snom320/7.3.30
> Supported: gruu
> Allow-Events: dialog
> X-Real-IP: 192.168.5.102
> Expires: 3600
> Content-Length: 0
>
>
>
>
>
> Thanks,
> Yaniv
> -- 
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Contact-problems-using-nat-traversal-tp5475891p5475891.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>


--
Dan









More information about the Users mailing list