How to Configure Extensions and Voicemail in Asterisk

Extensions are the individual phone lines within your PBX system, and voicemail lets callers leave messages when an extension doesn't answer. This guide covers configuring both.

Creating an Extension in pjsip.conf

sudo nano /etc/asterisk/pjsip.conf
[1001]
type=endpoint
context=internal
disallow=all
allow=ulaw
allow=alaw
auth=1001-auth
aors=1001

[1001-auth]
type=auth
auth_type=userpass
username=1001
password=CHANGE_ME_STRONG_PASSWORD

[1001]
type=aor
max_contacts=1

This defines extension 1001 with a secure password — each additional extension follows the same pattern with a unique number and password.

Reloading Configuration

sudo asterisk -rx "pjsip reload"

Configuring a SIP Phone or Softphone to Register

Enter the following in your SIP phone/softphone app:

Server: YOUR_SERVER_IP
Extension: 1001
Password: (as configured above)

Setting Up Basic Dialplan for Internal Calling

sudo nano /etc/asterisk/extensions.conf
[internal]
exten => 1001,1,Dial(PJSIP/1001,20)
exten => 1001,n,Voicemail(1001@default)

exten => 1002,1,Dial(PJSIP/1002,20)
exten => 1002,n,Voicemail(1002@default)

Rings the extension for 20 seconds, then routes to voicemail if unanswered.

Configuring Voicemail Boxes

sudo nano /etc/asterisk/voicemail.conf
[default]
1001 => 1234,John Doe,[email protected]
1002 => 5678,Jane Smith,[email protected]

Format: mailbox => pin,name,email — the email address receives voicemail notifications if configured.

Enabling Voicemail-to-Email

[general]
[email protected]
attach=yes
format=wav49|gsm|wav

attach=yes includes the actual voicemail audio file as an email attachment, letting users listen without dialing in.

Testing Voicemail

Call an extension that's set to not answer (or let it ring out), leave a test message, then dial into voicemail retrieval to confirm it was recorded correctly.

Setting Up Voicemail Retrieval Access

exten => *97,1,VoicemailMain(${CALLERID(num)}@default)

Dialing *97 from an extension lets the user check their own voicemail directly.

Common Errors

Extension registers but calls don't ring through — verify the dialplan context matches what's configured in the extension's pjsip.conf entry.

Voicemail-to-email doesn't send — verify Asterisk's outbound mail configuration (typically via the system's configured mail transfer agent) is working correctly; test with a simple command-line mail send first to isolate the issue.

Continue Reading

Browse more articles in VoIP & Communication Servers.

  • asterisk extensions, asterisk voicemail, pjsip configuration, voip extension setup
  • 0 משתמשים שמצאו מאמר זה מועיל
?האם התשובה שקיבלתם הייתה מועילה

מאמרים קשורים

How to Install Asterisk PBX on a VPS

Asterisk is the foundational open-source telephony engine powering most self-hosted PBX systems...

How to Install FreePBX on a VPS

FreePBX is a widely-used, open-source web interface built on top of Asterisk — making PBX...

How to Set Up SIP Trunking for Your PBX

A SIP trunk connects your self-hosted PBX to the public telephone network, letting you make and...

How to Secure a VoIP Server Against Toll Fraud

An unsecured VoIP server is a common target for toll fraud — attackers who compromise weak...

How to Set Up an IVR (Interactive Voice Response) Menu

An IVR menu greets callers with recorded prompts and routes them based on their keypad selections...