Asterisk PBX running, let’s configure IVR (Interactive Voice Response), Voicemail, and Call Recording.
1. Setting Up IVR (Interactive Voice Response)
IVR allows callers to navigate menus using DTMF (touch-tone) inputs.
Step 1: Create an IVR Context
Edit the extensions.conf
file:
bashsudo nano /etc/asterisk/extensions.conf
Step 2: Define the IVR Menu
Add an IVR context:
ini[ivr-menu]
exten => s,1,Answer()
same => n,Background(ivr-welcome) ; Play welcome message
same => n,WaitExten(5) ; Wait 5 seconds for input
; Press 1 for Sales
exten => 1,1,Playback(sales-message)
same => n,Dial(SIP/1001,20)
same => n,Hangup()
; Press 2 for Support
exten => 2,1,Playback(support-message)
same => n,Dial(SIP/1002,20)
same => n,Hangup()
; Press 0 for Operator
exten => 0,1,Dial(SIP/1003,20)
same => n,Hangup()
; Invalid or timeout
exten => i,1,Playback(invalid-option)
same => n,Goto(ivr-menu,s,1)
exten => t,1,Playback(timeout-message)
same => n,Goto(ivr-menu,s,1)
Step 3: Record Custom IVR Prompts
Use Asterisk to record custom prompts:
bashsudo asterisk -rvvv
Run the following command:
asteriskcore set verbose 3
module load app_record.so
Then dial:
*777
Follow the prompts and record messages for “Welcome”, “Sales”, “Support”, etc.
Alternatively, place pre-recorded .wav
files in:
swiftCopyEdit/var/lib/asterisk/sounds/en/
Step 4: Assign IVR as the Incoming Call Handler
Modify the [default]
context in extensions.conf
:
ini[default]
exten => _X.,1,Goto(ivr-menu,s,1)
Restart Asterisk:
bashsudo systemctl restart asterisk
Test by dialing into the PBX.
2. Setting Up Voicemail
Voicemail allows users to receive and retrieve voice messages.
Step 1: Edit Voicemail Configuration
bashsudo nano /etc/asterisk/voicemail.conf
Add:
ini[default]
1001 => 1234,User One,user1@example.com
1002 => 1234,User Two,user2@example.com
This means:
- Extension
1001
has voicemail PIN1234
. - Messages are sent to the user’s email.
Step 2: Configure Voicemail in Dial Plan
Modify extensions.conf
:
ini[internal]
exten => 1001,1,Dial(SIP/1001,20)
same => n,Voicemail(1001,u) ; u = unavailable, b = busy
same => n,Hangup()
exten => 1002,1,Dial(SIP/1002,20)
same => n,Voicemail(1002,u)
same => n,Hangup()
Step 3: Enable Voicemail in Asterisk
Restart Asterisk:
bashCopyEditsudo systemctl restart asterisk
Step 4: Access Voicemail
Users can check voicemail by dialing:
*97
or from another extension:
php-templateCopyEdit*98<extension_number>
3. Setting Up Call Recording
Call recording is useful for logging calls for quality control, training, or compliance.
Step 1: Enable Recording in Dial Plan
Edit extensions.conf
:
ini[internal]
exten => 1001,1,MixMonitor(/var/spool/asterisk/monitor/${UNIQUEID}.wav)
same => n,Dial(SIP/1001,20)
same => n,Hangup()
This records calls to /var/spool/asterisk/monitor/
.
Step 2: Configure Call Recording Settings
Edit features.conf
:
bashsudo nano /etc/asterisk/features.conf
Enable on-demand recording:
iniautomon => *1
Step 3: Set Up Storage & Permissions
Ensure the directory exists and has the right permissions:
bashsudo mkdir -p /var/spool/asterisk/monitor/
sudo chown asterisk:asterisk /var/spool/asterisk/monitor/
sudo chmod 755 /var/spool/asterisk/monitor/
Step 4: Restart Asterisk
bashsudo systemctl restart asterisk
Step 5: Test Call Recording
- Call from one extension to another.
- Verify recordings:
bashls /var/spool/asterisk/monitor/
Final Testing & Debugging
Monitor Asterisk for any issues:
bashsudo asterisk -rvvv
Check logs:
bashCopyEdittail -f /var/log/asterisk/full
Next Steps
- Configure CDR (Call Detail Records) logging.
- Integrate with a CRM.
- Add Failover & HA for redundancy.