How to Install Asterisk 16 on RHEL 8 / CentOS 8

0
75

Asterisk is a CLI based software implementation of a private branch exchange (PBX). In conjunction with suitable telephony hardware interfaces and network applications, Asterisk is used to establish and control telephone calls between telecommunication endpoints, such as customary telephone sets, destinations on the public switched telephone network (PSTN), and devices or services on voice over Internet Protocol (VoIP) networks. Its name comes from the asterisk (*) symbol for a signal used in dual-tone multi-frequency (DTMF) dialing. In this detailed guide, you will learn how to install Asterisk 16 on CentOS / RHEL 8.

Click here to see Asterisk Features

 

Step 1: Install EPEL 8 Repository

Before proceed to this article, update your system

dnf update -y

Run below command to install EPEL Release 8

dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y

Step 2: Disable SELinux

Open file /etc/SELinux/config using below command and modify a line from SELINUX=enforcing to SELINUX=disabled

vi /etc/selinux/config

Then, save changes and exit

Now reboot your machine

reboot

Step 3: Install Dependencies

Install software Development tools and other required dependencies to run Asterisk using following commands.

dnf groupinstall "Development Tools" -y

dnf install git wget net-tools sqlite-devel psmisc ncurses-devel libtermcap-devel newt-devel libxml2-devel libtiff-devel gtk2-devel libtool libuuid-devel subversion kernel-devel kernel-devel-$(uname -r) crontabs cronie-anacron -y

Step 4: Compile and Install Jansson

Jansson is a C library, it is used to encode/decode and manipulate JSON data. run below commands to install it.

cd /usr/src/
git clone https://github.com/akheron/jansson.git
cd jansson
autoreconf -i
./configure --prefix=/usr/
make && make install

Step 5: Compile and Install PJSIP

PJSIP is a free and open-source multimedia communication library written in C language implementing standard based protocols such as SIP, SDP, RTP, STUN, TURN, and ICE. It combines signaling protocol (SIP) with rich multimedia framework and NAT traversal functionality into high-level API that is portable and suitable for almost any type of systems ranging from desktops, embedded systems, to mobile handsets.

run following command to install PJSIP

cd /usr/src/
git clone https://github.com/pjsip/pjproject.git
cd pjproject
./configure CFLAGS="-DNDEBUG -DPJ_HAS_IPV6=1" --prefix=/usr --libdir=/usr/lib64 --enable-shared --disable-video --disable-sound --disable-opencore-amr
make dep
make
make install
ldconfig

Step 6: Install and Configure Asterisk

All dependencies are installed and Asterisk is ready for installation.

cd /usr/src/
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-16-current.tar.gz
tar xfz asterisk-16-current.tar.gz
rm -f asterisk-16-current.tar.gz
cd asterisk-16*/

Install libedit packages using below commands:

dnf install https://rpmfind.net/linux/fedora/linux/releases/29/Everything/x86_64/os/Packages/l/libedit-3.1-24.20170329cvs.fc29.x86_64.rpm -y

dnf install https://rpmfind.net/linux/fedora/linux/releases/29/Everything/x86_64/os/Packages/l/libedit-devel-3.1-24.20170329cvs.fc29.x86_64.rpm -y

Asterisk Configuration

./configure --libdir=/usr/lib64

Step 7: Configure Asterisk Menu Options

Set Asterisk menu options by using the following command, you can also select your desired options.

Here you will use arrow keys (Up, Down, Right and Left) to navigate and Enter key to select the desired option. The selected option will be marked with * symbol.

make menuselect

i Select “app_macro” under Applications section.

ii Under “Add-ons” select “chan_ooh323” and “format_mp3”

iii Under “Core Sound Packages” select the following Audio formats.

CORE-SOUNDS-EN-ULAW
CORE-SOUNDS-EN-ALAW
CORE-SOUNDS-EN-GSM
CORE-SOUNDS-EN-G729
CORE-SOUNDS-EN-G722
CORE-SOUNDS-EN-SLN16
CORE-SOUNDS-EN-SIREN7
CORE-SOUNDS-EN-SIREN14

iv For “Music On Hold” select the following minimal modules

MOH-OPSOUND-WAV
MOH-OPSOUND-ULAW
MOH-OPSOUND-ALAW
MOH-OPSOUND-GSM

v On Extra Sound Packages select as shown below

EXTRA-SOUNDS-EN-WAV
EXTRA-SOUNDS-EN-ULAW
EXTRA-SOUNDS-EN-ALAW
EXTRA-SOUNDS-EN-GSM

Then Save and Exit.

Step 8: Build and Install Asterisk

Download the mp3 decoder library into the source tree and build Asterisk

contrib/scripts/get_mp3_source.sh

make
make install
make samples
make config
ldconfig

Step 9: Create Asterisk User and Start Asterisk

Create a group and user for asterisk services, and assign appropriate permissions using following commands

groupadd asterisk
useradd -r -d /var/lib/asterisk -g asterisk asterisk
usermod -aG audio,dialout asterisk
chown -R asterisk.asterisk /etc/asterisk /var/{lib,log,spool}/asterisk /usr/lib64/asterisk

Set Asterisk default user:

edit /etc/sysconfig/asterisk file by using below command

vi /etc/sysconfig/asterisk

and add below lines in this file.

AST_USER="asterisk"
AST_GROUP="asterisk"

Then edit /etc/asterisk/asterisk.conf file by using below command.

vi /etc/asterisk/asterisk.conf

and add below lines in this file.

runuser = asterisk ; The user to run as.
rungroup = asterisk ; The group to run as.

Step 10: Setup Asterisk service

Now restart asterisk service and enable it on boot

systemctl restart asterisk
systemctl enable asterisk
systemctl status asterisk

Verify that you can connect to Asterisk CLI by running below command

asterisk -rvv

If you entered in above screen congratulation! you have access to Asterisk on CentOS / RHEL.

Also, you can read our posts about CentOS and RHEL.

Please share this post and join our Telegram Channel.

LEAVE A REPLY

Please enter your comment!
Please enter your name here