Multiple SIP phones behind NAT to external asterisk

As the title suggests, I am trying to use several SIP phones behind a NAT router to connect to asterisk on an external network, i.e. all the phones have the same external IP address. Individually, the phones work fine, I can make and receive calls. However, they can’t call each other, or rather they can, but there is no audio. On the asterisk side, I have set NAT=yes in sip.conf (I have tried other values, but it makes no difference) and I have set the phones to use different RTP port ranges. RTP debug output from asterisk suggests that asterisk is using the correct IP address, but only two RTP ports - I would have thought that four were necessary, two for each phone:

Got RTP packet from 99.145.91.37:13000 (type 00, seq 026986, ts 003840, len 000160)
Sent RTP packet to 99.145.91.37:16422 (type 00, seq 001408, ts 003840, len 000160)
Got RTP packet from 99.145.91.37:13000 (type 00, seq 026987, ts 004000, len 000160)
Sent RTP packet to 99.145.91.37:16422 (type 00, seq 001409, ts 004000, len 000160)
Got RTP packet from 99.145.91.37:16422 (type 00, seq 011237, ts 466542103, l en 000160)
Sent RTP packet to 99.145.91.37:13000 (type 00, seq 058280, ts 466542096, l en 000160)

‘sip show peers’ for the two phones in question:
60/60 99.145.91.37 D N 6060 OK (342 ms)
41/41 99.145.91.37 D N 5060 OK (147 ms)

Any suggestions?
Thanks,
Ian.

Check to see if you have externip set in sip.conf as well as see if you have set localnet ? Try putting this in under the general section of sip.conf


localnet=192.168.0.0/255.255.0.0; All RFC 1918 addresses are local networks
localnet=10.0.0.0/255.0.0.0     ; Also RFC1918
localnet=172.16.0.0/12         ; Another RFC1918 with CIDR notation

I think it’s ok:

[general]
context=phones
bindport=5060
bindaddr=0.0.0.0
recordhistory=yes
disallow=all ; disallow all codecs
trustrpid=yes
sendrpid=yes
realm=asterisk
localnet=192.168.1.0/255.255.255.0
externip=xx.xx.xx.xx ; Florida IP
externrefresh=15
insecure=port,invite
qualify=2500
nat=yes
subscribemwi=yes ; Maybe necessary for Siemens C470IP, may break other phones!
checkmwi=60 ; seconds between checks for voicemail
vmexten=500

You failed to specify CoDec(s) to use.

I do this for each phone:

phonesets ;Defaults for all extention phones
type=friend
context=phones
host=dynamic
allow=ulaw
allow=alaw
subscribecontext=internal

What exactly did you mean by connect to asterisk on an external network?

Network F (Florida) has the asterisk machine. It’s behind a NAT router, but that does not seem to pose a problem since I can connect to it quite happily from Network C (Chicago), which is another NATed network, or for that matter from Network P (Paris). The problem is that two phones in network C or P cannot call each other via asterisk in F, at least with audio.

Thanks,
Ian.

OK. Now, I understand better.

[quote=“pmlco”]realm=asterisk
localnet=192.168.1.0/255.255.255.0
externip=xx.xx.xx.xx ; Florida IP[/quote]
Shouldn’t the realm line contain your FQDN? Also, despite not being recommended for production environments, I prefer to use externhost over externip mainly because I can have my router automatically updated the FQDN of my new IP Address, instead of having me to keep changing the IP Address pointed to by externip. In your case, make sure your externip value matches with the external IP Address on net F. When you said On the asterisk side, I have set NAT=yes in sip.conf, did you mean you have specified each extension with NAT=yes?

I have set the realm to the FQDN, although this doesn’t seem to help. However, setting the infamous ‘canreinvite’ to ‘no’ does the trick.

Thanks for your suggestions,
Ian.

Who is your ISP in FL ? I know that Bright House has lots of issues with VOIP in general.

AT&T, formerly BellSouth