Thursday, December 1, 2016

Install Certified Asterisk 13 on CentOS7 / RedHat7




Asterisk is an open source PBX (private branch exchange) server that manage telephone calls. It include features such as customer service queues, music on hold, conference calling, and call recording, and many more.

Setup a machine with Cent-OS/Red-hat 7, and follow below steps.

1 - Disabled SE-Linux
vi /etc/selinux/config
And set SELINUX to disable
SELINUX=disabled

2 - Update installed Cent-OS/Red-hat 7 with latest packages.
yum update

3 - Stop Linux firewall, or add appropriate rules to allow asterisk related ports for clients and other services.

To stop Cent-OS/Red-hat 7 firewall
systemctl stop firewalld
If need to disable firewall permanently
systemctl disable firewalld
To stop Cent-OS/Red-hat 7 iptables permanently(if started)
systemctl stop iptables
If need to disable firewall permanently
systemctl disable iptables

4 - After updating Cent-OS/Red-hat 7 with latest packages restart the server to apply changes and setting properly.
reboot Or init 6

5 - After server gets reboot properly reconnect server and install required dependencies for Asterisk.

To install dependencies run below commands
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 bzip2 vim sox libtool* make gcc patch perl flex-devel gcc-c++ ncurses-devel flex libtermcap-devel autoconf* automake* libxml2-devel cmake wget vim sox httpd sqlite sqlite-devel bison make wget openssl-devel ncurses-devel  newt-devel libxml2-devel kernel-devel gcc gcc-c++ sqlite-devel libuuid-devel
yum install -y "kernel-devel-uname-r == $(uname -r)"
6 - To install asterisk JSON support is required (this typically means the libjansson development package is required).

To install libjansson development package follow below steps,

Go to /usr/src directory.
cd /usr/src/
Use wget to download the required source code for installation.
wget http://www.digip.org/jansson/releases/jansson-2.5.tar.gz
Extract it.
tar -zxf jansson-2.5.tar.gz
Go to the newly created directory.
cd jansson*
Compile the software.
./configure
Install package.
make clean
make
make install

7 - Installing PJPROJECT

PJPROJECT is Asterisk’s SIP channel driver. It is to provide improved call clarity and performance over older drivers.

Go to /usr/src directory.
cd /usr/src
Use wget to download the PJSIP source code for installation.
wget http://www.pjsip.org/release/2.3/pjproject-2.3.tar.bz2
Extract it.
tar -jxvf pjproject-2.3.tar.bz2
Go to the newly created pjproject directory.
cd pjproject-2.3
Compile the software.
./configure CFLAGS="-DNDEBUG -DPJ_HAS_IPV6=1" --prefix=/usr --libdir=/usr/lib64 --enable-shared --disable-video --disable-sound --disable-opencore-amr
To ensure all dependencies are properly in present.
make dep
make
Install package.
make install
ldconfig
To ensure the libraries have installed properly.
ldconfig -p | grep pj
If everything is properly  installed and configured you should get output something that looks like,
libpjsua2.so.2 (libc6,x86-64) => /lib64/libpjsua2.so.2
libpjsua2.so (libc6,x86-64) => /lib64/libpjsua2.so
libpjsua.so.2 (libc6,x86-64) => /lib64/libpjsua.so.2
libpjsua.so (libc6,x86-64) => /lib64/libpjsua.so
libpjsip.so.2 (libc6,x86-64) => /lib64/libpjsip.so.2
libpjsip.so (libc6,x86-64) => /lib64/libpjsip.so
libpjsip-ua.so.2 (libc6,x86-64) => /lib64/libpjsip-ua.so.2
libpjsip-ua.so (libc6,x86-64) => /lib64/libpjsip-ua.so
libpjsip-simple.so.2 (libc6,x86-64) => /lib64/libpjsip-simple.so.2
libpjsip-simple.so (libc6,x86-64) => /lib64/libpjsip-simple.so
libpjnath.so.2 (libc6,x86-64) => /lib64/libpjnath.so.2
libpjnath.so (libc6,x86-64) => /lib64/libpjnath.so
libpjmedia.so.2 (libc6,x86-64) => /lib64/libpjmedia.so.2
libpjmedia.so (libc6,x86-64) => /lib64/libpjmedia.so
libpjmedia-videodev.so.2 (libc6,x86-64) => /lib64/libpjmedia-videodev.so.2
libpjmedia-videodev.so (libc6,x86-64) => /lib64/libpjmedia-videodev.so
libpjmedia-codec.so.2 (libc6,x86-64) => /lib64/libpjmedia-codec.so.2
libpjmedia-codec.so (libc6,x86-64) => /lib64/libpjmedia-codec.so
libpjmedia-audiodev.so.2 (libc6,x86-64) => /lib64/libpjmedia-audiodev.so.2
libpjmedia-audiodev.so (libc6,x86-64) => /lib64/libpjmedia-audiodev.so
libpjlib-util.so.2 (libc6,x86-64) => /lib64/libpjlib-util.so.2
libpjlib-util.so (libc6,x86-64) => /lib64/libpjlib-util.so
libpj.so.2 (libc6,x86-64) => /lib64/libpj.so.2
libpj.so (libc6,x86-64) => /lib64/libpj.so

