Solution to the Asterisk problem – no sound when calling via NAT

I noticed recently that there is no sound when calling from IP-phone to another IP-phone which were both behind the same NAT (router).

Therefore, in the sip.conf configuration for these accounts, you need to specify that they are behind NAT, specifying the parameter:

nat=force_rport,comedia

I want to note that the value of “yes” for nat is already obsolete since version Asterisk 11, so it will be correct as mentioned above.

And also point at no to the directmedia parameter, so that Asterisk does not send packets to the same port from which it was received (which in my case happened, both phones connected to Asterisk from the same IP, with the same ports):

directmedia=no

Earlier in older versions of asterisk, instead of directmedia=no, canreinvite=no was used.

To support a NAT connection, specify the qualify parameter:

qualify=yes
;qualify=300

Also in the “general” section you can manually specify the local network and the external asterisk IP address for connections, for example:

[general]
localnet=10.10.10.0/255.255.255.240
externip=10.10.10.3

Leave a comment

Leave a Reply