How to install Asterisk 17 on Debian 10

Asterisk is a open source PBX software. It is used to manage SIP sessions between endpoints. It 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 analogue cards, PRI cards, etc.

Today we will be installing Asterisk 17.1.0, which is the latest Asterisk release at the time of writing. It is the standard release meaning that it will receive regular updates which will focus more on new features and a little less on fixes. If you want a more stable framework we would recommend you to install Asterisk version with LTS(Long Term Support). They focus mainly on stability and user experience and not on the latest features that standard edition brings. Nonetheless, let us begin with the installation.

Step 1: Pre-Requisites


Before we begin with the Asterisk 17 installation, we need to make sure that our packages are up to date.

apt update && apt upgarde

Now we need to install some extra packages which will fulfill all the dependencies needed by Asterisk 17.

apt install gcc wget g++ make patch libedit-dev uuid-dev  libxml2-dev libsqlite3-dev openssl libssl-dev bzip2

Next we will download the Asterisk 17 tarball from the official website, in /usr/src directory.

cd /usr/src/ && wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-17-current.tar.gz 

Untar the tarball we just downloaded

tar -xzvf asterisk-17-current.tar.gz

Note – If you want to compile Dahdi alongside asterisk then follow the optional dahdi installation steps before proceeding to the next steps.


Switch to the extracted directory. Here our Asterisk version is 17.1.0. Yours might be different

cd asterisk-17.1.0/

Step 2: Configuration


Since we have already installed the required packages, now we will run the configure script using the following command.

./configure  --with-jansson-bundled 

This configure script will check our system for the dependencies of the different modules of the asterisk. If the dependencies are satisfied then it will allow us to install them.

The output should be similar as shown above. It will mean that our system is ready for Asterisk installation.

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.

make menuselect
You should now see the menu as shown above. You can navigate using the arrow keys and select/deselect using the spacebar.

Note – If you have compiled Dahdi then make sure that chan_dahdi option is selected in the Channel Drivers menu


You can enable/disable the modules that you wish to compile alongside the core of asterisk.

Step 3: Compiling


Now we will compile Asterisk with the modules that we have selected. This process will take some time depending on you operating system resources.

make && make install

Now we have installed Asterisk and will generate the sample configuration files for the Asterisk using the following command.

make samples

The above command will make sample config files which can act as a base for your application under /etc/asterisk/ directory.

Also we need to install asterisk init script

make config

Now we will start the asterisk service.

systemctl start asterisk

We will also make sure that asterisk will start on system boot

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.

asterisk -rvvv

Note – If you have installed Dahdi as well, then to make sure it is working properly we can use the following command in asterisk CLI to confirm it.

dahdi show status

You should see the above table. Our table is currently empty as we don’t have any physical device connected.

If for some reason the above command does not work, it is possible the asterisk didn’t load the dahdi module. To load the module use the following command and try the above command again.

 module load chan_dahdi.so 

Now asterisk is properly compiled and running. You can now start working on the config files to build your application. Asterisk usually stares all the config files under asterisk folder in /etc/asterisk/.

cd /etc/asterisk

Here you can see all the config files that we can use for our asterisk application.

To stop asterisk service, we will connect to the asterisk CLI and use the following commands.

core stop now
core stop gracefully
core stop when convenient

core stop now – It will stop asterisk service immediately.

core stop gracefully – it will wait for any pending tasks to finish before stopping the asterisk service.

core stop when convenient – it does not prevent new tasks but allow them and will only stop the service when there is no activity.

Similarly, there are commands to restart Asterisk service as well.

core restart now
core restart gracefully
core restart when convenient

These commands are similar to the stop command but instead of stopping they restart the service.

You can still stop or restart asterisk service via init.d .

systemctl restart asterisk

Now, you have successfully installed your asterisk 17 server on Debian 10.

Optional: Installing DAHDI


DAHDI stands for Digium Asterisk Hardware Device Interface. As the name suggests it is the bundle which includes tools and drivers which are used to interface with a variety of telephony hardware. You can find the list of compatible hardware here.

We will first download the dahdi complete tarball from the official website. This tarball includes both the tools and drivers required for the DAHDI.

cd /usr/src/ && wget https://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz

Now we will untar the tarball we just downloaded

tar -zxvf dahdi*

Dahdi has some dependencies that we need to satisfy before we could start with our installation.

apt install linux-headers-$(uname -r) libxml2 libssl-dev libncurses5 libncurses5-dev libnewt0.52 libnewt-dev vim-nox dh-autoreconf  autogen libtool shtool libglib2.0-dev 

Now switch to the extracted directory. Our version is 3.1.0. Yours might be different.

cd dahdi-linux-complete-3.1.0+3.1.0 

Now by using the following commands we will compile the DAHDI source code and will move the files to the respective location for it to work properly. It will also generate a config for the connected devices if any.

make && make install && make install-config

You should see the result similar to as shown above. If you have Dahdi device connected, it will identify it and configure it.

Now we will start the dahdi service.

systemctl start dahdi
systemctl enable dahdi

Now you have to compile the asterisk core. You can follow the steps starting from Step 2: Configuration.


If you have any question or want to provide feedback please leave a comment in the comment section.

3 Replies to “How to install Asterisk 17 on Debian 10”

Leave a Reply

Your email address will not be published. Required fields are marked *