1. Home
  2. Configure Asterisk and IAX2

Configure Asterisk and IAX2

So you can configure Asterisk and IAX2, YourCloudPBX natively supports the following IAX/IAX2 ‘Asterisk’ based IP-PBX implementations.

  • Asterisk 1.2/1.4/1.6, 1.8
  • Trixbox
  • FreePBX
  • Callweaver
  • Freeswitch etc.

General Comments

Registration only: For security reasons we restrict our IAX2 connectivity to Registration and therefore have not extended our support to Peering for IAX2. If you require the flexibility of Peering, you should consider changing to SIP Peering.

CLI: In order to preserve outgoing CLI we advise IAX2 admins to individually Register each DID as opposed to registering a primary trunk number.

TLS: YourCloudPBX supports TLS and TCP negating many of the previous technical advantages IAX had over over SIP.

How to configure IAX2 Registration

To customise your IAX2 Inbound context go to YourCloudPBX | Preferences | Voice Quality and Networking (specify your context for inbound calls)

Sample Configure

There’s no completely right or wrong way to configure your Asterisk server but the following provides a good template to start making calls through YourCloudPBX.

Using the example configuration below replace ‘yournumber’ with your actual YourCloudPBX number (e.g. 0289707504) and ‘yourpassword’ with your YourCloudPBX account password.

YourCloudPBX use the STD code+number format for usernames e.g. 0289707504 rather than the E164 version (61289707504) as some providers do sip.conf

; Register line should be somewhere inside your general section
register => yournumber:yourpassword@phone.yourcloudtelco.com.au/yournumber

context=default ; or your own selected context if desired
;allow=g729 ; only if you have licenses to use it
insecure=very ; use insecure=invite,port in later versions of Asterisk such as v1.4

;receive incoming calls to a connected phone
exten => s,1,Dial(SIP/yournumber)
; outbound calls (outside of your own PBX)
exten => _X.*,1,Dial(SIP/${EXTEN}@yourcloudtelco)[/vc_column_text][vc_separator][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]


In comparison to SIP, troubleshooting IAX2 is always problematic. If you do require assistance troubleshooting IAX calls, enabling IAX debugging output can be helpful.

  • Asterisk 1.4 or later, the CLI command ‘iax2 set debug on’ turns on debugging output.
  • Asterisk 1.2, use ‘iax2 debug’ to enable IAX debugging output, and ‘iax2 no debug’ to turn it back off again.
  • Send us the debug together with your Asterisks version.

IAX Context

IAX2 is different than SIP in that when you send a call to the other side you specify the ‘context’ you want the call to go to.

  • Outbound Calls: For calls to YourCloudPBX (from the customer) use the context ‘default’.
  • Inbound calls: For calls from YourCloudPBX to the customer we use the context ‘from-trunk’. This is historically how IAX2 was setup – the carrier side sends it ‘from-trunk’. It was also the default method used by FreePBX and other packaged Asterisk systems.
Updated on 6 October 2021