Soporte & Consultoria

Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita

miércoles, 4 de marzo de 2015

How to Install Asterisk 13 and PJSIP on CentOS 6

With the release of a certified branch of Asterisk 13, the Asterisk training team decided now is the time to provide a brief set of “install from source” instructions. What follows is my three step program to install Asterisk 13. If you are experienced with earlier versions of Asterisk there are some changes to consider, namely the new SIP channel driver powered by the PJSIP SIP stack. The new channel driver is called PJSIP and has been the topic of a few wiki articles and conference presentations already. The original SIP channel driver has been moved to extended support and will not compile by default in Certified Asterisk 13. If you’re still unclear about the impact of the new channel driver, I encourage you to dig into resources linked from this post.

 

Things to consider

  • These instructions have been tested on a freshly installed CentOS 6.6 x86_64 virtual server.
    • These instructions must be modified to work with the 32-bit version of CentOS.
    • I will point out alternate steps for the 32-bit version of CentOS where appropriate.
  • Because the focus of this post is the new SIP channel driver I have not included instructions for DAHDI and LibPRI. Instructions for this process can be found here.
  • For the purposes of this installation we recommend changing SELinux configuration from the default of “enforcing” to “permissive”. Permissive mode will not enforce security policy but will log actions which can be helpful when you need to re-enable SELinux. There are many ways to manipulate SELinux settings that are outside the scope of this article. A typical method is to use a text editor to modify the ‘SELINUX=’ line in /etc/selinux/config by changing “enforcing” to “permissive”. After you update and disable SELinux, you may need to reboot and relabel the file system. Click here for more information about SELinux.
  • I would also greatly discourage using any part of these instructions on a production server until you have vetted them through your own laboratory setup. If you wish to live dangerously I wish you luck.

Step 1 – Setup the environment

The first step is to install the dependencies required to build the PJSIP libraries and Asterisk 13. Using the CentOS yum package manager we’ll update all currently installed packages to their latest version and then install some of the most common dependencies for Asterisk and PJSIP.
# yum update
The kernel-devel package we install next could be slightly ahead of the kernel actually in use on your system. This is why we did a 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 following command will install several packages that are needed to compile and install PJSIP and Asterisk.
# 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
NOTE:If you encounter an issue resolving the dependencies check out the fantastic install_prereq tool shipped with the Asterisk tarball. Located in the contrib/scripts directory of the Asterisk source directory that will be unpacked in step 3.

Step 2 – Install pjproject

Next you will download and install the pjproject sip library directly from pjsip.org. But first we’ll change directories to work in the /usr/src directory.
# cd /usr/src
# wget http://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
This command must be modified when using a 32-bit operating system. Just remove the --libdir=/usr/lib64 option from the command. The other options may be different depending on how you want to use Asterisk. More information about these options can be found on the Asterisk wiki or by running the command ./configure --help. The next four commands will build, install and link the pjsip libraries.
# make dep
# make
# make install
# ldconfig
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:
pjsip-liblink

Step 3 – Install Asterisk 13

Now we’ll download and install the latest Certified-Asterisk 13.1 branch from source. First we’ll change directory up one level to /usr/src.
# cd ..
Then we’ll use the wget command to download the tarball from downloads.asterisk.org.
# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
Next the tar command will unpack the Asterisk source code into a new directory named asterisk-13. Then we’ll go to the new directory.
# tar -zxvf asterisk*
# cd asterisk-*
 
Install the dependencies  
/usr/src/asterisk-*/contrib/scripts  ./install_prereq install
 
 
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.
# ./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:
menuselect-pjsip
After exiting the menuselect screen the next set of commands will build and install Asterisk along with a set of sample configuration files.

NOTE IF YOU ARE RUNNING IN A VIRTUAL MACHINE  OR VPS DISABLE THE OPTION BUILD NATIVE LOCATED ON COPILER FLAGS

# make && make install
# make samples
If you want Asterisk to start at boot time use the following command to setup the Asterisk service.
# make config
 
Run  ldconfig command to resolve symb link issue.
 
ldconfig 

And finally, run the command “service asterisk start” to immediately 
begin the Asterisk service without the need to reboot first. Now you’re 
ready to begin configuring the PJSIP channel driver
 on your freshly installed instance of Asterisk 13. If you run into an 
issue with these instructions feel free to leave a comment on this post,
 check the official Asterisk forums or reach out to the Asterisk community for help.
Special thanks to the Asterisk Development team for pointing out some helpful improvements to these instructions.



No hay comentarios:

Publicar un comentario