Asterisk Avoid SIP NAT Traversal

Using Asterisk as a SIP/IAX Gateway

The Asterisk open source telephony server can be used as a gateway in order to avoid SIP NAT Traversal. All VoIP devices on the LAN are configured to connect to an Asterisk server on the same LAN. The Asterisk server then connects to VoIP services on the Internet using the NAT friendly IAX protocol. The same technique can be applied to any other conventional VoIP protocol which has trouble traversing NAT.

On MacOSX, the SIP/IAX gateway setup for FWD as shown in the above diagram can be very easily configured using the Asterisk Assistants for MacOSX. It takes only a couple of minutes including installation and it requires no prior knowledge of Asterisk or VoIP.

Using the IAXy Analog Telephone Adapter

Alternatively, the IAXy Analog Telephone Adapter from Digium can be used in combination with any analog telephone to avoid SIP NAT Traversal. The analog telephone is connected to the IAXy using ordinary telephone wiring. The IAXy then connects to VoIP services on the Internet using the NAT friendly IAX protocol.

Configuration of IAXy for a FWD account behind a router.

  • Register a Free World Dialup account.
  • Put the new (or reseted) IAXy in the network.
  • Verify the IP which the IAXy got from the DHCP server (looking on the DHCP section of the router, or logs of the DHCP server, or just by ping -b and listening to udp port 9999 which the IAXy broadcast to as a response for ping).
  • Forward the udp port 4569 (iax2) to the right IP (or else the firmware from the asterisk server will never get to the IAXy, and no voice will come in).
  • Build the iaxyprov utility to remote upload configuration to the IAXy (that's the only way ...)
$ cd /usr/src
$ export
$ cvs login (the password is anoncvs)
$ cvs co iaxyprov
$ cd iaxyprov
  • Upload configuration:
$ ./iaxyprov iaxy.conf.fwd-sample


codec: ulaw
user: 654321
pass: password

  • Run the iaxyprov only ~20 seconds after power on of the IAXy, to enable a connection to the server.
  • To get the server IP, just ping
  • This setup is a good solution for using IAXy if one's asterisk is on a dynamic IP (e.g. with Dynamic DNS). IAXy takes no DNS (the asterisk server configuration must have a fixed IP), and using FWD asterisk IP, and connecting the asterisk to the FWD network just bypasses the problem.
  • The only codec supported by FWD is ulaw (a little expensive codec. The adpcm is supported by IAXy, and could have been bandwith wise cheaper. Maybe such a support appears on the FWD service.
  • The setup works probably also with DHCP configuration (just take care to update the port forward if the IP changes).
  • The IAXy used in this setup is version S101I (and uses also 6v power supply), but it should work with any other IAXy version.
  • For more information, contact LivneX

Potential problems

  • You will not be able to dial by SIP url with this configuration, i.e. dial sip:username@domain.tld - you will only be able to dial by FWD number.

Created by: oej, Last modification: Wed 10 of Sep, 2008 (08:19 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+