Asterisk Dialplan: Asterisk dial application (Latest Versions)
Updated guide for modern Asterisk (PJSIP era): asterisk dial application with real configs, common mistakes, and troubleshooting steps.
The Dial() application is the core of real call handling in Asterisk. It is the command that actually rings another device, connects two people, bridges audio, and creates a live conversation.
Without Dial(), Asterisk can answer calls, play audio, or collect digits — but it cannot connect callers to agents, customers, or external numbers.
This guide explains how Dial() works in modern Asterisk using PJSIP, including syntax, real production examples, and the most common troubleshooting scenarios.
Basic Syntax of Dial()
The general structure of Dial() is:
Dial(technology/target,timeout,options)
- technology → channel driver (PJSIP in modern Asterisk)
- target → extension, trunk, or endpoint to call
- timeout → how long to ring (seconds)
- options → behavior controls (recording, transfers, music, etc.)
Example:
Dial(PJSIP/1001,20)
This rings extension 1001 for 20 seconds.
Modern PJSIP vs Legacy SIP Syntax
Old tutorials often show:
Dial(SIP/1001)
That uses the deprecated chan_sip driver.
Modern Asterisk must use:
Dial(PJSIP/1001)
Always confirm your system is PJSIP-based before copying examples.
Dialing an Internal Extension
[from-internal]
exten => 1001,1,Dial(PJSIP/1001,20)
same => n,Hangup()
Flow:
- Asterisk rings extension 1001
- If answered → call is bridged
- If no answer → continues to next priority
Dialing Multiple Extensions (Ring Group)
You can ring multiple devices at the same time:
Dial(PJSIP/1001&PJSIP/1002&PJSIP/1003,25)
Behavior:
- All phones ring simultaneously
- First person to answer gets the call
- Others stop ringing automatically
Dialing an External Number via SIP Trunk
External calls typically use:
Dial(PJSIP/9876543210@mytrunk,60)
- 9876543210 → number being dialed
- mytrunk → trunk endpoint defined in PJSIP
This is the foundation of outbound calling and autodialers.
What Happens Internally When Dial() Runs
- Asterisk creates a new outbound channel
- Attempts signaling to destination
- If answered → bridges RTP audio between both channels
- If failed → returns control to dialplan
Understanding this flow is key for debugging real call failures.
Important Dial() Options Used in Production
1) Play Music While Ringing
Dial(PJSIP/1001,20,m)
Caller hears music instead of ring tone.
2) Allow Call Transfers
Dial(PJSIP/1001,20,tT)
- t → called party can transfer
- T → caller can transfer
3) Call Recording with MixMonitor
exten => 2000,1,MixMonitor(/var/spool/asterisk/recordings/${UNIQUEID}.wav)
same => n,Dial(PJSIP/1001,20)
Handling No Answer or Busy Cases
After Dial() ends, Asterisk sets a status variable:
${DIALSTATUS}
Common values:
- ANSWER
- BUSY
- NOANSWER
- CHANUNAVAIL
- CONGESTION
Example handling:
exten => 3000,1,Dial(PJSIP/1001,20)
same => n,GotoIf($["${DIALSTATUS}"="NOANSWER"]?voicemail)
same => n,Hangup()
exten => 3000,n(voicemail),Voicemail(1001@default)
same => n,Hangup()
Most Common Dial() Problems and Real Fixes
No Matching Endpoint
- Wrong endpoint name in Dial()
- PJSIP config not reloaded
Call Rings but No Audio
- NAT or RTP port issue
- Firewall blocking UDP range
Immediate Hangup
- Codec mismatch
- Trunk authentication failure
Always debug with:
pjsip set logger on
rtp set debug on
Real-World Production Dial Flow Example
[inbound-main]
exten => s,1,Answer()
same => n,Playback(welcome)
same => n,Dial(PJSIP/1001&PJSIP/1002,30,tT)
same => n,Voicemail(1001@default)
same => n,Hangup()
This single block powers thousands of real business phone systems.
Key Takeaway
Dial() is the heart of Asterisk call routing. Mastering Dial() means you can build:
- Inbound routing
- Outbound dialing
- Ring groups and queues
- Autodialers and AI calling
In modern deployments, always use: PJSIP-based Dial syntax, proper NAT handling, and DIALSTATUS logic for reliable call flows.
Want to see API-driven CRM + Telecom workflows in action? Try the WhatsApp bot or explore the demos.
Comments (0)
Be the first to comment.