In this tutorial we are going to discuss some of the steps and commands to do Install the Asterisk VoIP server on Debian 11 Bullseye or 10 Buster call with the terminal via Android or iPhone over a local network.
What is Asterisk Software for Linux?
Asterisk is an open source software based phone system available to install and work on Linux distributions. It offers a variety of functions so that you can easily implement your own VoIP telephone system. Asterisk also supports all currently used protocols such as SIP, IAX2, GSM, G.711 or ISDN. It is highly flexible and, thanks to the huge range of functions and the support of many protocols, becomes a future-proof solution with which almost any telephone infrastructure can be set up.
The software is built with four main modules like the PBX switching or switching core module – it is responsible for incoming and outgoing calls and technologies that work between VoIP and hardware. As soon as the calls have been accepted, they are forwarded to the Application Manager module in order to carry out various actions such as ringing connected telephones or a forwarding function. the Schedule and I / O manager modules manage the various applications and voice channels, e.g. B. VoIP channels.
Asterisk is ideal for setting up BX (Private Branch Exchange) systems, which are often used synonymously for local telephone systems. The advantage of such a system is that the calls are free for the owner as they are made over the Internet without any additional burden on all trunk lines.
Steps to install the Asterisk VoIP server on Debian 11 Bullseye
The given steps will work on Debian 10 Buster or 11 Bullseye, including Ubuntu 18.04 / 20.04 / 22.04, Linux Mint and other Debian based systems.
Carry out a system update
Run the System Update command to prepare your system before proceeding with the installation steps. This will update the system’s APT cache and also install it if updates are available for our Debian system.
sudo apt update
Command to install Asterisk on Debian 11 or 10
Best of all, we don’t have to look for another repository to install Asterisk’s packages. They are already in the official Debian repository. So we just need to use the APT package manager to install the same thing.
sudo apt install asterisk asterisk-dahdi
Start, activate and check Asterisk service
Well, after the installation, Asterisk will start the service automatically, to confirm this we can use the status command:
systemctl status asterisk
In case it doesn’t run, use this:
sudo systemctl enable --now asterisk
To start or stop:
sudo systemctl start asterisk sudo systemctl stop --now asterisk
Asterisk command line:
To check the version of asterisks, do the following:
If the command is not found, do the following:
echo 'export PATH="$PATH:/user/sbin"' >> ~/.bashrc newgrp
That’s it, you have successfully installed Asterisk on your Debian 11 or 10 Linux, although there are many things a user can configure with it official documentation. To give you an idea, let’s create some configuration files to use to make a phone call asterisk and Session Initiation Protocol (SIP).
Use the Asterisk VoIP server to make local calls with Android or iOS phones
To do the given demo of phone calls with Asterisk, the following things should be with you
• A phone or other system besides the server installed by Asterisk
• All devices should be in the same LAN network that Asterisk is on.
We need the files asterisk.conf, modules.conf, extensions.conf and sip.conf or pjsip.conf in order to carry out this tutorial for creating a local VIOP calling system.
We already have extension and SIP configuration files under
/etc/asterisk. However, since we are going to make some changes to use at our discretion, it is therefore better to backup them first. If something goes wrong, we can replace the files with a backup made.
So we’re just renaming Pjsip or SIP and renewal Configuration files and creating new ones for setting up our own local VoIP telephone network. B.
sudo mv extensions.conf extensions.sample sudo mv sip.conf sip.conf.sample
This way we have saved our original copies of the configuration files intact for future use.
Create a SIP configuration on Debian 11 or 10
Now let’s create our own SIP configuration file for use with the local network.
sudo nano /etc/asterisk/sip.conf
Add the following lines:
[general] context=default  type=friend context=from-internal host=dynamic secret=password disallow=all allow=ulaw  type=friend context=from-internal host=dynamic secret=password disallow=all allow=ulaw
In the file we create two user accounts / extensions – 1001 and 1002 and the secret value is the password for them.
Save the file by pressing CTRL + O, hit them Enter Button and then use CTRL + X break up.
Next up is the configuration of the extension file that tells Asterisk what to do with calls when it comes in for a particular user.
sudo nano /etc/asterisk/extensions.conf
Add the following text:
[from-internal] exten=>1001,1,Dial(SIP/1001,20) exten=>1002,1,Dial(SIP/1002,20) exten = 1000,1,Answer() same = n,Wait(1) same = n,Playback(hello-world) same = n,Hangup()
In the above file we tell Asterisk that when someone calls 1001 where to forward it to, in the same way for 1002. In addition, we have also created an automatic call answering extension / user 1000. When someone calls extension 1000, an automatic answer is played, e.g. Hello World. You can also replace it with an audio file path that you want to play.
Save the file Ctrl + O, Blow Enter, and then Ctrl + X.
Restart the Asterisk server
sudo systemctl restart asterisk
Get your server IP address:
The server IP address or domain used to connect VoIP to the SIP calling app. How to find the IP of your Debian run:
Install the SIP calling app
Now we have our VoIP server with two users / extensions ready and where to forward them when someone calls.
We use two devices, one is an Android phone and the other is a Windows 11 operating system. We use an open source app called Line Telephone. Download and install it on your mobile or desktop operating system. The Linux users can use the command
sudo apt install linephone
As soon as you have installed the app on the devices you are using, for example for the tutorial, we have an Android and Windows.
Log into Android with one of the users created, say 1002:
• Open your LinePhone app
• Select Use SIP Account
• Enter username- 1002
• Password that you have set for it, here in this tutorial we have user password
• For Domain- Add the IP address of your Asterisk server
• Friendly Name – Whatever you want to use.
• Transport – UDP
• Hit the Sign up Button.
Open the Linephone app on Windows or Linux
Now we configure the second device with the user 1001.
• Run LinePhone
• Select SIP account
• Add the details – Username – 1001 and his password,
• Then Domain – the IP address of your Asterisk server
• Then press the USE Button.
Then call 1002 and you will receive a ringtone on your Android device LinePhone app, to which you are logged in with the 1002 user or vice versa.
In this way we can create our own VoIP server with Asterisk and make free calls over the local or Internet network.
• 3 ways to install Skype in Ubuntu 20.04 LTS
• How to install MySQL 8.0 Server on Debian 11
• Install the Stremio app on Debian 11 Bullseye
• How to install phpMyAdmin on Debian 11 Bullseye