Frequently Asked Questions (FAQs):When Asterisk is behind a NAT Router

VoIP: When Asterisk is behind a NAT Router

If your Asterisk Voice over IP server is behind a network address translation (NAT) router [which tends to be most routers], you'll need to make the following manual configurations in the sip_nat.conf file:
externip = X.X.X.X ;(substitute your public ip address)
localnet = 192.168.X.0/255.255.255.0 ;(substitute your lan subnet address)
nat=yes

Ports to forward on router:
4569 TCP/UDP - iax
5004-5082 TCP/UDP - sip
10000-20000 TCP/UDP - sip