How to Install Asterisk 18 on Ubuntu 20.04

Содержание

Asterisk is a popular open-source PBX framework for VoIP gateway development. It is an online telephone solution used by individuals, small and large businesses, enterprises, and various governments.

Asterisk uses a VoIP protocol to make calls over the internet using the TCP/IP instead of the traditional land telephone line. Its features include voicemail, music on hold, conference calling, call queuing, call recording, interactive voice response, SMS messaging, automatic call distribution, and more. Asterisk can be installed on multiple operating systems, including Linux, NetBSD, macOS, and Solaris, among others.

In this tutorial, we learn how to install Asterisk 18 on Ubuntu 20.04.

Prerequisites

In Ubuntu repositories, we can find the package Asterisk, but it’s an older version. To get the latest version you need to install Asterisk from the source.

First, update your Ubuntu system:

Next, install the required packages needed to compile the Asterisk from the source:

Installing DAHDI and LibPRI

DAHDI is an addition of tools that allows Asterisk to communicate with analog and digital telephones. The LibPRI library is used to communicate with ISDN connections. If you don’t need these libraries, you can ignore this section.

Run the following commands to compile and build LibPRI:

Install Asterisk on Ubuntu

First, clone the Asterisk source code repository (this may take some time):

At the time of writing this tutorial, the latest version of Asterisk was 18.7.2 which we are going to compile and install.

Next, download the MP3 sources using shell script which is required to build the MP3 module and use MP3 files on Asterisk:

Run the install_prereq script to install the necessary dependencies (this step will also take some time):

In the middle of the process, you will be prompted to input your regional area telephone code:

Input regional area telephone code

When it completes, the output should be:

Now we need to check if all of the dependencies on your system are present in order to compile the source code. Next, run the following command:

In the end, you will be greeted with a nice ASCII Asterisk logo.

Next, select the modules you wish to compile and install. To access menuselect, type the following:

Asterisk module and build option selection

Select the “format_mp3” option in the menu to build the MP3 module. Navigate using the arrow keys then press Enter to select the option. Select any other option you wish to enable. Now press F12 to save and exit the screen.

Select format_mp3 module

You should see a similar terminal output:

To start compiling the source code, run the make command:

Depending on how many CPU cores your computer has, you can adjust the -j parameter to the number of cores your PC has to speed up the compilation time.

If everything was successful, you should get:

Once the compilation is completed, install Asterisk and its modules by typing:

You can install the generic configuration files:

Also, install the basic PBX configuration files:

Lastly, run the following to install the Asterisk init script and update the shared libraries cache:

Create Asterisk User

We’ll create a new system user that Asterisk will run as. Run the following command to create the new user named asterisk :

The output should be:

To configure Asterisk to run as the newly created user, open the /etc/default/asterisk file and uncomment the following two lines near the beginning (delete the # in front of the lines):

Next, add the asterisk user to the following groups:

We also need to change the ownership and of all asterisk files and folders so that Asterisk can access those files:

Running Asterisk

All that’s left to do is to start the Asterisk service with the following command:

Verify that Asterisk is running, by connecting to the Asterisk command-line interface (CLI) by typing:

You should see the output similar to this:

Now enable the service to start on boot:

Configure Firewall

If you have a firewall setup, open HTTP ports and ports 5060,5061:

Conclusion

Congratulations! You have successfully installed and configured the Asterisk server on Ubuntu 20.04


Источник: linoxide.com