Asterisk installation

De Ensiwiki
Aller à : navigation, rechercher
VoIP deployment
"Projet de Spécialité 2010" Deployment of VoIP platform
Team Ouakkadi Mohamed Yassine, Rafiq Oualid, Legras-Lecarpentier Matthieu,Piton Benjamin, Torre Luc-Alexandre
Professors Franck Rousseau
Alphand Olivier
LIG laboratory, Drakkar group
Location Grenoble INP Ensimag
Date June 2010

About Asterisk

Asterisk: The Professional’s PBX

Never in the history of telecommunications has a system so suited to the needs of business been available, at any price. Asterisk is an enabling technology and, as with Linux, it will become increasingly rare to find an enterprise that is not running some version of Asterisk, in some capacity, somewhere in the network, solving a problem as only Asterisk can.

This acceptance is likely to happen much faster than it did with Linux, though, for several reasons:

• Linux has already blazed the trail that led to open source acceptance. Asterisk is following that lead.

• The telecom industry is crippled, with no leadership being provided by the giant industry players. Asterisk has a compelling, realistic, and exciting vision.

• End users are fed up with incompatible, limited functionality, and horrible support. Asterisk solves the first two problems; entrepreneurs and the community are addressing the latter.

The Asterisk Community

One of the compelling strengths of Asterisk is the passionate community that developed and supports it. This community, led by Mark Spencer of Digium, is keenly aware of the cultural significance of Asterisk, and is giddy about the future.

One of the more powerful side effects caused by the energy of the Asterisk community is the cooperation it has spawned among the telecommunications professionals, networking professionals, and information technology professionals who share a love for this phenomenon. While these professions have traditionally been at odds with each other, in the Asterisk community they delight in each others’ skills. The significance of this cooperation cannot be underestimated.

Still, if the dream of Asterisk is to be realized, the community must grow—yet one of the key challenges that the community currently faces is a rapid influx of new users. The members of the existing community, having birthed this thing called Asterisk, are generally welcoming of new users, but they’ve grown impatient with being asked the kinds of questions whose answers can often be obtained independently, if one is willing to put forth the time needed to research and experiment.

Obviously, new users do not fit any particular kind of mold. While some will happily spend hours experimenting and reading various blogs describing the trials and tribulations of others, many people who have become enthusiastic about this technology are completely uninterested in such pursuits. They want a simple, straightforward, step-by- step guide that’ll get them up and running, followed by some sensible examples describing the best methods of implementing common functionality (such as voicemail, auto attendants, and the like).

To the members of the expert community, who (correctly) perceive that Asterisk is like a web development language, this approach doesn’t make any sense. To them, it’s clear that you have to immerse yourself in Asterisk to appreciate its subtleties. Would one ask for a step-by-step guide to programming and expect to learn from it all that a language has to offer?

Clearly, there’s no one approach that’s right for everyone. Asterisk is a different animal altogether, and it requires a totally different mind-set. As you explore the community, though, be aware that there are people with many different skill sets and attitudes here. Some of these folks do not display much patience with new users, but that’s often due to their passion for the subject, not because they don’t welcome your participation.

Material and softwares needed for a VOIP environment

It's a computer or a server that shelter the Asterisk software and the material(OS, memory, VoIP card,...). Asterisk functions on most Linux distributions and Windows.
IP Terminal
IP Phones or Softphones that use, in most cases, SIP protocol and which are compatible with Asterisk.
Routers and switchs
Permit to route the voice on data networks and eventually segment LANs in several VLANs to create different collision domains.
Communication cards 
Create an interface that permit passing from IP networks to Public Switched Telephone Network (PSTN). In our case,, we don't have to use them because our platform will be implemented in an Intranet.
The autocom open source software that will be used

Asterisk installation


The needed packages are the following:

  • Ubuntu linux distribution Version 9.04
  • Asterisk-
  • Asterisk Add-Ons-
  • DAHDI Complete-
  • Softphones and/or IP Phones
AttentionBefore beginning Asterisk installation, you must verify that the following libraries are already installed on your system :libstdc++,libxml2,cpp,php5

How to install Asterisk?

Here are the steps for installing the Asterisk PBX:

1- To satisfy asterisk dependencies, you must type this command

 - apt-get install linux-headers-$(uname -r) bison openssl libssl-dev libeditline0 libeditline-dev libedit-dev gcc make
 g++ mc php5-cli

2- Downloading and extracting Asterisk modules

  • To make the task easier,it's better to create a folder for packages you’ll download
 - mkdir /usr/src/asterisk
 - cd /usr/src/asterisk
  • Then type the following commands to download the packages
 - wget
 - wget
 - wget
  • Extract the downloaded packages with
 - tar zxvf asterisk-
 - tar zxvf asterisk-addons-
 - tar zxvf dahdi-linux-complete-

