How to Install Asterisk 11 and Dhadi on RHEL, CentOS, Fedora or Ubuntu Linux

Asterisk is an Open Source PBX software comes with built-in features like voicemail, conferencing, IVR, queuing etc. It allows you to make calls to one another which may have connected to other PSTN (Public Switched Telephone Network) and Voice over Internet Protocol (VoIP). Asterisk runs on Linux, BSD, MacOSX and other compatible operating systems.

In this guide, we'll walk you through steps to install and configure basic Asterisk 11 on RHEL 6.4 or earlier, CentOS 6.4 or earlier, Fedora 18,17,16, Ubuntu 12.10 or earlier, Linux Mint 14/13 and Debian Linux.


Preparation for Installation

First, make sure that your system is up-to-date, if not try to update the system and then install dependencies packages using “yum command” and “apt-get command“, before proceeding installation of Asterisk on your system.


On RHEL/CentOS/Fedora

# yum -y update
# yum install -y make wget openssl-devel ncurses-devel newt-devel libxml2-devel kernel-devel gcc gcc-c++ sqlite-devel

Turn Off SELinux by changing the line “enforcing” to “disabled” in /etc/selinux/config file.
Once you disabled SELinux, you need to reboot the system.


On Ubuntu / Linux Mint / Debian

# su root
# apt-get update && apt-get upgrade -y && reboot
# apt-get install build-essential wget libssl-dev libncurses5-dev libnewt-dev  libxml2-dev linux-headers-$(uname -r) libsqlite3-dev


Downloading DAHDI, LibPRI and Asterisk Tarballs

Download the source tarballs, these following commands will download current release of DAHDI 2.6, LibPRI 1.4 and Asterisk 11.

# cd /usr/src/
# wget
# wget
# wget

Next, extract the files from source tarballs using “tar command” as shown below.

# tar zxvf dahdi-linux-complete-current.tar.gz
# tar zxvf libpri-1.4-current.tar.gz
# tar zxvf asterisk-11-current.tar.gz


Configuring, Compiling And Installing

Go to the each directory from where you have downloaded and extracted the packages and start running the following commands to install DAHDI, LibPRI and Asterisk.

Installing DAHDI.
# cd /usr/src/dahdi-linux-complete-2.6.2+2.6.2/
# make && make install && make config

Installing LibPRI

# cd /usr/src/libpri-1.4.14/
# make && make install

Installing Asterisk

Next, run the “configure” script will vary depending upon whether your system is 32-bit or 64-bit. In the middle, when “menuselect” command executes, select your desired options and then hit “Save and Exit” option and the installation will continuous.

Run this command if you’re installing Asterisk on a 32-bit OS.
# cd /usr/src/asterisk-11.3.0/
# ./configure && make menuselect && make && make install && make samples && make config

Run this command if you’re installing Asterisk on a 64-bit OS.
# cd /usr/src/asterisk-11.3.0/
# ./configure --libdir=/usr/lib64 && make menuselect && make && make install && make samples && make config


Following are the some Asterisk configuration files and their locations.
  1. /etc/asterisk/ – configuration files.
  2. /var/lib/asterisk/ – contains images, firmware, keys, sounds sample files.
  3. /usr/lib/asterisk/modules/ – contains all loadable modules.


Starting DAHDI and Asterisk Services

Enable the DAHDI and Asterisk services at system boot time.
# chkconfig dahdi on
# chkconfig asterisk on

Start the DAHDI and Asterisk.
# service dahdi start
# service asterisk start


Connecting to Asterisk CLI

Run the following command to connect to the Asterisk CLI.
# asterisk -rvvvvv
Asterisk 11.3.0, Copyright (C) 1999 - 2012 Digium, Inc. and others.
Created by Mark Spencer <>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
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 11.3.0 currently running on tecmint (pid = 1820)


Asterisk Console Commands

It’s similar to IOS. From Asterisk terminal anytime you can use ‘Tab key‘ or type ‘?‘ for help or command auto complete.

!              acl            ael            agent          agi            aoc           
calendar       cc
cdr            cel            channel        cli            confbridge     config        
console        core
data           database       devstate       dialplan       dnsmgr         dundi         
event          fax
features       file           group          hangup         help           http          
iax2           indication
local          logger         manager        mgcp           minivm         mixmonitor    
module         moh
no             originate      parkedcalls    phoneprov      presencestate  pri           
queue          realtime
reload         rtcp           rtp            say            sip            skinny        
stun           timing
udptl          ulimit         unistim        voicemail


Useful Commands from Asterisk CLI

  1. restart gracefully – Restart Asterisk gracefully.
  2. restart now – Restart immediately.
  3. restart when convenient – Restart Asterisk when call is empty.
  4. reload – Configuration reload.
  5. stop gracefully – Gracefully Asterisk shutdown.
  6. stop now – Shutdown immediately.
  7. stop when convenient – Shutdown Asterisk when call is empty.

You might be interested in setting up interactive voice response (IVR) for your environment

    No comments:

    Powered by Blogger.