Connecting to an IAX Service Provider

Some Internet Telephony Service Providers (ITSPs) provide the ability to originate and terminate calls via the IAX2 protocol. Beyond minimizing the number of ports required to be open on the firewall (IAX2 only requires a single port for both signaling and media), the protocol’s trunking feature is attractive to both ITSPs and their customers due to the savings in bandwidth that can be obtained when running many simultaneous calls between endpoints.

If your ITSP is offering IAX2 termination, there is a strong chance it is running Asterisk; thus the configuration for connecting to these service providers is more than likely going to be similar to what we are providing here.

The following configuration is a template for connecting to an IAX2 service provider:

[general]
autokill=yes

register => username:password@my.service-provider.tld

[my_unique_id]
type=user
secret=my_unique_password
context=incoming_calls
trunking=yes
disallow=all
allow=gsm
allow=ulaw
deny=0.0.0.0/0.0.0.0
permit=10.251.100.1/255.255.255.255

[my_unique_id]
type=peer
host=10.251.100.1
trunking=yes
disallow=all
allow=gsm
allow=ulaw

To accept incoming calls from the Direct Inward Dialing (DID) number that your service provider assigned to you, we need to modify our extensions.conf file. Perhaps you want to send the call to an auto-attendant, or maybe simply to your desk phone. In either case, you can accept calls from your service provider and match on the incoming DID with the following bit of dialplan logic:

[globals]

[general]
autofallthrough=yes

[default]

[incoming_calls]
exten => 14165551212,1,NoOp()
exten => 14165551212,n,Dial(SIP/1000,30)
exten => 14165551212,n,Playback(the-party-you-are-calling&is-curntly-unavail)
exten => 14165551212,n,Hangup()

exten => 4165551212,1,Goto(1${EXTEN})

[internal]

[phones]
include => internal