Asterisk is a free and open-source communication framework, used for building enterprise communication systems over the internet by turning a normal computer into a communication server. It has been used in creating massive call centers that span different regions and connect callers across the world. Asterisk powers IP PBX systems, VoIP gateways and conference servers to create VoIP systems. It comes with various features that will VoIP communication possible and as desired.

Features of Asterisk

Some of the features that makes Asterisk preferred for VoIP communication include:

  • Call Recording
  • Call Parking
  • SMS Messaging
  • Trunking
  • Transcoding
  • Conference calling
  • Distributed Universal Number Discovery
  • Caller ID on Call Waiting
  • Music on Hold
  • Music on Transfer
  • Automated Attendant
  • Voicemail
  • Authentication
  • Blacklists
  • Alarm receiver
  • Call Monitoring

Install Asterisk 18 on Rocky Linux 8

Rocky Linux is a fork of CentOS, released after the end of support for CentOS 8. As such we are going to be using ‘dnf‘ as a package manager for our installation. The following steps describe how to install Asterix LTS 18 on Rocky Linux 8

Step 1: Update system packages

Ensure to be running the latest system packages before beginning your installation. Also set SElinux in permissive mode to allow your installation. Use the below commands. Reboot the system once updated.

sudo dnf update

To set SElinux in permissive mode

sudo setenforce 0
sudo sed -i 's/\(^SELINUX=\).*/\SELINUX=permissive/' /etc/selinux/config

Reboot your server

sudo reboot

Step 2: Set System Timezone and Hostname

Next, we need to set the correct timezone for our system and also update hostname. Use the commands below to set timezone and hostname in the same order

sudo timedatectl set-timezone Africa/Nairobi
sudo hostnamectl set-hostname asterisk.example.com

Step 3: Add Epel Repository and Install Development tools

We require to enable Epel repository as it might be useful on installation of packages. Run the command below:

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

Enable PowerTools on Rocky Linux 8:

sudo dnf config-manager --set-enabled powertools

Install development tools using the commands below:

sudo yum group -y install "Development Tools"
sudo yum -y install git wget vim  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 libedit libedit-devel

Step 4: Install Jansson

Jansson is a C Library required for media encoding and decoding. Download and install as below:

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

Step 5: Install PJSIP

PJSIP is an important communication library needed in the implementation of VoIP protocols such as SIP, TURN,ICE, SDP, RTP and STUN. We will build PJSIP from source as shown:

cd ~
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
sudo make install
sudo ldconfig

Step 6: Install Asterisk on Rocky Linux 8

Once all the dependencies have been installed, go ahead to download and install Asterisk on Rocky Linux 8

cd ~
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz
tar xvfz asterisk-18-current.tar.gz
cd asterisk-18*/
./configure --libdir=/usr/lib64

You should see the below pattern on a successful configuration

.....
configure: Menuselect build configuration successfully completed

               .$$$$$$$$$$$$$$$=..      
            .$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$$$$$$$$$.$$$$$$      
       $$$$$$$$$$$$$$$$.                

configure: Package configured for: 
configure: OS type  : linux-gnu

Step 7: Set Asterisk Menu Options

To set menu options, use the below command:

make menuselect

Make use of arrow keys and Enter key to select a desired option.

Select chan_ooh323 and format_mp3 under add-ons as shown:

Next, select the different formats of audio packets under Core sound Packages

Next, head to music on hold and select the shown packages:

Under Extra Sound Packages, choose the shown modules:

And enable app-macro in the applications section

When done selecting all you need, head to Save & Exit to save your configuration.

Step 8: Build and install Asterisk on Rocky Linux 8

First download mp3 decoder into source tree with the below command:

contrib/scripts/get_mp3_source.sh

Then build and install Asterisk as below:

make
sudo make install
sudo make samples
sudo make config
sudo ldconfig

Step 9: Configure Asterisk on Rocky Linux 8

We are going to create a separate user to run asterisk as below:

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

Set the default user for Asterisk to asterisk. Open the configuration files below and uncomment the lines as shown:

$ sudo vim /etc/sysconfig/asterisk
AST_USER="asterisk"
AST_GROUP="asterisk"

$ sudo vim /etc/asterisk/asterisk.conf
runuser = asterisk ; The user to run as.
rungroup = asterisk ; The group to run as.

Once you save the changes, restart asterisk and enable it to start on system reboot

sudo systemctl restart asterisk
sudo systemctl enable asterisk

Confirm the status of Asterisk service

sudo systemctl status asterisk

The output should saw that it is running as below:

Access Asterisk command prompt to confirm that it is working

sudo asterisk -rvv

This should take you to Asterisk command prompt as shown in the below output

Check service uptime

core show uptime

Output as below:

This shows that Asterisk is properly installed and working as expected. Up to this point, therefore, you have successfully installed Asterisk 18 LTS on Rocky Linux and you can begin using it. In our next guide, we will be looking at how to install FreePBX which will provide a web-based graphical interface for managing Asterisk. If you are not good with the command line, FreePBX will be the best option for you when working with Asterisk. Check more interesting guides below:

LEAVE A REPLY

Please enter your comment!
Please enter your name here