[Asterisk-Users] SIP behind NAT - use of "externip" option

Kevin Pearcey asterisk at loon.org.uk
Thu Jan 29 06:57:50 MST 2004


I've just recently got this working with asterisk 0.7.1.

You also need to add values for:
Localnet & localmask to indicate the values that do not get externip set.

However, this did not fully solve the problem for me. External phones would
register just fine, but then I kept getting lots of retry failures. It
appears that asterisk changes the Call-ID value between what is sent and
what is stored internally!

Once a phone registers I sip debug shows asterisk sending a NOTIFY message
wit a Call-ID value using the externip address, however the 200 OK response
back from the phone has a call id with the same random characters but has
the localip address instead.

I've currently solved this but removing the ip address from build_callid()
until I try to see where asterisk gets this wrong. Has anyone else seen
this?

Having made this fix I now have SIP going NAT - NAT <- asterisk.

Kevin

> -----Original Message-----
> From: asterisk-users-admin at lists.digium.com 
> [mailto:asterisk-users-admin at lists.digium.com] On Behalf Of 
> Patrick Lidstone (Personal E-mail)
> Sent: 26 January 2004 18:31
> To: asterisk-users at lists.digium.com
> Subject: [Asterisk-Users] SIP behind NAT - use of "externip" option
> 
> 
> I am having difficulty configuring SIP behind NAT (using latest CVS).
> 
> Using sip.conf:
> 
> [general]
> port=5060                       ; Port to bind to
> externip=ww.xx.yy.zz
> bindaddr=0.0.0.0
> nat=yes
> register=>[userid]:[password]@voiptalk.org/2000
> [voiptalk.org]
> nat=yes
> externip=ww.xx.yy.zz
> type=friend
> secret=[password]
> nat=yes
> reinvite=no
> canreinvite=no
> 
> I fail to register. SIP Debug gives:
> 
> SIP Debugging Enabled
> Jan 26 18:20:04 NOTICE[9226]: chan_sip.c:3126 
> sip_reg_timeout: Registration for  '[userid]@82.145.32.73' 
> timed out, trying again 11 headers, 0 lines  Reliably 
> Transmitting: REGISTER sip:voiptalk.org SIP/2.0
> Via: SIP/2.0/UDP 192.168.0.89:5060;branch=z9hG4bK02c0373f
> From: <sip:[userid]@voiptalk.org>;tag=as5548d275
> To: <sip:[userid]@voiptalk.org>
> Call-ID: 31f5cfdd49c26a3523f55d3b7503a587 at 192.168.0.89
> CSeq: 103 REGISTER
> User-Agent: Asterisk PBX
> Expires: 120
> Contact: <sip:2000 at 192.168.0.89>
> Event: registration
> Content-length: 0
> 
>  (no NAT) to 82.145.32.73:5060
> Retransmitting #1 (no NAT):
> REGISTER sip:voiptalk.org SIP/2.0
> Via: SIP/2.0/UDP 192.168.0.89:5060;branch=z9hG4bK02c0373f
> From: <sip:[userid]@voiptalk.org>;tag=as5548d275
> To: <sip:[userid]@voiptalk.org>
> Call-ID: 31f5cfdd49c26a3523f55d3b7503a587 at 192.168.0.89
> CSeq: 103 REGISTER
> User-Agent: Asterisk PBX
> Expires: 120
> Contact: <sip:2000 at 192.168.0.89>
> Event: registration
> Content-length: 0
> 
> 
>  to 82.145.32.73:5060
> Retransmitting #2 (no NAT):
> ... as previous frame ...
> 
> I would expect (perhaps wrongly?) that the externip would be 
> reflected in the Via: header (it seems to be when I look at 
> the traces from a SNOM 100 successfully registery with 
> voiptalk behind the same firewall). And the (no NAT) comments 
> in the debug trace also look suspicious, given the explicit 
> nat=yes in the config.
> 
> Any hints? I guess the externip might be in the wrong place 
> or conflicting with one of my other options, but neither the 
> docs don't seem to offer much by way of advice (I've checked 
> the wiki, googled etc). Thanks Patrick
> 
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com 
> http://lists.digium.com/mailman/listinfo/aster> isk-users
> To 
> UNSUBSCRIBE or update options visit:
>    
http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list