Installing Asterisk 13 from source on Ubuntu 14

Ok, so before you read this guide, I have to urge you to consider ditching Asterisk in favor of using RingRoost. If you are a business or VoIP reseller there is nothing that Asterisk can do that RingRoost can’t (except break), contact us or schedule a demo to see what I mean.

Here is a guide on how to install Asterisk 13 on Ubuntu 14. It’s pretty easy/straight forward except one slightly tricky part – which is installing “PJSIP”, so make sure you read along carefully.

apt-get update

We will install Asterisk in “/usr/src”:

cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/certified-asterisk/certified-asterisk-13.1-current.tar.gz .
tar -zxvf certified-asterisk-13.1-current.tar.gz
cd cd certified-asterisk-13.1-cert2/

Install some dependencies:

apt-get install build-essential 
apt-get install libxml2-dev
apt-get install libncurses5-dev libreadline-dev libreadline6-dev
apt-get install libssl-dev
apt-get install uuid-dev
apt-get install libjansson-dev
apt-get install libsqlite3-dev
apt-get install pkg-config

At this point we need to select the SIP library we are going to use in Asterisk. SIP is basically VoIP protocol that we MUST have in asterisk. Version 13 of Asterisk is a little awkward because it can use either “PJSIP” (a 3rd party library) or it’s native built in SIP library. The Asterisk team is encouraging people to use “PJSIP” instead of the native SIP library, so in Asterisk 13 PJSIP is the default library, but on Ubuntu 14 PJSIP must be installed and compiled from source.

So we can do things the quick and easy way (use the old Asterisk SIP library) or the right way (install PJSIP). I will outline both approaches below. If you are new to this I would just do the quick/easy way and then maybe switch to PJSIP later.

1. Use native SIP library in asterisk (quick and easy way)

./configure
make menuselect

Under channel drivers –> select chan_sip (press enter then save by pressing back then “s”). Then continue to compile & install instructions.

2. Install PJSIP (the right way)

cd /usr/src/
wget http://www.pjsip.org/release/2.4/pjproject-2.4.tar.bz2
tar -xjvf pjproject-2.4.tar.bz2
cd pjproject-2.4
 ./configure --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr CFLAGS='-O2 -DNDEBUG'
make dep && make && make install 
ldconfig

Go back to your asterisk directory and “./configure” then continue to then continue to compile & install instructions.

cd ../certified-asterisk-13.1-cert2/
./configure

Compile and Install Asterisk

make
make install
makes samples 
make config

Crank asterisk up:

/etc/init.d/asterisk start

Then connect to Asterisk Cli:

asterisk -rvvvvvvvv

Congrats you have at this point successfully installed Asterisk, if your not sure where to go from here you could start by setting up an interactive voice response system on Asterisk which I show how to do step by step in this article: https://www.ringroost.com/ivr-setup-asterisk.php.

Here are some common errors & fixes when you are installing asterisk 13 on ubuntu 14.04.

Error Issue Fix
uuid support not found (this typically means the uuid development package is missing Missing Package apt-get install uuid-dev
JSON support not found (this typically means the libjansson development package is missing Missing Package apt-get install libjansson-dev
Please install the SQLite3 development package. Missing Pacakge apt-get install libsqlite3-dev
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?) Asterisk not running. /etc/init.d/asterisk start

Thanks to these articles for installing Asterisk:
https://wiki.asterisk.org/wiki/display/AST/Installing+Asterisk+From+Source
http://www.asterisk.org/downloads/source-code
http://blogs.digium.com/2012/11/14/how-to-install-asterisk-11-on-ubuntu-12-4-lts/
http://ethertubes.com/install-asterisk-1-8-from-source-on-ubuntu-11-10/
http://blogs.digium.com/2015/02/24/install-asterisk-13-pjsip-centos-6/
http://asterisk.consulting/tutorial-installing-asterisk-13-with-pjsip-on-debian-ubuntu/

And these articles for working out various bugs/issue I ran into.
http://www.cyberciti.biz/faq/linux-unix-bsd-extract-targz-file/
http://forums.asterisk.org/viewtopic.php?f=1&t=90407
http://askubuntu.com/questions/378558/unable-to-locate-package-while-trying-to-install-packages-by-apt
http://stackoverflow.com/questions/1089741/how-do-i-obtain-use-libuuid
http://askubuntu.com/questions/567740/configure-warning-please-install-the-sqlite3-development-package
http://stackoverflow.com/questions/2800924/asterisk-unable-to-connect-to-remote-asterisk-does-var-run-asterisk-ctl-exis
https://wiki.asterisk.org/wiki/display/AST/Building+and+Installing+pjproject
https://wiki.asterisk.org/wiki/display/AST/Migrating+from+chan_sip+to+res_pjsip
https://wiki.asterisk.org/wiki/display/AST/Setting+up+PJSIP+Realtime
http://blog.gmane.org/gmane.comp.voip.pjsip/page=59
https://trac.pjsip.org/repos/wiki/Python_SIP/Build_Install
http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2013-December/016912.html

4 thoughts on “Installing Asterisk 13 from source on Ubuntu 14”

  1. When I do the make command I get an error saying


    make[1]: *** [chan_iax2.so] Error 1
    Makefile:386: recipe for target ‘channels’ failed
    make: *** [channels] Error 2

Leave a Reply to Ibrahima YAYA Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Stay connected with ringroost