Configuring Outbound IAX Connections

While an IAX user receives inbound calls; an IAX peer is used to place outbound calls. This section will set up iax.conf and extensions.conf so that you can place calls.

iax.conf Configuration

The following entry in iax.conf can be used to place a call on the FWD network:

    [iaxfwd]
    type=peer
    host=iax2.fwdnet.net
    username=<fwd-account-number>
    secret=<fwd-account-password>
    qualify=yes
    disallow=all
    allow=ulaw
    allow=gsm
    allow=ilbc
    allow=g726

A peer is defined with type=peer. Use host to configure the server through which you will place calls (iax2.fwdnet.net). Your FWD account number and password will be used for authentication to the FWD network and are defined respectively with username and secret.

You can use the qualify=yes statement to occasionally check that the remote server is responding. The response time (latency) can be viewed from the Asterisk console with iax2 show peers. By default, a peer is considered unreachable after 2000 ms (2 seconds). You can customize the time period by replacing yes with the number of milliseconds.

The available codecs and the order of preference can be defined on a per-peer basis. disallow=all is used to reset any codec settings set previously. You can then allow the codecs you support and set their preference (from top to bottom), using the syntax allow= codec.

Use the iax2 show registry command from the Asterisk CLI to verify that you’ve registered successfully.

Dialplan Configuration

Let’s define a section in extensions.conf so that we can place a call to the FWD echo test application. As in previous configurations, we will create a context, followed by the instructions to connect to the FWD echo test. Use either your telephone attached to the FXS port or your SIP phone to place the call by dialing 613.

    [internal]
    exten => 613,1,Dial(IAX2/iaxfwd/613)

Get Asterisk: The Future of Telephony now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.