Thursday, October 15, 2009

Configuration for Asterisk behind NAT

Following the rollout of our new sip cluster, and the introduction of Kamailio extension state management, we would like to publish the new Asterisk configuartion required to work with mydivert.com

This configuration example assumes that your Asterisk server is on a private IP address behind NAT. If your Asterisk is behind NAT it must be setup to work behind NAT, i.e it should send it's private IP address in the contact field. This way the mydivert.com server knows that the respective peer is behind NAT and it can send back the packet properly.

To configure Asterisk with mydivert.com please make the following replacements in the sip.conf example given below:

SIPUSERNAME = Your SIP account username
SIPPASSWORD = Your SIP account password
LOCAL-IP = Your asterisk LOCAL IP address (example: 192.168.1.0/255.255.255.0)
PUBLIC-IP = Your PUBLIC IP address (example: 200.43.215.194)

The configuration for Asterisk (sip.conf) should look like this :

[general]
disallow = all
allow = g729
allow = ulaw
allow = alaw
extenip = PUBLIC-IP
localnet = LOCAL-IP
context = default
nat = yes
domain = PUBLIC-IP

register => SIPUSERNAME:SIPPASSWORD@sip1.mydivert.com/SIPUSERNAME

[sip1.mydivert.com]
fromuser = SIPUSERNAME
username = SIPUSERNAME
authuser = SIPUSERNAME
insecure = very
dtmfmode = rfc2833
dtmf = rfc2833
disallow = all
allow = g729
allow = ulaw
allow = alaw
type = peer
host = sip1.mydivert.com
qualify = yes
nat = yes
context = default
canreinvite = yes
secret = SIPPASSWORD

No comments:

Post a Comment