Asterisk is an Open Source software PBX (Private Branch Exchange), developed by Mark Specer of Digium. 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 others. Having built-in features like voicemail, conferencing, IVR, queuing etc.
In this article, we are going to see a basic installation and working of Asterisk 11 in RHEL 6.4/6.3/6.2/6.1/6.0, CentOS 6.4/6.3/6.2/6.1/6.0, Fedora 18,17,16, Ubuntu 12.10/12.04/11.10, Linux Mint 14/13 and Debian Linux Operating Systems.
1. Preparation for Installation
First, you 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 installing Asterisk on your system.
# 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
2. 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 http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz # wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz # wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz
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
3. 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.
# cd /usr/src/dahdi-linux-complete-2.6.2+2.6.2/ # make && make install && make config
# cd /usr/src/libpri-1.4.14/ # make && make install
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.
- /etc/asterisk/ – configuration files.
- /var/lib/asterisk/ – contains images, firmware, keys, sounds sample files.
- /usr/lib/asterisk/modules/ – contains all loadable modules.
4. 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
5. 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 <firstname.lastname@example.org> 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) tecmint*CLI>
6. 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.
tecmint*CLI> ! 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
7. Useful Commands from Asterisk CLI
- restart gracefully – Restart Asterisk gracefully.
- restart now – Restart immediately.
- restart when convenient – Restart Asterisk when call is empty.
- reload – Configuration reload.
- stop gracefully – Gracefully Asterisk shutdown.
- stop now – Shutdown immediately.
- stop when convenient – Shutdown Asterisk when call is empty.
8. Command Line Parameters
Following are the available command line parameters of Asterisk.
-h : Help. Run '/sbin/asterisk -h' to get a list of the available command line parameters. -C <configfile>: Starts Asterisk with a different configuration file than the default /etc/asterisk/asterisk.conf. -f : Foreground. Starts Asterisk but does not fork as a background daemon. -c : Enables console mode. Starts Asterisk in the foreground (implies -f), with a console command line interface (CLI) that can be used to issue commands and view the state of the system. -r : Remote console. Starts a CLI console which connects to an instance of Asterisk already running on this machine as a background daemon. -R : Remote console. Starts a CLI console which connects to an instance of Asterisk already running on this machine as a background daemon and attempts to reconnect if disconnected. -t : Record soundfiles in /var/tmp and move them where they belong after they are done. -T : Display the time in "Mmm dd hh:mm:ss" format for each line of output to the CLI. -n : Disable console colorization (for use with -c or -r) -i: Prompt for cryptographic initialization passcodes at startup. -p : Run as pseudo-realtime thread. Run with a real-time priority. (Whatever that means.) -q : Quiet mode (supress output) -v : Increase verbosity (multiple v's = more verbose) -V : Display version number and exit. -d : Enable extra debugging across all modules. -g : Makes Asterisk dump core in the case of a segmentation violation. -G <group> : Run as a group other than the caller. -U <user> : Run as a user other than the caller -x <cmd> : Execute command <cmd> (only valid with -r)
9. Reference Link
Latest posts by Ravi Saive (see all)
Linux Services & Free WordPress Setup
Our post is simply ‘DIY’ aka ‘Do It Yourself, still you may find difficulties and want us to help you out. We offer wide range of Linux and Web Hosting Solutions at fair minimum rates. Please submit your orders by Clicking Here.