Asterisk is an open-source PBX software. It is used to manage SIP sessions between endpoints. Asterisk is a very powerful server that can be used to implement PBX, IVRs, VoIP gateways, and many more features. It supports many VoIP protocols such as SIP(Session Initiation Protocol) and MGCP(Media Gateway Control Protocol. It also supports many hardware devices such as analog cards, PRI cards, etc.
Today we will be installing Asterisk 18.1.1 on Centos 8, which is the latest Asterisk release at the time of writing. Before we jump to the installation let us look at the major changes which the new release has brought with it.
Major Changes From Asterisk 17 to 18
Codec – H.265/HEVC is now an officially supported video codec. It can be used by specifying “h265” in the allow line.
Logger – A new formatter “plain” has been added. It will always print file, function, and line number and never prints the color controlled characters. It can be used in the logger.conf.
STIR/SHAKEN – The support for STIR/SHAKEN(Secure Telephony Identity Revisited / Signature-based Handling of Asserted information using toKENs) has been added which is used to combat telephony fraud. It is a certificate-based technology and it uses public and private keys to identify the source. The configuration for it is done in the stir_shaken.conf. You can find the sample config file here.
You can find all the changes here.
We will be installing Asterisk 18.1.1 which is the latest release at the time of writing. It includes all the latest bug fixes and features that have been added in the past year. For this tutorial, we will be using CentOS 8 as the host operating system. Here is a brief overview of the steps we will be following in the tutorial.
- Pre-requisite operations
- Downloading the source
- Configuring the install
Step 1: Pre-Requisites
First, let us make sure that our packages and OS are up to date.
We will now install the pre-requisite, the packages required for the compilation of Asterisk. But before we proceed with the packages we are first required to enable PowerTools repository which hosts many development packages.
dnf config-manager --set-enabled PowerTools
Now we will install the required packages.
dnf install -y wget gcc gcc-c++ make bzip2 patch libedit-devel uuid-devel libuuid-devel libxml2-devel sqlite sqlite-devel nano openssl openssl-devel
We should also disable SELinux so that it will not hinder with our installation process
Change the enforcing parameter to disabled or permissive.
Now save and exit the file. After a reboot, we will be good to go.
Step 2: Downloading the source
Let’s download the latest Asterisk 18 source on our Centos 8 OS from the official website. It is possible that newer version might have been released when you are installing so you can visit this link and download the latest release.
cd /usr/src/ && wget https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz
Untar the tarball you just downloaded
tar -xzf asterisk-18*
Switch to the extracted directory, here the version is 18.1.1, your might be different
Step 3: Configuring
Since we have already satisfied the dependencies required by Asterisk 18 for Centos 8 we will now run the configuration script using the following command
This configure script will check our system for the dependencies of the different modules of the asterisk. We used the –with-jansson parameter so as to install Jansson library which is required for asterisk to work. It comes bundled with the asterisk source and saves us the hassle to compile it from the source.
We will now select the modules and packages that we want to compile with our base Asterisk installation. Use the following command to open the asterisk configuration menu.
You can enable/disable the modules that you wish to compile alongside the core of the asterisk in the above menu.
Step 4: Compiling
Now we will compile and install Asterisk 18 on Centos 8 with the modules that we have selected. This process will take some time depending on your computer resources.
make && make all && make install
Now that the asterisk is compiled and ready to be used, if required you can run the following command to generate the sample config files for asterisk. It is optional.
The config files which the above command will generate can be found in /etc/asterisk directory
We are also required to install asterisk init script
Now we will start the asterisk service and enable it so that it will run with every system reboot
systemctl start asterisk systemctl enable asterisk
To connect to the Asterisk CLI we will use the following command. Adding -vvv at the end will change the verbosity of the core logs to 3.
Now that the asterisk is properly installed and running you can now start working on the config files to build your application. If you have generated the sample files you will see something as shown below in the /etc/asterisk directory
If you have not generated the sample config, then you can start building up your config files under the same directory.