Experimenting with Asterisk 13 and FreePBX 13


Do It Yourself an IPPBX, an experiment with Asterisk 13 and FreePBX 13 on CentOS 6.

This article is divided into three parts:

  • Part 1: Prepare The Server
  • Part 2: Install Asterisk 13
  • Part 3: Install FreePBX 13

The goal is to get the PC provides Private Branch eXchange services, a phone system, using Free and Open Source Software.

Part 1: Prepare The Server

Linux CentOS Minimal

Linux server installation:

  • You may use VirtualBox or any other virtualization software, or a real server
  • You need fast Internet connection, we will be downloading lots of stuffs
  • Install CentOS 6.7 minimal version, get the minimal version of CentOS 6.7 installer ISO here
  • Configure the network so that the server will have access to the Internet
  • Access the server using SSH, work from outside
  • You will need to login as root during installation

Please note that you can always use full version of CentOS, the same installation steps in this article will still work.

Suggestion on partition layout:

  • 4GB for /
  • 1GB for swap
  • the rest of available space for /var

Update CentOS:

yum update

Install basic system config tools:

yum install system-config-firewall system-config-firewall-tui system-config-network system-config-network-tui

Continue with rebooting the server:


Please note that you must reboot the server to load the new updated kernel.

Development Packages

Install development packages:

yum install wget perl subversion gcc gcc-c++ make kernel-devel ncurses-devel newt-devel mysql-devel openssl-devel zlib-devel libxml2-devel curl-devel speex-devel unixODBC-devel libtool-ltdl-devel sqlite-devel libuuid-devel

Please note that you need to make sure that above packages are installed properly, you can do that by running the above command again.

Web and Database Server

Install Web and Database Server

Install Apache2 web server and MySQL database server:

yum install httpd mysql-server mysql php php-mbstring php-mysql php-gd php-cli php-pear php-posix php-xml

Start them now:

/etc/init.d/httpd start
/etc/init.d/mysqld start

Set httpd and mysqld to run automatically on boot:

chkconfig httpd on
chkconfig mysqld on

Configure Web Server

Add Linux user for Asterisk and web server followed by changing files ownership:

useradd asterisk
chown asterisk.asterisk -R /var/www/html /var/lib/php

Please note that the Linux user asterisk will be running both Asterisk and web server daemons.

Edit /etc/httpd/conf/httpd.conf and change these optios:

  • User and Group setting, go to line 242-243 and change User apache to User asterisk and Group apache to Group asterisk
  • Allow access to .htaccess file, go to line 338 change AllowOverride None to AllowOverride All
vi /etc/httpd/conf/httpd.conf

Please note that line numbers above are accurate at the time this article is written and no modification had been done to httpd.conf previously.

Make sure the web server run as user asterisk:

/etc/init.d/httpd restart
ps aux | grep httpd

Configure Database Server

Set root password for MySQL database server, in this example we will use simple password password:

mysqladmin -uroot -p password 'password'

Please note that the initial password for MySQL server is empty, just press ENTER.

Server Init

Follow all instructions to initialize your server.

Disable Firewall

Disable firewall from system config tool:


Please note that you can enable the firewall again later after successful installation and several test calls.


Edit /etc/sysconfig/selinux and change SELINUX=enforcing to SELINUX=disabled:

vi /etc/sysconfig/selinux

Reboot the server to actually disable SELinux:


Once the server up and running again check whether the SELinux is disabled:


Please note that the SELinux status must be disabled.

Part 2: Install Asterisk 13

Download Source Codes

Prepare sources directory in /root/src, all required software source codes will be put in that directory:

mkdir -p /root/src
cd ~/src

Get the latest Asterisk, current release is Asterisk 13.7.2:

wget -c http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13.7.2.tar.gz

Please note that the above wget command and all wget commands below are single line only. You must make sure that the correct package will be downloaded to /root/src.

Get the latest PRI library, current release is libpri 1.4.15:

wget -c http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-1.4.15.tar.gz

Get the latest Asterisk hardware drivers, current release is dahdi 2.11.0:

wget -c http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-2.11.0+2.11.0.tar.gz

Get Secure RTP library, we will be using SRTP 1.4.2:

wget -c http://srtp.sourceforge.net/srtp-1.4.2.tgz

Get JSON library for C:

wget -c http://www.digip.org/jansson/releases/jansson-2.7.tar.gz


wget -c http://www.pjsip.org/release/2.4.5/pjproject-2.4.5.tar.bz2

Compile and Install PJSIP

Install PJSIP:

cd ~/src
tar -jxf pjproject-2.4.5.tar.bz2
cd pjproject-2.4.5

On CentOS x86_64 version you must add --libdir=/usr/lib64 but on CentOS i386 (32 bit) version you must remove it.

Below command is to compile and install PJSIP on CentOS x86_64 version:

./configure CFLAGS='-O2 -DNDEBUG -DPJ_HAS_IPV6=1' --prefix=/usr --libdir=/usr/lib64 --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr

If you are using CentOS i386 version then use this instead:

./configure CFLAGS='-O2 -DNDEBUG -DPJ_HAS_IPV6=1' --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr

