[Asterisk-Users] External and internal SIP do not work together with nat

Joseph Tanner joseph at thetechguide.com
Thu Mar 25 15:29:40 MST 2004


Here's the main problem I've run into.  I'm trying to use FWD with
Asterisk, and am behind a nat device (dsl modem with nat built-in, no way
to bind the IP directly to a server/PC).  I also have a SIP gateway, a
Welltech 3502 (it goes by many other names, always see it with the 3502
model number).  I am unable to get Asterisk to work with both FWD and the
3502 at the same time.  It will work perfectly with one or the other, just
not both.

Since I'm using NAT, in my sip.conf I have to specify the external IP to
get FWD to work.  I also have a dynamic IP if that matters, but I found
that using a domain name in place of an IP works (i.e., I use externip =
myserver.gotdns.com and it works fine).  When I comment this out, FWD
stops working but the 3502 starts working fine.  I ran sip debug on the
Asterisk console, and it appears that with the externip value set, it's
returning that IP to the 3502 instead of the internal IP.  If I could get
it to return the internal IP for the 3502, and the external IP for FWD, I
think it'd work.

Below is my sip.conf, with a few minor changes (edited the dynamic dns
domain and callerid numbers, and took out actual FWD username/password). 
This is the current working configuration; I comment out externip and the
3502 gateway works, and if I uncomment it FWD works.  For kicks I have set
nat=yes and nat=no for both FWD and the gateway ports (had it set to yes
for fwd and no for the gateway, then reversed, then both set to yes, and
both set to no...no change).  I also changed canreinvite to yes for the
gateway ports, with no change.

;
; SIP Configuration for Asterisk
;
[general]
port = 5061                     ; Port to bind to
bindaddr = 0.0.0.0              ; Address to bind to
externip = mydomain.gotdns.com
localnet = 192.168.1.18         ; Internal NETWORK address
localmask = 255.255.255.0      ; Internal netmask
context = biz           ; Default for incoming calls

register => 2555555:mypassword at fwd.pulver.com

[fwd]
type=friend
secret=mypassword
username=555555
host=fwd.pulver.com
dtmfmode=inband
context=biz
nat=yes
canreinvite=no
callerid="Business Line" <(800) 555-1212>

[1001]
type=friend
username=1001
host=dynamic
context=main
canreinvite=no
txgain=3.5
rxgain=2.5
nat=no

[1002]
type=friend
username=1002
host=dynamic
context=main
canreinvite=no
txgain=3.5
rxgain=2.5
nat=no



More information about the asterisk-users mailing list