8 - Installing DAHDI (Optional)

DAHDI (Digium/Asterisk Hardware Device Interface), is the kernel module that controls telephone interface cards(PRI Card). These cards are usually used when adding Asterisk to an existing call center that uses older technology, such as PRI or Analog telephone channels.

To install DAHDI follow below process:

Go to /usr/src directory.
cd /usr/src
Download the latest version of DAHDI
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
Untar it.
tar -zxvf dahdi-linux-complete-current.tar.gz
Go to DAHDI directory.
cd dahdi-linux-complete-*
Build DAHDI for installation.
make
Install DAHDI
make install
make config

9 - Installation LibPRI (Optional)

Libpri is an open source library that helps to communicate over ISDN Primary Rate Interfaces (T1, E1, J1) protocols. libpri is a dependency for Asterisk and DAHDI if PRI, BRI and QSIG signaling is used. Required for PRI/BRI only.

To install LibPRI follow below process:

Go to /usr/src directory.

cd /usr/src
Download the latest version of LibPRI
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz
Untar LibPRI,
tar xvfz libpri-<version>
Go to LibPRI directory.
cd libpri*
Build LibPRI for installation, and install it.
make
make install
NOTE: If there are any error messages while trying to the above commands, you are missing some system dependencies listed in previous steps


10 - Installing Asterisk.

We’re now ready to install Asterisk 13 from Source.
Will suggest to install Certified Asterisk 13. You may also install regular Asterisk 13 releases also.

 For more information about,
 How is Certified Asterisk different from regular open source Asterisk releases?   
 Visit below link...
 https://www.digium.com/products/asterisk/certified-asterisk


To install Asterisk follow below process:

Go to /usr/src directory.

cd /usr/src
Download the latest version of Asterisk
wget http://downloads.asterisk.org/pub/telephony/certified-asterisk/asterisk-certified-13.21-current.tar.gz
Untar asterisk tar.
tar -zxvf asterisk-certified-13*
Go to asterisk directory.
cd asterisk-certified-13*

Enabling MP3 Support (Optional)

To use MP3 files for Music on Hold, some dependencies will need to be installed.

Install Subversion.

yum install svn
contrib/scripts/get_mp3_source.sh

Asterisk has a per-requisites script to auto install dependencies according to OS if anything is not present.Will suggest to run below command to check per-requisites before continuing further.

./contrib/scripts/install_prereq install

Configuring and Building Asterisk source code

./configure --libdir=/usr/lib64

