How to Install Asterisk on Ubuntu 24.04 (2025 Step-by-Step Guide)

Parlona Blog

How to Install Asterisk on Ubuntu 24.04 (2025 Step-by-Step Guide)

February 11, 2025

AsteriskUbuntuPBXVoIPSIPPJSIPTelephony

If you're building a VoIP system, PBX, call center, or AI-powered call analytics platform, Asterisk remains the most reliable and flexible telephony engine. In this guide, you'll learn how to install Asterisk on Ubuntu 24.04, configure the basics, and prepare your server for SIP endpoints, call forwarding, call recording, and integrations with AI services.


⭐ Why Asterisk Is Still the Best PBX in 2025

Asterisk continues to dominate the open-source telephony world because it offers:

  • Full control over call routing
  • Native support for SIP, PJSIP, IVR, queues, recording, and WebRTC
  • Excellent compatibility with AI receptionists, STT, and call analytics
  • Free and open-source licensing
  • A huge community and long-term support

If you plan to use AI call transcription, AI summaries, or AI receptionists, Asterisk is the perfect starting point.


📦 Step 1: Update Ubuntu and Install Required Packages

Update your system:

sudo apt update && sudo apt upgrade -y

Install build tools and dependencies:

sudo apt install -y build-essential libssl-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev

📥 Step 2: Download the Latest Version of Asterisk

Move to the source directory:

cd /usr/src

Download the current Asterisk release:

wget https://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-latest.tar.gz

Extract it:

tar xzf asterisk-latest.tar.gz
cd asterisk-20*

🧩 Step 3: Install Optional Add-ons (e.g., MP3 Support)

Some prompts require MP3 support:

sudo contrib/scripts/get_mp3_source.sh

Install prerequisites:

sudo contrib/scripts/install_prereq install

⚙ Step 4: Build and Install Asterisk

Run the configure script:

./configure

Choose additional modules:

make menuselect

Useful options:

  • format_mp3
  • chan_pjsip
  • res_http_websocket

Then compile and install:

make
sudo make install
sudo make samples
sudo make config
sudo ldconfig

▶ Step 5: Start and Enable Asterisk Service

Enable autostart:

sudo systemctl enable asterisk

Start the service:

sudo systemctl start asterisk

Check the status:

sudo systemctl status asterisk

Open the CLI:

sudo asterisk -rvvvv

You should see the Asterisk CLI prompt:

asterisk@localhost*CLI>

🔧 Step 6: Basic PJSIP Configuration

Edit the PJSIP config:

sudo nano /etc/asterisk/pjsip.conf

Minimal example:

[6001]
type = endpoint
context = default
disallow = all
allow = opus,ulaw
auth = 6001
aors = 6001

[6001]
type = auth
auth_type = userpass
username = 6001
password = strongpassword

[6001]
type = aor
max_contacts = 1

📞 Step 7: Create a Simple Dialplan

Edit:

sudo nano /etc/asterisk/extensions.conf

Add:

[default]
exten => 100,1,Answer()
 same => n,Playback(hello-world)
 same => n,Hangup()

Reload Asterisk:

sudo asterisk -rx "dialplan reload"

🔒 Step 8: Secure Your Asterisk Installation

Security is essential for production.

Firewall rules:

sudo ufw allow 5060/udp
sudo ufw allow 10000:20000/udp
sudo ufw enable

Recommended additional steps:

  • Enable Fail2Ban
  • Use TLS + SRTP
  • Disable guest calls (
    allowguest=no
    )
  • Change SIP port from default 5060 to reduce scanning

A dedicated security guide will follow soon.


🚀 What You Can Build With This Setup

Once Asterisk is installed, you can build:

  • AI receptionist that answers calls automatically
  • Real-time call transcription pipelines
  • Call analytics dashboards (Supabase + Next.js)
  • Lead qualification logic
  • Advanced routing (to internal extensions or mobile phones)
  • WebRTC-based softphone and call widgets

These topics will be covered in future posts.


✅ Conclusion

You now have a complete installation of Asterisk on Ubuntu 24.04, ready for SIP endpoints, call routing, and integrations with AI-powered telephony systems.

Next recommended guides:

  • How to Configure PJSIP Endpoints (2025 Guide)
  • How to Enable OPUS Codec for Better Audio Quality
  • Building Real-Time STT for Asterisk Using Whisper

Contact Us

Parlona Logo