O'Reilly logo

Asterisk: The Future of Telephony by Leif Madsen, Jared Smith, Jim Van Meggelen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring Inbound IAX Connections

The Inter-Asterisk eXchange (IAX) protocol is usually used for server-to-server communication; more hard phones are available that talk SIP. However, there are several soft phones that support the IAX protocol, and work is progressing on several fronts for hard phone support in firmware. The primary difference between the IAX and SIP protocols is the way media (your voice) is passed between endpoints.

With SIP, the RTP (media) traffic is passed using different ports than those used by the signaling methods. For example, Asterisk receives the signaling of SIP on port 5060 and the RTP (media) traffic on ports 10,000 through 20,000, by default. The IAX protocol differs in that both the signaling and media traffic are passed via a single port: 4569. An advantage to this approach is that the IAX protocol tends to be better suited to topologies involving NAT.

An IAX user is used to authenticate and handle calls coming into the PBX system. For calls going out from the PBX, Asterisk uses an IAX peer entry in the iax.conf file to authenticate with the remote end. (IAX peers will be explored in the section "Configuring Outbound IAX Connections.”)

This section explores the configuration of your system for a Free World Dialup (FWD) account via IAX. Free World Dialup is a free VoIP service provider that allows you to connect to any other member of the network, regardless of physical location, for free. FWD is also connected to over 100 other networks to which you can connect for free.

Tip

Be sure to enable IAX2 support for your FWD account before you get started by visiting http://www.fwdnet.net/index.php?section_id=112.

This section sets up iax.conf and extensions.conf to allow you to accept calls from another FWD user. The section on outgoing IAX connections deals with placing calls.

iax.conf Configuration

In iax.conf, sections are defined with a name enclosed in square brackets ([]). Every iax.conf file needs at least one main section: [general]. Within the [general] section, you define the settings related to the use of the IAX protocol, such as default codecs and jitter buffering. You can override the default codecs you specify in the [general] section by specifying them within the user or peer definitions.

The following [general] section is the default from the iax.conf.sample configuration file (the same file that’s installed when you perform a make samples). For more information about the options, see Appendix A.

    [general]
    bandwidth=low
    disallow=lpc10
    jitterbuffer=no
    forcejitterbuffer=no
    tos=lowdelay
    autokill=yes

    register => fwd_number:password@iax2.fwdnet.net

    [iaxfwd]
    type=user
    context=incoming
    auth=rsa
    inkeys=freeworlddialup

Within the [general] section, you’ll need to add a register statement. The purpose of the register statement is to tell the FWD IAX server where you are on the Internet (your IP address). When a call is placed to your FWD number, the FWD servers do a lookup in their database and forward the call to the IP address associated with the FWD number.

In the [iaxfwd] section, define the user for incoming calls with type=user. Then define where the incoming call will be handled within the dialplan , with context=incoming. To specify that the authentication for the incoming call will be done with an RSA public/private key pair, use auth=rsa. The public key is defined with inkeys=freeworlddialup. The freeworlddialup public key comes standard with Asterisk.

Dialplan Configuration

Handling an incoming call in the extensions.conf file is simple. First, create a context called incoming (the same context name configured for the iaxfwd user in iax.conf). The context is followed by a Dial() statement that will dial the SIP extension created earlier in this chapter. Replace the number 10001 with that of your FWD account:

    [incoming]
    exten => 10001,1,Dial(SIP/john)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required