This post details step by step guide on how to install Asterisk 13 and PJSIP on CentOS 6 Linux distribution, which means that prior to installing Asterisk; pjproject libraries needs to be installed first to meet the dependencies for Asterisk 13.
Step 1 – Update System
The first step is to install and update required dependencies Asterisk 13 requires to build the PJSIP libraries. We will be using CentOS yum package manager to update all currently installed packages to their latest version and then install some of the most common dependencies for Asterisk and PJSIP.
# yum update
Please note that kernel-devel package installed must match with the kernel installed in the system. You may receive errors or installation failures if you both kernels mismatch.
yum update command above can handle the above process to update kernel but if you see any failures than please do check kernel-devel and kernel version running on the system. That is the main reason to run yum update first. If the kernel has been updated, be sure to reboot before moving forward. More information about the kernel-devel packages available for CentOS can be found here. The next is to run below command which will install several packages that are needed to compile and install PJSIP and Asterisk 13.
# yum install -y epel-release dmidecode gcc-c++ ncurses-devel libxml2-devel make wget openssl-devel newt-devel kernel-devel sqlite-devel libuuid-devel gtk2-devel jansson-devel binutils-devel
Next Step – Install pjproject before installing Asterisk
Please download and install the pjproject sip library directly from PJSIP website https://pjsip.org and change the directories to work in the /usr/src directory. We can download it under usr/src directory and un-tar the zip file using tar command.
# cd /usr/src
# wget https://www.pjsip.org/release/2.3/pjproject-2.3.tar.bz2
# tar -jxvf pjproject-2.3.tar.bz2
This will create the pjproject-2.3 directory. Change to this directory and run the following set of commands to build and install the pjproject sip library.
# cd pjproject-2.3
# ./configure CFLAGS=”-DNDEBUG -DPJ_HAS_IPV6=1″ –prefix=/usr –libdir=/usr/lib64 –enable-shared –disable-video –disable-sound –disable-opencore-amr
Please use -–libdir=/usr/lib64 option from the command if pjproject is installed on the 64 bit. You can just remove the above line command parameters if the system is 32 bit. Other options can be checked using ./configure –help command for detailed view of options disable or enable as per requirement.
Obtaining the latest pjproject from the svn repo:
Use svn to install the latest version from www.pjsip.org.
# svn co http://svn.pjsip.org/repos/pjproject/trunk/ pjproject-trunk
After completion to above command please run below commands, if you ran into issues then please run distclean and change the parameters required for successful build process.
# make dep
# make install
And finally this next command will verify the pjsip libraries have been dynamically linked.
# ldconfig -p | grep pj
Your output should look something like this:
libpjsua.so (libc6,x86-64) => /usr/lib/libpjsua.so
libpjsip.so (libc6,x86-64) => /usr/lib/libpjsip.so
libpjsip-ua.so (libc6,x86-64) => /usr/lib/libpjsip-ua.so
libpjsip-simple.so (libc6,x86-64) => /usr/lib/libpjsip-simple.so
libpjnath.so (libc6,x86-64) => /usr/lib/libpjnath.so
libpjmedia.so (libc6,x86-64) => /usr/lib/libpjmedia.so
libpjmedia-videodev.so (libc6,x86-64) => /usr/lib/libpjmedia-videodev.so
libpjmedia-codec.so (libc6,x86-64) => /usr/lib/libpjmedia-codec.so
libpjmedia-audiodev.so (libc6,x86-64) => /usr/lib/libpjmedia-audiodev.so
libpjlib-util.so (libc6,x86-64) => /usr/lib/libpjlib-util.so
libpj.so (libc6,x86-64) => /usr/lib/libpj.so
Last step – Install Asterisk 13
Now we’ll follow the steps to download and install the certified-Asterisk 13.1 version from source under /usr/src directory
# cd /usr/src
Next step is to download using “wget” command to download the tarball from downloads.Asterisk.org
# wget http://downloads.Asterisk.org/pub/telephony/certified-Asterisk/certified-Asterisk-13.1-current.tar.gz
Next the tar command will unpack the Asterisk source code into a new directory named certified-Asterisk-13.1.
# tar -zxvf certified-Asterisk-13.1-current.tar.gz
# cd certified-Asterisk-13.1-cert1
The next set of commands will build and install Asterisk. Remember to skip the -–libdir=/usr/lib64 option for 32-bit versions of CentOS. In that case just run the command
# ./configure –libdir=/usr/lib64
Next you will run the make menuselect command. This step will verify if the pjsip channel driver dependencies have been successfully installed.
# make menuselect
Use the arrow keys to navigate to “Resource Modules” in the left column, about halfway down the list. Press the right arrow key and then scroll down until you see the list of modules beginning with “res_pjsip_”. If these modules have “XXX” to the left of their name then the dependencies have not been met. You’ll need to go back to the /usr/src/pjproject directory, run the “make distclean” command and start over carefully looking for any error messages and proceed from there. If you see [*] instead of XXX then the res_pjsip module’s dependencies have been met and you can proceed to the next steps. Your menuselect screen should look like this:
After exiting the menu, select screen the next set of commands will build and install Asterisk along with a set of sample configuration files.
# make install
# make samples
If you want Asterisk to start at boot time use the following command to setup the Asterisk service.
# make config
And finally, run the command “service Asterisk start” to immediately begin the Asterisk service without the need to reboot first.