29 C
Texas

How To Install Asterisk 17 on Ubuntu 20.04

Today, we are going to learn that how to install asterisk on Ubuntu 20.04. Let’s have a short introduction about asterisk before going to the installation process.

What is Asterisk?

Asterisk is free Open Source software used to design different communication application for small as well as large business. With the help of Asterisk, you can turn your computer into communication server. So, let’s begin with the installation process.

Step 1: Update Your System

As usual we do, update your system to have the latest updates installed.

sudo apt update && sudo apt upgrade
- Advertisement -

Once the update complete reboot your system.

sudo systemctl reboot

Step 2: Installing Build Dependencies

Install the required build dependencies by hitting the below command in your terminal.

sudo apt update
sudo add-apt-repository universe
sudo apt -y install git curl wget libnewt-dev libssl-dev libncurses5-dev subversion libsqlite3-dev build-essential libjansson-dev libxml2-dev uuid-dev

Step 3: Download Asterisk 17 Tarball On Ubuntu 20.04

Now, download the latest release of Asterisk in their official system repositories. Here I’m going to manually download the tarball & then I’ll build the application from source. You can get the Asterisk 16 version on Ubuntu 20.04.

abir@Ubuntu20:~$ sudo apt policy asterisk
[sudo] password for sabir:
asterisk:
Installed: (none)
Candidate: 1:16.2.1~dfsg-2ubuntu1
Version table:
1:16.2.1~dfsg-2ubuntu1 500
500 http://pk.archive.ubuntu.com/ubuntu focal/universe amd64 Packages

And with the help of wget, download the package.

wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-17-current.tar.gz

Once the download finished, extract the files.

tar xvf asterisk-17-current.tar.gz

And then hit the below command to download the mp3 decoder library into the source tree.

cd asterisk-17*/
contrib/scripts/get_mp3_source.sh

Output:

You’ll see the similar output.

A addons/mp3
A addons/mp3/MPGLIB_README
A addons/mp3/common.c
A addons/mp3/huffman.h
A addons/mp3/tabinit.c
A addons/mp3/Makefile
A addons/mp3/README
A addons/mp3/decode_i386.c
A addons/mp3/dct64_i386.c
A addons/mp3/MPGLIB_TODO
A addons/mp3/mpg123.h
A addons/mp3/layer3.c
A addons/mp3/mpglib.h
A addons/mp3/decode_ntom.c
A addons/mp3/interface.c
Exported revision 202.

Make sure that all the required dependencies are resolved. To check, type the following command in your terminal.

sudo contrib/scripts/install_prereq install

Output:

You’ll see the below message upon successful installation.

##############################
## install completed successfully
##############################

Step 4: Build & Install Asterisk 17

Once you finished with the dependencies installation setup, go to the build process from the source we downloaded earlier.

To verify the build dependencies, type the configure command.

./configure

Result: Upon success, you’ll see the similar result.

How To Install Asterisk 17 on Ubuntu 20.04

After it setup the menu options with the help of below command.

make menuselect

Make use of arrow keys to navigate and press the Enter key to select.

Choose Addons to enable

How To Install Asterisk 17 on Ubuntu 20.04

And enable the core sound modules that you’ll use.

How To Install Asterisk 17 on Ubuntu 20.04

If you want to add additional MOH packages, select that option also.

How To Install Asterisk 17 on Ubuntu 20.04

Also enable the Extra Sound Packages.

How To Install Asterisk 17 on Ubuntu 20.04

You can also go for the other menu options as listed to select what you need for your use case.

After selecting all, hit the make command in your terminal.

make

Result:

…..
TROLEnc.o ooh323cDriver.o -> chan_ooh323.so
[CC] format_mp3.c -> format_mp3.o
[CC] mp3/common.c -> mp3/common.o
[CC] mp3/dct64_i386.c -> mp3/dct64_i386.o
[CC] mp3/decode_ntom.c -> mp3/decode_ntom.o
[CC] mp3/layer3.c -> mp3/layer3.o
[CC] mp3/tabinit.c -> mp3/tabinit.o
[CC] mp3/interface.c -> mp3/interface.o
[LD] format_mp3.o mp3/common.o mp3/dct64_i386.o mp3/decode_ntom.o mp3/layer3.o mp3/tabinit.o mp3/interface.o -> format_mp3.so
[CC] res_config_mysql.c -> res_config_mysql.o
[LD] res_config_mysql.o -> res_config_mysql.so
Building Documentation For: third-party channels pbx apps codecs formats cdr cel bridges funcs tests main res addons
+--------- Asterisk Build Complete ---------+
Asterisk has successfully been built, and +
can be installed by running: +
+
make install +
+-------------------------------------------+

And finally, run the given command to install Asterisk on Ubuntu 20.04

sudo make install

Output:

….
make[1]: Entering directory '/home/jkmutai/asterisk-17.6.0/sounds'
make[1]: Leaving directory '/home/jkmutai/asterisk-17.6.0/sounds'
find rest-api -name "*.json" | while read x; do \
/usr/bin/install -c -m 644 $x "/var/lib/asterisk/rest-api" ; \
done
+---- Asterisk Installation Complete -------+
+
YOU MUST READ THE SECURITY DOCUMENT +
+
Asterisk has successfully been installed. +
If you would like to install the sample +
configuration files (overwriting any +
existing config files), run: +
+
For generic reference documentation: +
make samples +
+
For a sample basic PBX: +
make basic-pbx +
+
+
+----------------- or ---------------------+
+
You can go ahead and install the asterisk +
program documentation now or later run: +
+
make progdocs +
+
Note This requires that you have +
doxygen installed on your local system +
+-------------------------------------------+

If you need documentation,hit.

sudo make progdocs

And then type the following commands to install configuration & samples.

sudo make samples
sudo make config
sudo ldconfig

Step 5: Start Asterisk Services On Ubuntu 20.04

Add the asterisk user & group & give access to the specific permissions as required.

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
sudo chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk
sudo chown -R asterisk.asterisk /usr/lib/asterisk

And choose the asterisk for default user of Asterisk.

sudo nano /etc/default/asterisk
AST_USER="asterisk"
AST_GROUP="asterisk"

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

After these configuration, restart the Asterisk services.

sudo systemctl restart asterisk

If you want to start asterisk services on start/system boot, hit the below command.

sudo systemctl enable asterisk

Verify the status of Asterisk services by

$ systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
Loaded: loaded (/etc/init.d/asterisk; generated)
Active: active (running) since Sat 2020-08-22 12:04:41 CEST; 9s ago
Docs: man:systemd-sysv-generator(8)
Tasks: 82 (limit: 4567)
Memory: 44.6M
CGroup: /system.slice/asterisk.service
└─54142 /usr/sbin/asterisk -U asterisk -G asterisk

Also make sure that you can connect to Asterisk CLI.

$ sudo asterisk -rvv
Asterisk 17.6.0, Copyright (C) 1999 - 2018, Digium, Inc. and others.
Created by Mark Spencer [email protected]
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.
Running as user 'asterisk'
Running under group 'asterisk'
Connected to Asterisk 17.6.0 currently running on ubuntu (pid = 54142)
ubuntu*CLI>

Then allow firewall access on port 5060 and 5061.

sudo ufw allow proto tcp from any to any port 5060,5061

So, this is how you can install Asterisk on Ubuntu 20.04. If you’ve any queries regarding this guide, leave a comment below.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article