Installing Asterisk on Debian

In this guide, we explain how to install and setup Asterisk on a Debian 11.1 server. Connect a soft-phone to an Asterisk server for a great VOIP solution.

1. Download and Install Asterisk & dependencies

Simply use the package manager in your operating system to install Asterisk, DAHDI, and libpri. Most modern Linux distributions such as Debian, Ubuntu, and Fedora have these packages in their repositories.

$ sudo apt-get install asterisk dahdi libpri1.4

So, say yes to the installation and let it run through, this process will install the application along with all the necessary dependencies and configuration files.

Once installed, confirm the configuration files have populated /etc/asterisk

$ ls /etc/asterisk

2. Configuration

This article includes an example configuration. It’s a very basic setup to demonstrate how it can be configured.

Please Note: Its advised to backup and move the default configuration files into a separate location then create new blank configs for your desired setup. Do this by running the following commands:

$ mv extensions.conf extensions.sample
$ vim extensions.conf

A brief break-down of the configuration files and their relevant functions:

asterisk.conf – asterisks main configuration

extensions.conf – bind and configure routes and extensions. Example:

exten = 100,1,Answer()
same = n,Wait(1)
same = n,Playback(hello-world)
same = n,Hangup()

When a phone dials extension 100, we are telling Asterisk to Answer the call, Wait one second, then Play (Playback) a sound file (hello-world) to the channel and Hang-up.

Sip.conf – SIP Channel driver configuration. Example:



So, now the Pjsip.conf – SIP Channel driver configuration. Example:





Then, restart the service if changes to the configuration have been made.

$ asterisk -rx "core restart now"

Verify Asterisks successful installation by checking the system’s service:

$ sudo systemctl status asterisk

f you can see it’s running like above then you have successfully installed the application, ready for it to be tested.

4. Testing the application

Testing your setup on a softphone:

In this example, we’ll use Zoiper. Configure a new SIP account with the following details:

  1. Once Zoiper is opened, click the wrench icon to get to settings.
  2. Click “Add new SIP account”
  3. 6001 for the account name, click OK
  4. Enter the IP address of your Asterisk system in the Domain field
  5. 6001 in the Username field
  6. Enter your SIP peer’s password in the Password field
  7. Enter whatever you like in Caller ID Name or leave it blank
  8. Click OK

Make the call:

Go back to the main Zoiper interface, and make sure the account is registered. Select the account from the drop-down list and click the Register button next to it. If it says registered, you are good to go. If it doesn’t register, then double-check your configuration.

Once registered, enter extension 100 and click the Dial button. The call should be made and you should hear the sound file hello-world!

Unix/Linux Guru and FOSS supporter


Please enter your comment!
Please enter your name here

Latest articles

You might also likeRELATED

How to Install and Configure VNC on Ubuntu Server 20.04

This article will show you how to set up a VNC on Ubuntu Server 20.04. Virtual Network Computing (VNC) is a graphical desktop sharing technology...

How to Export Your Servers Logs with Rsyslog in Centos 8

In this post, you will learn how to Export Your Servers Logs with Rsyslog in Centos 8 In this article, we'll walk through setting up...

How To Setup a Counter Strike: Global Offensive Server on CentOS 8

Counter-Strikes first option is a feature called "Official Matchmaking." This selects a Steam-owned server near you where you can play against players from all...