Skip to content
Back to Blog
DevOps

Enterprise VoIP with Asterisk FreePBX: Full Setup Guide

Deploy a production VoIP system with Asterisk FreePBX: SIP trunks, extensions, IVR, call queues, and recording.

Aug 2025
20 min read

Enterprise VoIP with Asterisk FreePBX

Asterisk FreePBX is the most deployed open-source PBX. This guide covers a production deployment with SIP trunks, IVR, and call queues.

Installation (Ubuntu 22.04)

BASH
# FreePBX installer
wget https://github.com/FreePBX/sng_freepbx_debian_install/raw/master/sng_freepbx_debian_install.sh
chmod +x sng_freepbx_debian_install.sh
sudo bash ./sng_freepbx_debian_install.sh

SIP Trunk Configuration

In FreePBX Admin → Connectivity → Trunks → Add SIP Trunk:

TEXT
Trunk Name: ISP-SIP-Trunk
Peer Details:
  host=sip.yourprovider.com
  type=friend
  secret=SIPpassword123
  context=from-trunk
  dtmfmode=rfc2833
  disallow=all
  allow=ulaw,alaw,g729
  qualify=yes
  nat=force_rport,comedia

Registration String:
  1234567890:SIPpassword123@sip.yourprovider.com/1234567890

Extensions (PJSIP)

TEXT
Extension: 1001
Display Name: Reception
Secret: SecurePass123!
Max Contacts: 1
Transport: UDP

IVR Configuration

TEXT
IVR Name: Main-Menu
Announcement: "Welcome to HBZ. Press 1 for Sales, 2 for Support, 0 for Reception"
Timeout: 10 seconds
Digit timeout: 5 seconds

Options:
  1 → Ring Group: Sales-Team (ext 1100-1105)
  2 → Queue: Support-Queue
  0 → Extension: 1001 (Reception)
  t → Repeat IVR
  i → Repeat IVR

Call Queues

TEXT
Queue Name: Support-Queue
Strategy: ringall (or leastrecent for larger teams)
Ring time: 20 seconds
Max wait time: 300 seconds
Members: 1010, 1011, 1012, 1013
Hold music: default
Periodic announce: "You are caller number {{QUEUE_POSITION}}. Please hold."
Announce position: yes

Call Recording

BASH
# Enable in FreePBX: Admin → Call Recording
# Records stored at: /var/spool/asterisk/monitor/

# Retention cleanup (cron - delete after 90 days)
0 2 * * * find /var/spool/asterisk/monitor/ -name "*.wav" -mtime +90 -delete

Firewall Rules for FreePBX

BASH
ufw allow from sip.yourprovider.com to any port 5060 proto udp
ufw allow 10000:20000/udp  # RTP media
ufw allow 80/tcp           # FreePBX admin (change to internal only!)
ufw allow 443/tcp

Monitoring

BASH
# Active calls
asterisk -rx "core show channels"

# SIP registrations
asterisk -rx "pjsip show registrations"

# Queue status
asterisk -rx "queue show Support-Queue"