IAX

The Inter-Asterisk eXchange ( IAX ) protocol is an IP-based media transport protocol. To create a conversation between to people via IP you use IAX with as the method of transporting the audio. To create an IAX channel you need to set up the IAX communications in your iax.conf file.

Note

IAX is pronounced "eeks" by the Asterisk developer community, although no one minds if you say "AYE-AY-EX".

General Settings

First we need to set up our IAX globally used settings:

		[general]
		port=4569	       	; What port to bind to (4569 is the default for IAX2)
		bindaddr=0.0.0.0	; Which IP address on your server to bind to (if 
							; you have multiple NICs on your sever, you can 
							; restrict IAX2 to only one of them. 0.0.0.0 will
							; allow it to work on all NICs in your system.
		deny=all            ; You want to disallow the use of all audio 
							; codecs to ensure that
							; your system won't tell the far end that it can
							; support just any codec. Then, you specifically ALLOW
							; the codecs that your system supports.
		allow=ulaw			; The North American standard companding for G.711
		allow=alaw			; The rest of the world's companding standard for G.711
		allow=gsm			; A compressed codec, popular with Asterisk
		

The example above is very minimal and only sets up the basic settings to listen for connections and create them. The same way that Apache listens for http requests on port 80, Asterisk will listen for IAX requests on port 4569.

Defining IAX Channels

Now that we've defined the global parameters for our IAX interface to the outside world, we can create our IAX channels. IAX channels are very flexible, and are successfully used to connect to many kinds of endpoints. Digium makes an IAX-based device nicknamed the IAXy, which provides an FXS interface to support an analog telephone at the end of an IAX channel. IAX is also (naturally) the protocol used by the IAXTel network, which is what our examples will be connecting you to.

Although IAX is not an RFC standard protocol, it is enormously well respected. Many pundits predict that IAX will supplant SIP.

Note

Before creating this file you will probably want to get an IAXTel account set up.

        [general]
        port=4569              ; What port to use
        bindaddr=0.0.0.0    ; What IP address to bind to
        allow=all              ; Allow the use of all audio codecs
		register => username:secret@iaxtel.com  ;replace username:secret with your credentials, i.e. bugsbunny:c4rr0ts@iaxtel.com

		[iaxtel-out]
		type=peer				; Allow connections out
		username=username			; TYour IAXTel username
		secret=password				; Your secret password
		deny=0.0.0.0/0.0.0.0			; Not just anyone can be IAXTel
		permit=216.207.245.47/255.255.255.255	; This is a server at IAXTel
		permit=69.73.19.178			; This is a server at IAXTel

		[iaxtel-in]
		type=user				; Allow connections to come in
		context=default				; Route calls to this context
		                                        ; in the dialplan
		username=username			; The IAXTel username
		secret=password				; The secret password
		deny=0.0.0.0/0.0.0.0			; Not just anyone can be IAXTel
		permit=216.207.245.47/255.255.255.255	; This is a server at IAXTel
		permit=69.73.19.178			; This is a server at IAXTel
		

In the example above you will notice that we have 2 entries to communicate with the IAXTel service. IAXTel is a free VoIP calling service and is used as a testbed for Asterisk and IAX as well, as a common communication system.

The first change you will notice actually comes in the general section. It is a line to tell IAXTel that we are here and that calls to that IAX user should be routed to your asterisk server. It's like connecting to your IM (AOL Instant Messenger, Yahoo, MSN, etc) so that when other people send you a message you get it wherever you are logged in.

We have 2 different kinds of connections to IAXTel, the peer and the user. This allows us to decide that inbound calls can come from one server and outbound calls could come from another. This is extremely useful when you are handling a major network of Asterisk servers and are using IAX for trunking the servers together.