Continue to compile and install PJSIP:

make dep
make install
cd ../

Compile and Install JSON Library

Jansson is a C library for encoding, decoding and manipulating JSON data. Install this library:

cd ~/src
tar -zxf jansson-2.7.tar.gz
cd jansson-2.7
./configure --prefix=/usr
make clean
make install
cd ../

Compile and Install SRTP

Install Secure RTP library:

cd ~/src
tar -zxf srtp-1.4.2.tgz
cd srtp
./configure CFLAGS=-fPIC
make runtest
make install
cd ../

Compile and Install DAHDI

Install Asterisk hardware drivers DAHDI:

cd ~/src
tar -zxf dahdi-linux-complete-2.11.0+2.11.0.tar.gz
cd dahdi-linux-complete-2.11.0+2.11.0
make all
make install
make config
cd ../

Please note that DAHDI must be installed before libpri and Asterisk.

Compile and Install libpri

Install PRI library:

cd ~/src
tar -zxf libpri-1.4.15.tar.gz
cd libpri-1.4.15
make install
cd ../

Compile and Install Asterisk

Start to install Asterisk 13:

cd ~/src
tar -zxf asterisk-13.7.2.tar.gz
cd asterisk-13.7.2

Get mp3 source library, Asterisk package does not provide it:


Continue to select Asterisk modules:

make menuselect

Inside make menuselect you may choose which packages you want to install or remove.

Here is the recommended options:

  • Add-ons tab select chan_ooh323, format_mp3 and cdr_mysql
  • Applications tab select app_meetme
  • Channel Drivers tab make sure to select chan_pjsip
  • Core Sound Packages tab select EN WAV, ULAW, GSM, G729
  • Music On Hold File Packages tab select EN WAV, ULAW, GSM, G729
  • Extras Sound Packages tab select EN WAV, ULAW, GSM, G729

Please note that sound files and music on hold files are essential, but the selection type can be minimized into just EN WAV, GSM and G729.

Continue to compile and install Asterisk:

make install

This is important, run ldconfig after make install:


Continue to install sample configuration:

make samples
cd ../

Test the installed Asterisk by running it and then hit Ctrl+C to stop it once the label Asterisk Ready at the end of the command is shown:

asterisk -v

Please note that we don’t need to install Asterisk init script as we will use the FreePBX start and stop init script later.

Part 3: Install FreePBX 13

Download Source

Get FreePBX 13:

wget -c http://mirror.freepbx.org/modules/packages/freepbx/freepbx-13.0-latest.tgz


Install sox for audio transcoding that will be used by FreePBX 13:

yum install sox

Start to install FreePBX 13:

cd ~/src
tar -zxf freepbx-13.0-latest.tgz
cd freepbx

Asterisk must be running during FreePBX 13 installation and an adjustment need to be done on Asterisk config file asterisk.conf. Apparently the mark (!) on the end of the first line of /etc/asterisk/asterisk.conf will fail the FreePBX 13 installer script, therefore it must be removed.

Edit /etc/asterisk/asterisk.conf, change [directories](!) to just [directories] and then save the file:

vi /etc/asterisk/asterisk.conf

Prepare to restart Asterisk and set Asterisk file permission:

mkdir -p /var/run/asterisk /etc/dahdi
touch /etc/modprobe.d/dahdi.conf
chown asterisk.asterisk -R /usr/lib/asterisk /etc/asterisk /var/lib/asterisk /var/log/asterisk /var/spool/asterisk /var/run/asterisk /etc/dahdi /etc/modprobe.d/dahdi.conf

Continue to run Asterisk, FreePBX provides a script to run the Asterisk:

./start_asterisk restart

Test if the Asterisk is running:

ps aux | grep asterisk
asterisk -rx "core show uptime"

FreePBX Installation

Please pay attention to details, you will be asked several important questions and you must answer them correctly. Most importantly the Database username and Database password questions must be answered correctly, other questions you may left them as default.

The database username is root and the database password is password.

Continue to install FreePBX:


Try to restart FreePBX, including the Asterisk, using fwconsole:

fwconsole restart

After installation process the server must be configured to run fwconsole start on boot. Insert /usr/sbin/fwconsole start at the bottom of /etc/rc.local, insert once:

echo "/usr/sbin/fwconsole start" >> /etc/rc.local

Reboot the server:


Please note that the server reboot is required before accessing FreePBX from browser.

FreePBX Setup

Follow below steps to initialize FreePBX for the first time:

  1. Open browser and browse the server’s IP address to login to FreePBX
  2. Create the admin username and password for FreePBX
  3. Login as admin user on FreePBX Administration
  4. Hit the red Apply Config button on top.

At this point the IPPBX is ready, but before proceeding with other configuration you should consider to update the FreePBX.

Follow below steps to update FreePBX for the first time:

  1. Visit Module Admin menu from the Admin tab
  2. Hit the Check Online button
  3. Click the Upgrade all button followed by Process button
  4. Click Confirm button to continue
  5. Hit Apply Config to implement changes

IPPBX installation finished.


This howto is written by Anton Raharja.