If every thing is proper you will Asterisk (*) ASCII image will be seen,
If you don't get below image it means there are any missing dependencies,
Install them, execute " make distclean " to remove cached Data and retry configure and build asterisk source codec.


                        .$$$$$$$$$$$$$$$=..     
                      .$7$7..        .7$$7:.   
                    .$7$7..           .7$$7:.
                  .$$:.                 ,$7.7
                .$7.     7$$$$           .$$77
             ..$$.       $$$$$            .$$$7
            ..7$   .?.   $$$$$   .?.       7$$$.
           $.$.   .$$$7. $$$$7 .7$$$.      .$$$.
         .777.   .$$$$$$77$$$77$$$$$7.      $$$,
         $$$~      .7$$$$$$$$$$$$$7.       .$$$.
        .$$7          .7$$$$$$$7:          ?$$$.
        $$$          ?7$$$$$$$$$$I        .$$$7
        $$$       .7$$$$$$$$$$$$$$$$      :$$$.
        $$$       $$$$$$7$$$$$$$$$$$$    .$$$.
        $$$        $$$   7$$$7  .$$$    .$$$.
        $$$$             $$$$7         .$$$.
        7$$$7            7$$$$        7$$$
         $$$$$                        $$$
          $$$$7.                       $$  (TM)
           $$$$$$$.           .7$$$$$$  $$
             $$$$$$$$$$$$7$$$$$$$$$.$$$$$$
               $$$$$$$$$$$$$$$$.


Using Menuselect to Select Asterisk Options (Optional)

The Menuselect option have a list of categories, such as Applications, Channel Drivers, and PBX Modules have, you may select extra options if required.
make menuselect
After a some time, you will get a menu on screen that allows you to configure the features you want to build.
If you want to use the MP3 format with Music on Hold, you should select Add-Ons, then use the right arrow to move to the right-hand list. Navigate to format_mp3 and press enter to select it. Select addition Applications, Channel Drivers, and PBX Modules if required.

Press F12 to save and exit.

Compile Asterisk.
make
Install Asterisk on the system.
make install
Install sample configuration files.
make samples
Configure Asterisk to start automatically on system start-up.
make config
Start Asterisk service.
systemctl start asterisk

Check Asterisk service status.
systemctl status asterisk
If asterisk service is running, you will get output something like below, If asterisk server is not running start the service.

        [root@ip-172-31-11-42 ~]# systemctl status asterisk
        asterisk.service - LSB: Asterisk PBX
           Loaded: loaded (/etc/rc.d/init.d/asterisk; bad; vendor preset: disabled)
           Active: active (running) since Wed 2016-11-30 09:55:52 EST; 1h 39min ago
             Docs: man:systemd-sysv-generator(8)
          Process: 31737 ExecStart=/etc/rc.d/init.d/asterisk start (code=exited,status=0/SUCCESS)
         Main PID: 31762 (asterisk)
           CGroup: /system.slice/asterisk.service
                   ├─31760 /bin/sh /usr/sbin/safe_asterisk
                   └─31762 /usr/sbin/asterisk -f -vvvg -c

        Nov 30 09:55:52 ip-172-31-11-42.ap-south-1.compute.internal systemd[1]: Start...
        Nov 30 09:55:52 ip-172-31-11-42.ap-south-1.compute.internal asterisk[31737]: ...
        Nov 30 09:55:52 ip-172-31-11-42.ap-south-1.compute.internal systemd[1]: PID f...
        Nov 30 09:55:52 ip-172-31-11-42.ap-south-1.compute.internal systemd[1]: aster...
        Nov 30 09:55:52 ip-172-31-11-42.ap-south-1.compute.internal systemd[1]: Start...
        Hint: Some lines were ellipsized, use -l to show in full.


Connect to Asterisk CLI
asterisk -rvvv
If you are able to connect to asterisk CLI, you will get output something like below, Here you will can see asterisk version.

        [root@ip-172-31-11-42 ~]# asterisk -rvvv
        Asterisk certified/13.8-cert3, Copyright (C) 1999 - 2014, Digium, Inc. and others.
        Created by Mark Spencer <markster@digium.com>
        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 certified/13.8-cert3 currently running on ip-172-31-11-42 (pid = 31762)
        ip-172-31-11-42*CLI>
 


Congratulations! You now have a successfully installed Asterisk 13 server.

ENJOY! and Stay connected.

0 comments :

Post a Comment