3- Compiling and installing DAHDI module for timing (new name of ZAPTEL code)

This module contains DAHDI Linux which is the device driver framework used by multiple hardware vendors to interface applications (including Asterisk) with telephony hardware plus DAHDI Tools which is a package of utilities for managing and monitoring DAHDI devices. In our case, we'll need to activate Dahdi_Dummy only to be able to configure conference option which need a timer

 - cd dahdi-linux-complete-
 - LIBS=-lldap (for supporting LDAP as an external database for Asterisk)
 - export LIBS
 - make all
 - make install
 - make config
 - Modprobe dahdi_dummy (necessary to use Music on hold and conference option)

4- Compiling and installing Asterisk PBX

 - cd /usr/src/asterisk/asterisk-
 - LIBS=-lldap
 - export LIBS
 - ./configure
 - make menuselect
    By default, Asterisk includes a set of GSM-encoded speech prompts in US English. Additional speech prompts in various 
    encoding formats and languages are available. The additional sounds can be found in the "Core Sound Packages", "Music
    On Hold File Packages", and "Extras Sound Packages" sections in menuselect.
 - make
 - make install
 - make samples
 - make config

5- Compiling and installing Asterisk Add-Ons

This package include a number of additional drivers and utilities including support for mp3 playback, MySQL real-time and CDR support, chan_mobile, and an alternative H.323 driver (chan_ooh323).

 - cd /usr/src/asterisk/asterisk-addons-
 - ./configure
 - make
 - make install
 - make samples

All installation steps are finished now, you must reboot your system and verify that all modules are OK by typing the following commands:

 - asterisk –r

and you should get :


This is free software, with components licensed under the GNU General Public

License version 2 and other licenses; you are welcome to redistribute it under

certain conditions. Type 'core show license' for details.


Connected to Asterisk currently running on asterisk (pid = 2022)


To exit CLI, type exit or core stop gracefully

To see if DAHDI is ok... run this command:

 - lsmod|more

and you should get :





Dialplan conception and Asterisk configuration


It indicates to the system how to behave when there is an incoming, retiring or internal call. This plan is defined in extensions file (/etc/asterisk/extensions.conf); and to accomplish its task, it must use the SIP file that contains SIP terminal list of the system. Those two files are the most important for establishing a basic VoIP platform. In our experimentation, we'll use some other files, eventually : voicemail.conf,meetme.conf (for conference option), res_ldap.conf and extconfig.conf (for coupling with LDAP Database)

sip.conf file

This file contains several sections, essentially [general] section that indicate the commun between all SIP clients and as many sections as the number of SIP clients we have. In fact, we can define many sections depending on clients' profils and the procedure we like to apply for each profil.

  • Example: (p.110 VoIp et ToIP Askterisk La téléphonie sur IP (Conception....))


Default context of SIP clients. It can be changed but don't forget to use the same name in extentions file.
and in this case, if it's commun for all clients, you can put it in this section, otherwise, you must specify the
for each client in his own section
If your calls will need a DNS translation, you must set srvlookup option
Specify the port number the client will use for his calls
Setting this option to all will desactivate all codecs; this operation is very usefull in case we want to specify
the codecs.
Activating GSM,G711 codecs for the two coding laws 
A and u
Setting the language to french. By default, the language is US
Other sections
Extension name, it's a string, so it can contains numbers, letters and _


The username that will be attributed to the client
This option indicate the permissions allowed to the client; it can be one of the following values 
  • user client can receive calls only
  • peer client can emit calls only
  • friend client can receive and emit calls
Permit to verify if a client is de verifier qu'un client est reachable setting this option to "yes" indicate that the server will do a check every 2 secondes
Authentication password of the client
Set this option to "yes" if you use NAT in your network, otherwise, keep it equal to "no"
It can contain either the "hostname", its "IP address" or "dynamic". This last value indicates that the

client can connect from any IP address

Client can't do a SIP-reinvite request and the PSTN flow is routed by Asterisk server
Encryption mode
Standard used for composing numbers
The caller identifier and his extention (phone number)
Voicemail number of the client in a specific context(default); this context must be defined in Voicemail.conf file
Client context



extensions.conf file

This file contains different contexts. the hierarchical order is the same that the one used in sip.conf file

    A specific context defined at the beginning of the file and contains the commun informations for the whole dial plan
    Permit to define the global varibales 



  To save the dialplan directly from CLI
  To conserve global variables
  To respect the priority (order) of instructions



