From TD-er's Wiki
Jump to navigationJump to search

IAX2 is the Inter-Asterisk eXchange protocol. This is used to transport the calls between Asterisk PBX stations.

Description of iax.conf

This file is used to configure clients connecting via the Inter-Asterisk eXchange protocol. IAX is primarily used for passing calls between Asterisk servers.

N.B. This is a selection from the information given in Asterisk Handbook (p. 61-67) Please read other options, when looking for security-options or options regarding unstable connections.


In the general section:

  • port: The port to listen on for incoming connections. The default is port 5036. Takes as it's argument a port number (which must not be in use by another service.)
  • bindaddr: If multiple IP addresses are available in the same system, this option may be set to bind Asterisk to a single interface.
port = 5036
bindaddr =
  • bandwidth: This option is used to control which codecs are used generally. Rather than allowing or disallowing specific codecs, this option may be set to 'low' to automatically avoid some codecs that don't work well in low bandwidth sitiuations. Takes an option of low or high.
  • allow: Specifically allow a certain codec to be used. Takes a codec, or all. Using all is the same as specifying bandwidth=high.
  • disallow: Specifically disallow a certain codec. See allow.
  • register: Register is used to tell the Asterisk server to register with another Asterisk server. This is normally only needed if our local server has a dynamic IP address and needs to tell the other server where to find it. The format of a register statement is:
register => username:secret@server

The 'secret' field is optional, if no secret has been specified on the server being connected to. If RSA encryption is in use, specify the key to send to the server with this format:

register => username:[key]@server
  • tos: Specify the type of service bits to set on IAX packets, which may improve routing of the packets. Available values are:
    • lowdelay: minimize delay
    • throughput: maximize throughput
    • reliability: maximize reliability
    • mincost: use the lowest cost path
    • none: use no routing flags
tos = lowdelay

Options for Entities

Entity definitions begin with the entity name in brackets. The name is followed by a number of keyword/value pairs applying to the entity in which they are set. The following keywords are available for users:

  • type: This sets the type of entity for the client. Valid types are:
    • user: A user can place calls to or through the Asterisk server.
    • peer: A peer receives calls from the Asterisk server, but does not place them
    • friend: A friend both sends and receives calls through the Asterisk server. This makes the most sense for handsets or other station devices. When in doubt use this type.
  • trunk: Enables or disables trunking for a given user or peer. Trunk mode is a more efficient method of operating IAX if there are typically many calls running on the link. Trunk mode requires having a Zaptel interface in the Asterisk server.

testing IAX2 trunking


Schematic overview of all PC's running which software.

Conference-Voice-call between 201, 202 (G711u-codec) and 301 (G711u codec) X-lite on ext. 301 was combining the conference.

  • Traffic to and from Ext. 201 is Green
  • Traffic to and from Ext. 202 is Pink
  • Traffic to and from Ext. 301 is Red
  • Traffic between Asterisk-boxes is Blue in one direction and black in the other

Used filters in I/O-graph:

Filter-Black: ip.src == && ip.dst ==
Filter-Red  : ip.src ==   && ip.dst ==
Filter-Green: ip.src == && ip.dst ==
Filter-Blue : ip.src == && ip.dst ==
Filter-Pink : ip.src == && ip.dst ==

Number of packets. Red was the SIP-phone combining the conference (Auto-Conference). All using G711u codec.

Wireshark-analysis of a Reinitiation IAX2-data-packet, telling the Asterisk PBX on the other side which codec is used and to which conversation it belongs. Taken from while only 1 channel was active.