✅ Requirements:
- Ubuntu 20.04 or 22.04 (works on most recent LTS versions)
- Root or sudo access
- Basic Linux command-line knowledge
🥇 Step 1: Update the System
sudo apt update && sudo apt upgrade -y
🥈 Step 2: Install Dependencies
sudo apt install -y build-essential git wget subversion \
libxml2-dev libncurses5-dev uuid-dev libjansson-dev \
libssl-dev libsqlite3-dev
🥉 Step 3: Download and Compile Asterisk
cd /usr/src
sudo git clone -b 20 https://github.com/asterisk/asterisk.git
cd asterisk
sudo contrib/scripts/install_prereq install
sudo ./configure
sudo make menuselect
- In
menuselect
, you can choose modules likeres_srtp
,chan_sip
,pjproject
, etc. - Press
Save & Exit
Then compile and install:
sudo make -j$(nproc)
sudo make install
sudo make samples
sudo make config
sudo ldconfig
🏁 Step 4: Start Asterisk
sudo systemctl start asterisk
sudo systemctl enable asterisk
Test the CLI:
sudo asterisk -rvvv
📁 Key Configuration Files
File | Description |
---|---|
/etc/asterisk/sip.conf | SIP user/peer configuration |
/etc/asterisk/extensions.conf | Dialplan logic |
/etc/asterisk/voicemail.conf | Voicemail settings |
/var/log/asterisk/ | Log files |
/var/lib/asterisk/sounds/ | Default sounds |
☎️ Simple Example: Adding Two SIP Extensions
sip.conf
[general]
context=default
bindport=5060
bindaddr=0.0.0.0
[1000]
type=friend
secret=pass1000
host=dynamic
context=internal
[1001]
type=friend
secret=pass1001
host=dynamic
context=internal
extensions.conf
[internal]
exten => 1000,1,Dial(SIP/1000)
exten => 1001,1,Dial(SIP/1001)
🧪 Test It
- Use Zoiper, Linphone, or MicroSIP on two PCs/phones.
- Register accounts 1000 and 1001.
- Call from one to the other.
📚 Further Learning Resources
- 📖 Asterisk Wiki
- 📘 The Asterisk: Definitive Guide
- 🎥 YouTube Channels: “Crosstalk Solutions”, “FreePBX Demos”
Would you like a tutorial for:
- 🧱 FreePBX (GUI for Asterisk)?
- 📞 Asterisk with WebRTC?
- ☁️ Hosting on a cloud VPS?