Home Cd software How to install the Asterisk VoIP server on Debian 11 | ...

How to install the Asterisk VoIP server on Debian 11 | ten

11
0

In this tutorial, we’ll cover some of the steps and commands for install the Asterisk VoIP server on Debian 11 Bullseye or 10 Buster use the terminal to call on Android or iPhone using 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 wide range of features, so that one can easily implement his own VoIP phone system. Asterisk also supports all currently used protocols such as SIP, IAX2, GSM, G.711 or ISDN. It is very flexible and due to the wide range of functions and the support for many protocols, it becomes a future-proof solution with which almost any telephone infrastructure can be put in place.

The software is integrated with four main modules such as the PBX Switching or Switching Core module. He is responsible for the incoming and outgoing calls and the technologies that work between VoIP and the hardware. Once the calls are accepted, they are forwarded to the Application manager module to perform various actions such as ringing the connected phones or a forwarding function. The Schedule and I / O Manager modules manage different applications and voice channels, such as VoIP channels.

Asterisk is ideal for building a Private Branch Exchange (BX) system often used as a synonym for local telephone systems. The advantage of such a system is that the calls are free for the owner as they are made via the Internet without adding additional stress to any external lines.

Steps to install 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.

Perform system update

Run the system update command to prepare your system before continuing with the installation steps. This will refresh the system’s APT cache and also install if any updates are available for our Debian system.

sudo apt update

Command to install Asterisk on Debian 11 or 10

The best thing is that we don’t need to search for another repository to install the Asterisk packages. They are already in the official Debian repository. Therefore, we just need to use the APT Package Manager to install it.

sudo apt install asterisk asterisk-dahdi

Start, activate and verify the Asterisk service

Well after installation the Asterisk service will start automatically, to confirm it we can use the status command:

systemctl status asterisk

Go out

Start a Linux service with verification asterisk

If it doesn’t work, use this one:

sudo systemctl enable --now asterisk

Additional information:

To start or stop:

sudo systemctl start asterisk 
sudo systemctl stop --now asterisk

Command line asterisk:

To check the version of the asterisk, run:

asterisk -V

to help

asterisk -h

If you get a command not found, run:

echo 'export PATH="$PATH:/user/sbin"' >> ~/.bashrc
newgrp

That’s it, you have successfully installed Asterisk on your Linux Debian 11 or 10, although there are a lot of things a user can configure using it, for that one can refer to the official documents. Here to give you an idea, let’s create some configuration files to make a phone call using Asterisk and Session initiation protocol (SIP).

Use the Asterisk VoIP server to make calls locally with Android or iOS phones

To perform the given demonstration of phone calls using Asterisk, the following should be with you

• A telephone or other system outside the installed Asterisk server
• All devices must be on the same LAN network where Asterisk is located.

We need the asterisk.conf, modules.conf, extensions.conf, and sip.conf or pjsip.conf files to complete this tutorial on building a local VIOP calling system.

Backup files

We already have SIP extension and configuration files under /etc/asterisk. However, as we are going to make some modifications to use them as we wish, so it is better to create a backup of them first. If something is wrong, we can replace the files with the created backup.

Therefore, we simply rename Pjsip or SIP and Extension Configuration files and creation of new files for the configuration of our own local VoIP call network. B

cd /etc/asterisk
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 unscathed for any future use.

Create a SIP configuration on Debian 11 or 10

Now we 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

[1001]
type=friend
context=from-internal
host=dynamic
secret=password
disallow=all
allow=ulaw

[1002]
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, press the Enter key, then use CTRL + X to leave.

Configure the extension

Next is the configuration of the extension file which will tell Asterisk what to do with calls when it receives 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 file above, we tell Asterisk that when someone calls to 1001 where it needs to forward it, the same for 1002. On top of that we have also created an automated answering call / user extension 1000. When someone calls extension 1000, an automatic answer will be played, i.e. Hi world. You can also replace it with an audio file path that you want to play.

Save file Ctrl + O, hit Enter, then Ctrl + X.

Restart the Asterisk server

sudo systemctl restart asterisk

Obtain the IP address of your server:

The IP address or domain of the server will be used to connect VoIP using the SIP calling application. To find the IP address of your Debian runtime:

ip a

Example:

Find the IP address on Debian 11 Bullseye

Install the SIP calling app

Now we have our VoIP server ready with two users / extensions and where to forward them when someone calls.

We use two devices, one is an Android phone and the other is Windows 11 operating system. To make calls we use an open source application called Phone Line. Download and install it on your Mobile or Desktop operating system. Linux users can use the command sudo apt install linephone

Once you install the app on the devices you use, for example for the tutorial, we have an Android and a Windows one.

Log into Android with one of the created users, say 1002:

• Open your LinePhone application
• Select Use SIP account

Connect Android SIP using Android

• Enter your username- 1002
• Password you set for this, here in this tutorial we are using- the password
• For the domain – Add the IP address of your Asterisk server
• Display name – Anything you want to use.
• Transport – UDP

• Press the Log in button.

SIP Asterisk calls Debian 11 Bullseye

Open the Linephone app on Windows or Linux

Now we configure the second device with user 1001.

• Run LinePhone
• Select the SIP account
• Add details – username – 1001 and password,
• Then Domain – the IP address of your Asterisk server
• After that, press the USE button.

Use the SIP account Add an Asterisk user account for the SIP call

After that call 1002 and you will get a ringtone on the LinePhone app of your Android device logged in with user 1002 or vice versa.

Outgoing calls SIP call in progress on Debian 11

In this way, we can create our own VoIP server using Asterisk and call for free over a local network or the Internet.

Other tutorials:

• 3 ways to install Skype in Ubuntu 20.04 LTS
• How to install MySQL 8.0 Server on Debian 11
• Install the Stremio application on Debian 11 Bullseye
• How to install phpMyAdmin on Debian 11 Bullseye


Source link