This blog post will explain how to install the Asterisk phone system on Debian 12. This blog post assumes that a user is logged in as root.
First, the system needs to be updated.
apt update
Then the system needs to be upgraded.
apt upgrade
Install these dependencies below with the apt install command. They are required packages that Asterisk needs installed.
| build-essential |
| libedit-dev |
| libjansson-dev |
| libncurses5-dev |
| libsqlite3-dev |
| libssl-dev |
| libxml2-dev |
| pkg-config |
| subversion |
| uuid-dev |
| wget |
Apparmor is known to interfere with Asterisk so use the commands below to stop and
remove apparmor.
systemctl stop apparmor
apt remove apparmor
Download the source code archive from the link below. Copy that file to the
/usr/src directory.
http://downloads.asterisk.org/pub/telephony/asterisk
That archive contents are extracted into a directory. Navigate to the resulting directory.
cd /usr/src
tar zxvf asterisk-22-current.tar.gz
cd asterisk-22.*
The build environment has to be built with the configure command. The command make menuselect configures certain types of features before compilation. The source code needs to be compiled with the make command.
./configure
make menuselect
make
Asterisk needs to be installed.
make install
Asterisk needs to be configured to be ran at startup.
make config
Setup a dedicated user and group to use Asterisk.
groupadd asterisk
useradd -r -d /var/lib/asterisk -g asterisk asterisk
chown -R asterisk:asterisk /etc/asterisk /var/{lib,log,spool}/asterisk /usr/lib/asterisk
Open the file /etc/default/asterisk and uncomment these lines below.
AST_USER="asterisk"
AST_GROUP="asterisk"
Use this command below to install Asterisk as a Debian service.
systemctl enable asterisk.service
Use this command below to start Asterisk.
systemctl start asterisk.service
After Asterisk is installed, there are some ports that need to be opened.
| PORT | PROTOCOL |
| TCP 5060 | Used for SIP(session initiation protocol). That protocol is essential for initiating and terminating VoIP calls. |
| UDP 10000-20000 | Used for RTP(real time transport protocol). That protocol is essential for audio to be sent to and from endpoints. |
| TCP 80 | Used for HTTP(hypertext transfer protocol). That protocol is essential for web based front ends for servers such as Asterisk and FreeSwitch. |
