Analog Phones

There are two popular methods for connecting analog phones to Asterisk. The first is by using an ATA that most commonly connects to Asterisk using the SIP protocol. The Asterisk configuration for an ATA is the same as it would be for any other SIP-based handset. The other method is to directly connect the phones to the Asterisk server using telephony hardware from a vendor such as Digium. Digium sells telephony cards that can be added to your server to provide FXS ports for connecting analog phones (or fax machines). For the purposes of demonstrating the configuration, we’re going to show the configuration required if you had a Digium AEX440E card, which is an AEX410 half-length PCI-Express with four FXS modules and hardware-based echo cancellation.


Regardless of which hardware you are using, consult your vendor’s documentation for any hardware-specific configuration requirements.

First, ensure that both Asterisk and DAHDI are installed (refer back to the section called “How to Install It” for instructions). Note that DAHDI must be installed before you install Asterisk. When you install DAHDI, be sure to install the init script as well. This will ensure that your hardware is properly initialized when the system boots up. The init script is installed from the DAHDI-tools package.

The init script uses the /etc/dahdi/modules file to determine which modules should be loaded to support the hardware in the system. The installation of the init script attempts to automatically set up this file for you, but you should check it to make sure it is correct:

# Autogenerated by tools/xpp/dahdi_genconf (Dahdi::Config::Gen::Modules) on 
# Tue Jul 27 10:31:46 2010
# If you edit this file and execute tools/xpp/dahdi_genconf again,
# your manual changes will be LOST.

There is one more configuration file required for DAHDI: /etc/dahdi/system.conf. It looks like this:

# Specify that we would like DAHDI to generate tones that are
# used in the United States.
loadzone = us
defaultzone = us

# We have 4 FXS ports; configure them to use FXO signaling.
fxoks = 1-4


This configuration assumes the card is being used in the United States. For some tips on internationalization, see Chapter 9, Internationalization.

If the card you are configuring does not have hardware-based echo cancellation, another line will need to be added to /etc/dahdi/system.conf to enable software-based echo cancellation:

echocanceller = mg2,1-4


MG2 is the recommended echo canceller that comes with the official DAHDI package. There is another open source echo canceller out there that is compatible with DAHDI, called OSLEC (Open Source Line Echo Canceller). Many people report very good results with the use of OSLEC. For more information about the installation of OSLEC on your system, see the website at

Now, use the init script to load the proper modules and initialize the hardware:

$ sudo /etc/init.d/dahdi start
Loading DAHDI hardware modules:
  wctdm24xxp:                                              [  OK  ]

Running dahdi_cfg:                                         [  OK  ]

Now that DAHDI has been configured, it is time to move on to the relevant configuration of Asterisk. Once Asterisk is installed, ensure that the chan_dahdi module has been installed. If it is not loaded in Asterisk, check to see if it exists in /usr/lib/asterisk/modules/. If it is there, edit /etc/asterisk/modules.conf to load If the module is not present on disk, DAHDI was not installed before installing Asterisk; go back and install it now (see the section called “DAHDI” for details). You can verify its presence using the following command:

*CLI> module show like
Module                         Description                              Use Count                  DAHDI Telephony Driver                   0         
1 modules loaded

Next, you must configure /etc/asterisk/chan_dahdi.conf. This is the configuration file for the chan_dahdi module, which is the interface between Asterisk and DAHDI. It should look like this:


; No trunk groups are needed in this configuration.


; The channels context is used when defining channels using the
; older deprecated method.  Don't use this as a section name.

; A template to hold common options for all phones.
usecallerid = yes
hidecallerid = no
callwaiting = no
threewaycalling = yes
transfer = yes
echocancel = yes
echotraining = yes
immediate = no
context = LocalSets
signalling = fxo_ks ; Uses FXO signaling for an FXS channel 

callerid = "Mark Michelson" <(256)555-1212>
dahdichan = 1

callerid = "David Vossel" <(256)555-2121>
dahdichan = 2

callerid = "Jason Parker" <(256)555-3434>
dahdichan = 3

callerid = "Matthew Nicholson" <(256)555-4343>
dahdichan = 4

You can verify that Asterisk has loaded your configuration by running the dahdi show channels CLI command:

*CLI> dahdi show channels
   Chan Extension  Context         Language   MOH Interpret    Blocked    State     
 pseudo            default                    default                     In Service
      1            LocalSets                  default                     In Service
      2            LocalSets                  default                     In Service
      3            LocalSets                  default                     In Service
      4            LocalSets                  default                     In Service

For detailed information on a specific channel, you can run dahdi show channel 1.