Create an IAX Trunk
From Asterisk Australia
Contents |
Overview
Creating and IAX trunk allows 2 locations to pass calls like they are local. For example say we have an office in Sydney (Extensions 2xx) and an Office in Melbourne (Extensions 3xx). The 2 sites can now transfer calls and call each other for free. The IAX (Inter Asterisk eXchange) protocol is excellent at NAT connections and great for Asterisk to Asterisk connections. Why is IAX so good for NAT? Sip uses port 5060 to communicate, and another port for the audio stream. IAX uses the same port for communications and audio stream, this means you only need to forward the single port.
Connecting
Each trunk requires a user and a peer, it is better if you have a static IP address at each location.
Sydney Server - Extensions 2XX On the Sydney server, log into your admin interface. Click Trunks, Add IAX2 Trunk.
Outgoing Settings
Trunk Name: Sydney-Peer
Peer Details: Username=Melbourne-User host=MelbourneIP qualify=yes trunk=yes type=peer secret=*password*
User Context: Sydney-User
User Details: secret=*password* type=user context=from-trunk
Create outbound route:
Dial Patterns: 3XX trunk Sequence: IAX2/Sydney-Peer
Melbourne Server - Extensions 3XX
On the Melbourne server, log into your admin interface. Click Trunks, Add IAX2 Trunk.
Trunk Name: Melbourne-Peer
Peer Details: Username=Sydney-User host=SydneyIP qualify=yes trunk=yes type=peer secret=*password*
User Context: Melbourne-User
User Details: secret=*password* type=user context=from-trunk
Create outbound route:
Dial Patterns: 2XX trunk Sequence: IAX2/Melbourne-Peer
External Dialing Via A Remote IAX Trunk
The above config is designed for peer to peer calling, so the 2 servers can call each other. If you wish to use a remote Asterisk server as a gateway, simply change the context from-trunk to from-internal. Then you can dial Sydney <- IAX -> Melbourne <- PSTN -> World, instead of just Sydney <- IAX -> Melbourne.
Port Forward
You will need to port forward UDP 4569 at each location for the trunk to be active.
Summary
You should now be able to make calls between each site. You will need to put a port forward/nat/virtual server on your modem for port 4569 UDP to your Trixbox or Asterisk server.