Each context defines a specific procedure for a specific extention (phone numbers for example). The operations done in a context are totally independant from those of an other context.



    exten => 2409, 1, Answer()
    exten => 2409, 2, Dial (${DIRECTEUR})
  • Extensions : every context contains one or several extentions and instructions; The syntax is as the following:
    exten => call number(extension), priority, application()
  • Special extensions:
    • s : used when unknown call arrives
    • i : used when the user type/compose an invalid number after demanding it to him.
    • t : used to manage temporization. Its default value is 10 secondes.
  • Applications:
    • Answer()  : the first application in most cases
    • Playback(file)  : it plays a sound for the interlocutor
    • Hangup()  : free a channel cleanly
    • Echo()  : it emits an echo for the interlocutir. To exit this mode, the user must push #
    • Background(file) : the same as playback().
    • Goto()  : permit to jump to a specific extension, priority or a context.
    • Dial()  : it makes the extension passed in parameter sound.
    • Congestion()  : it signals that a channel is cluttered until hanging up. It doesn't diffuse a tonality, therfore we can use Playtones(Congestion)
    • Voicemail()  : it calls the voicemail of the client
    • Set()  : it affects a value to a variable
    • Exec  : execute an application
    • MusicOnHold()  : it plays a music to indicate the waiting status. Its parameters can be found and configured in : /etc/asterisk/musiconhold.conf.
    • Playtones()  : it plays a specific sounds defined in /etc/asterisk/indications.conf
    • Transfer()  : it transfers a call towards a new extension.



    exten => 1000,1,answer()
    exten => 1000,n,Dial(${Directeur},20,Ttr)
    exten => 1000,n,VoiceMail(1000@default)
    exten => 1000,n,Hangup()

meetme.conf file

Asterisk allow configuring rooms for conference option. To create a new conference room, you just have to define a new number for this room with an administrator password (this one is not not necessary) (conf => 900) and then add an extension corresponding to it in extentions.conf; The syntax must respect the following syntax : exten => extension,priority,meet(room number, options,password)

These are meetme() options:

    • - i : announces the presence of a new client in the conference
    • - c : announces the number of clients in the conference
    • - p : users can quit the conference by pushing #
    • - m : listenning mode
    • - t : speech mode
    • - d : permit to add a dynamic conference
    • - a : to enter in admin mode


  • meetme.conf
  conf => 900
  • extensions.conf
  exten => 999,1,answer()
  exten => 999,2,MeetMe(900,dpm,9000)

voicemail.conf file

In order to define a voicemail for our clients, you must edit voicemail.conf file and add a voicemail number for them. The following syntax must be respected : voicemail number => password,user name,email,pager,options

These are some of options that can be used for voicemail:

    • - attach : if set to yes, it permits to attach the vocal message to the email
    • - serveremail : email address of the server that will send the message
    • - saycid : if set to yes, it displays the caller ID
    • - enveloppe : if set to yes, the hour and the date will be read
    • - delete : if set to yes, the vocal message will be deleted on the server


   2000 => 200,james,,,attach=yes|saycid=no|review=yes|envelope=yes|delete=no

Asterisk Clients configuration


There is a lot of clients that are compatible with Asterisk and SIP protocol, eventually : X-Lite, Ekiga, SJPhone,... In our expermientation, we choose X-Lite which can be downloaded from the official website of counterpath : /

This softphone is very easy to configure; Here are the steps :

  • on the top (left button), clic on and enter to SIP Account Settings
  • a new window is displayd ; clic on add
  • Display name : put the display name you want
  • User name : enter the same username you configure in sip.conf
  • Password : enter the password which goes with this username
  • Authorization user name : re-enter the same username you entered before
  • Domain : enter the IP address of Asterisk Server
  • Proxy : enter the IP address of Asterisk Server

clic on OK

Here is an example:


IP Phones

We had used THOMSON ST-2020 IP Phones for implementing our platform. They are the easier network equipement to configure and can be bought with a reasonable price.

Here are the steps of configuration:

  • clic on Menu button
  • push the button under the word config
  • select Acct menu and enter your username and your password
  • select User menu and then enter your username in user section and your password in pswd section
  • then enter to Admin menu by entering admin password (by default : 457818)
  • in section Network select set a static IP address or enable DHCP if you use it
  • in section SIP, enter the IP address of Asterisk in Proxy and ObSrv(outbound server) and then re-enter your username in user and a display name in Name
  • return to the main menu by pushing C button
  • push Boot and select yes to save current configuration and reboot the phone


[4] x-lite.html
Sébastien DEON, VoIP et ToIP Asterisk : la téléphonie sur IP (conception,installation, configuration, déploiement); édition ENI.

Home page

VoIP & mobile IPv6 Speciality Project