This guide shows how to install Asterisk 22 LTS on Debian 13 from source and make the first call between two softphones. Asterisk is the open-source PBX engine behind FreePBX, Issabel and many hosted phone systems. Asterisk 22 is a long-term support branch, released in October 2024 and supported until October 2029, so it is still a sound choice for a new server. Asterisk 24 LTS was released on 5 November 2026, and Asterisk 20 LTS moved to security-fix-only status in October 2026.
Short answer: On a fresh Debian 13 server, download asterisk-22-current.tar.gz, run contrib/scripts/install_prereq install, then ./configure --with-jansson-bundled, make menuselect, make && make install && make samples && make config. Create an asterisk user, set it in asterisk.conf, start the service, add PJSIP endpoints and a dialplan, and open UDP 5060 plus the RTP range only to trusted networks. (Reviewed November 2026.)
Table of Contents
Before you start
| Item | Recommendation |
|---|---|
| Server | Debian 13 minimal install, 2 vCPU, 2–4 GB RAM, 20 GB disk for a small office |
| Network | Static IP; if behind NAT, a known public IP or DNS name |
| Access | SSH as a sudo user; run the commands below as root |
| Phones | Two SIP softphones or desk phones for testing |
Asterisk 22, 23 or 24?
Asterisk alternates long-term support (LTS) and standard releases. An LTS branch gets four years of full support and then one year of security fixes only. Dates from the Asterisk project:
| Branch | Type | Released | Security fixes only from | End of life |
|---|---|---|---|---|
| 20 | LTS | 2022-10-19 | 2026-10-19 | 2027-10-19 |
| 22 | LTS | 2024-10-16 | 2028-10-16 | 2029-10-16 |
| 23 | Standard | 2025-10-15 | 2026-10-15 | 2027-10-15 |
| 24 | LTS | 2026-11-05 | 2030-10-15 | 2031-10-15 |
20 and 23 already receive security fixes only, so neither suits a new server. Choose 22 if you want a branch with two years of bug-fix releases behind it, or 24 if the longest support window matters more than maturity. This guide covers 22.
Step 1: update and download the source
apt update && apt -y full-upgrade
apt -y install wget build-essential
cd /usr/src
wget https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-22-current.tar.gz
tar xzf asterisk-22-current.tar.gz
cd asterisk-22.*/
To check the download, fetch the matching checksum file and compare the two hashes. The checksum file names the versioned tarball (for example asterisk-22.12.0.tar.gz) rather than the -current name, so sha256sum -c cannot find the file:
cd /usr/src
wget https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-22-current.sha256
cat asterisk-22-current.sha256
sha256sum asterisk-22-current.tar.gz # the two hashes must match
cd /usr/src/asterisk-22.*/ # back into the source folder for Step 2
Step 2: install build dependencies
Asterisk ships a script that installs every package it needs for the detected distribution. Run it, and every command up to Step 4, from inside the extracted source folder (for example /usr/src/asterisk-22.12.0); pwd should show that folder before you start:
contrib/scripts/install_prereq install
contrib/scripts/get_mp3_source.sh # optional: MP3 music on hold
The script ends with “install completed successfully”. If it asks for a country code, enter your ITU-T country calling code.
To see what the script would install before it changes anything, run contrib/scripts/install_prereq test. On Debian it installs aptitude first if it is missing, then uses it to add the packages.
Step 3: configure, choose modules and build
./configure --with-jansson-bundled
make menuselect
In menuselect, keep the defaults and add what you need: format_mp3 under Add-ons if you downloaded the MP3 source, extra sound packs (for example CORE-SOUNDS-EN-WAV and MOH-OPSOUND-WAV) and codecs. chan_sip no longer exists in Asterisk 21 and later; PJSIP (chan_pjsip) is the SIP channel driver. Save and exit with x, then build:
make -j"$(nproc)"
make install
make samples # sample configs in /etc/asterisk (useful as reference)
make config # installs the systemd/init service
make install-logrotate
ldconfig
To script the module choices on another server, replace make menuselect (after ./configure) with the command-line form. --list-options shows the exact names you can enable:
make menuselect.makeopts
menuselect/menuselect --list-options | less
menuselect/menuselect --enable format_mp3 menuselect.makeopts
Step 4: run Asterisk as a non-root user
groupadd asterisk
useradd -r -d /var/lib/asterisk -g asterisk asterisk
usermod -aG audio,dialout asterisk
chown -R asterisk:asterisk /etc/asterisk /var/{lib,log,spool}/asterisk /usr/lib/asterisk
sed -i 's/^;runuser = asterisk/runuser = asterisk/; s/^;rungroup = asterisk/rungroup = asterisk/' /etc/asterisk/asterisk.conf
systemctl enable --now asterisk
asterisk -rvvv
The console prompt shows the running version. Type core show version to confirm it reads Asterisk 22, and exit to leave the console without stopping the service.
Step 5: create two PJSIP extensions
Keep the sample file for reference and start a clean /etc/asterisk/pjsip.conf:
mv /etc/asterisk/pjsip.conf /etc/asterisk/pjsip.conf.sample
cat > /etc/asterisk/pjsip.conf <<'EOF'
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
; behind NAT, uncomment and set your addresses
;external_media_address=203.0.113.10
;external_signaling_address=203.0.113.10
;local_net=192.168.1.0/24
[endpoint-template](!)
type=endpoint
context=internal
disallow=all
allow=g722,ulaw,alaw
direct_media=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
[1001](endpoint-template)
auth=1001-auth
aors=1001
[1001-auth]
type=auth
auth_type=userpass
username=1001
password=ChangeMe-Long-Random-1
[1001]
type=aor
max_contacts=2
[1002](endpoint-template)
auth=1002-auth
aors=1002
[1002-auth]
type=auth
auth_type=userpass
username=1002
password=ChangeMe-Long-Random-2
[1002]
type=aor
max_contacts=2
EOF
Use long random passwords. SIP scanners try weak extension passwords within minutes of a server going online.
Step 6: a minimal dialplan
mv /etc/asterisk/extensions.conf /etc/asterisk/extensions.conf.sample
cat > /etc/asterisk/extensions.conf <<'EOF'
[internal]
exten => _10XX,1,NoOp(Internal call to ${EXTEN})
same => n,Dial(PJSIP/${EXTEN},30)
same => n,Hangup()
exten => 600,1,Answer()
same => n,Playback(demo-echotest)
same => n,Echo()
same => n,Hangup()
EOF
chown asterisk:asterisk /etc/asterisk/*.conf
chmod 750 /etc/asterisk
chmod 640 /etc/asterisk/pjsip.conf # holds the SIP passwords
systemctl restart asterisk # first time: loads the new UDP transport
asterisk -rx "pjsip show transports"
asterisk -rx "pjsip show endpoints"
Restart rather than reload the first time. A reload does not reliably create or change [transport] sections (their allow_reload option defaults to no), and nothing is in a call yet. Later changes to endpoints, auth or the dialplan only need asterisk -rx "pjsip reload" or dialplan reload; any later transport change needs a restart in a quiet period. pjsip.conf holds every extension password, so keep it readable only by root and the asterisk group.
Register one softphone as 1001 and another as 1002 to the server IP on port 5060. Dial 600 for the echo test, then call 1002 from 1001. If calls connect with no audio, work through the one-way audio guide; it is almost always NAT or the RTP range.
Step 7: firewall and security
Asterisk uses UDP 5060 for SIP signalling and UDP 10000–20000 for RTP media by default (set in rtp.conf). Allow SIP only from your office network and SIP trunk provider where possible.
If the server already has a firewall (ufw, firewalld, a hosting provider’s cloud firewall), add the SIP and RTP rules there instead. On a server with no firewall yet, the complete nftables file below drops everything not listed, and the nftables service loads it at every boot. It replaces the whole ruleset, so work from the provider’s console or keep a second SSH session open, and set your own admin network on the SSH line before you load it:
apt -y install nftables fail2ban
cp /etc/nftables.conf /etc/nftables.conf.orig
cat > /etc/nftables.conf <<'EOF'
#!/usr/sbin/nft -f
flush ruleset
table inet filter {
chain input {
type filter hook input priority filter; policy drop;
ct state established,related accept
ct state invalid drop
iif "lo" accept
meta l4proto { icmp, ipv6-icmp } accept
ip saddr 198.51.100.0/24 tcp dport 22 accept # SSH from your admin network
ip saddr { 198.51.100.0/24, 192.0.2.0/24 } udp dport 5060 accept # office + SIP provider
udp dport 10000-20000 accept # RTP media
}
chain forward { type filter hook forward priority filter; policy drop; }
chain output { type filter hook output priority filter; policy accept; }
}
EOF
nft -c -f /etc/nftables.conf # syntax check only, changes nothing
systemctl enable nftables
systemctl restart nftables
systemctl restart fail2ban # flush ruleset also removed fail2ban's own table
nft list ruleset
Open a new SSH session before closing the old one. If it fails, restore the previous file with cp /etc/nftables.conf.orig /etc/nftables.conf && systemctl restart nftables from the session that is still open.
Enable the asterisk jail in fail2ban so repeated failed registrations are banned, and never let unauthenticated inbound calls land in a context that can dial out. Add an outbound SIP trunk only after these rules are in place.
Check the jail’s log path. fail2ban’s stock [asterisk] jail reads /var/log/asterisk/messages, but the Asterisk 22 sample logger.conf writes to /var/log/asterisk/messages.log, so the jail would watch a file that never fills. Point it at the right file in /etc/fail2ban/jail.local:
[asterisk]
enabled = true
logpath = /var/log/asterisk/messages.log
Then run systemctl restart fail2ban and fail2ban-client status asterisk to confirm the jail is running and reading the file.
Step 8: check the installation
systemctl status asterisk --no-pager
ss -ulpn | grep 5060 # Asterisk listening on UDP 5060
asterisk -rx "pjsip show transports" # transport-udp loaded
asterisk -rx "pjsip show endpoints" # 1001 and 1002 listed
asterisk -rx "pjsip show contacts" # registered phones appear here
asterisk -rx "pjsip show endpoint 1001" # Aor and Contact lines for one extension
tail -f /var/log/asterisk/messages.log
An endpoint with an Aor line but no Contact line has not registered yet. A failed registration shows up in messages.log as a NOTICE such as Request 'REGISTER' from ... failed for ... - Failed to authenticate (wrong password) or No matching endpoint found (wrong username or extension).
Common problems after install
- “Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)” means Asterisk is not running, so
asterisk -rhas nothing to attach to. Checksystemctl status asteriskandjournalctl -u asterisk. If it stopped after the switch to theasteriskuser, look for “Permission denied” and check the ownership of the directories from Step 4. ./configurestops on a missing library: runinstall_prereq installagain and re-run./configure. The last lines ofconfig.logname the check that failed.- An extension is missing from
pjsip show endpoints: a section withouttype=endpointis ignored, so check the template name in brackets and runpjsip reloadafter changes. - Calls connect but RTP never arrives: check that
rtp.confstill exists. Without it Asterisk uses its built-in range of 5000–31000, which the 10000–20000 firewall rule does not cover.
Update to a newer 22.x release
Point releases within branch 22 bring bug and security fixes. Read the new version’s change log, back up first, reuse your old menuselect.makeopts, and do not run make samples again: it overwrites the files in /etc/asterisk.
tar czf /root/asterisk-etc-$(date +%F).tar.gz /etc/asterisk
asterisk -rx "core show version" # note the running version
cd /usr/src
wget -O asterisk-22-update.tar.gz https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-22-current.tar.gz
wget -O asterisk-22-update.sha256 https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-22-current.sha256
cat asterisk-22-update.sha256; sha256sum asterisk-22-update.tar.gz # hashes must match
NEW=$(tar tzf asterisk-22-update.tar.gz | head -1 | cut -d/ -f1)
echo "$NEW" # must be newer than the running version
tar xzf asterisk-22-update.tar.gz
cd "/usr/src/$NEW" && pwd
cp /usr/src/asterisk-22.OLD/menuselect.makeopts . # your previous build folder
./configure --with-jansson-bundled
make -j"$(nproc)" && make install
systemctl restart asterisk
wget -O writes to a fixed file name, so a second download replaces the first instead of being saved as asterisk-22-current.tar.gz.1 while an old archive is extracted. Reading the folder name from the archive itself means you build the release you just checked. The restart drops calls in progress, so do it in a quiet period. Moving to Asterisk 24 is a major upgrade, not an update: read the “Upgrade Notes” in the change logs under ChangeLogs/ in the new source, and try it on a test server first.
Install Asterisk 22 at a glance


Official documentation: Asterisk documentation, Asterisk downloads, res_pjsip transport options, Debian nftables wiki.
Related guides: SIP ports and firewall rules · Fix one-way audio on VoIP calls · Disable SIP ALG on your router · Install FusionPBX on Debian 12.
Frequently asked questions
Which Asterisk version should I install in 2026?
Asterisk 22 LTS for new servers. It is supported until October 2029. Asterisk 23 is a standard release with a shorter support window, and Asterisk 24 LTS was released on 5 November 2026.
Why is chan_sip missing?
chan_sip was deprecated for years and removed in Asterisk 21. Use chan_pjsip with pjsip.conf; the sip_to_pjsip conversion script in contrib/scripts can turn an old sip.conf into a starting point.
Do I need FreePBX to use Asterisk?
No. Asterisk runs with plain text configuration files as shown here. FreePBX or Issabel add a web interface on top, which suits teams that prefer not to edit configuration files.
Can I install Asterisk 22 from the Debian 13 repositories?
No. Debian 13 (trixie) has no asterisk package; in November 2026 it is only in Debian testing and unstable. Build it from source as shown in this guide.
How do I upgrade from Asterisk 22 to Asterisk 24?
Treat it as a major upgrade. Read the Upgrade Notes in the change logs for the versions in between, install 24 on a test server, copy your configuration across and test it before you switch. A menuselect.makeopts file from 22 may not work for 24.
