Ring Group with DIALSTATUS Routing
Ring Group with DIALSTATUS Routing
Ring all extensions in a group simultaneously. After the Dial() returns, inspect DIALSTATUS to decide what happens next, busy callers hear the busy greeting, unanswered calls go to the unavailable greeting, and unavailable channels get logged.
Dialplan
[ring-sales]
exten => s,1,NoOp(Ring Group - Sales Team)
same => n,Set(RINGGROUP_EXTS=PJSIP/1001&PJSIP/1002&PJSIP/1003)
same => n,Dial(${RINGGROUP_EXTS},25,tTr)
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy)
same => n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?noanswer)
same => n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?unavail)
same => n,Hangup()
same => n(busy),VoiceMail(1001@default,b)
same => n,Hangup()
same => n(noanswer),VoiceMail(1001@default,u)
same => n,Hangup()
same => n(unavail),VoiceMail(1001@default,u)
same => n,Hangup()
How it works
- Ampersand (&) in Dial():
PJSIP/1001&PJSIP/1002&PJSIP/1003rings all three endpoints simultaneously. The first one to answer wins; the others stop ringing. - Dial options
tTr:tallows the called party to transfer,Tallows the caller to transfer,rgenerates a ringing indication to the caller instead of music on hold. - DIALSTATUS: After
Dial()returns, this variable tells you why:ANSWER(someone picked up),BUSY(all endpoints busy),NOANSWER(timeout with no answer),CHANUNAVAIL(endpointIn PJSIP configuration, the SIP entity Asterisk communicates with: a phone, trunk, or other user agent. Defined by an endpoint section in pjsip.conf. not registered),CANCEL(caller hung up),CONGESTION(network error). - VoiceMailAsterisk's built-in voice messaging system (app_voicemail), configured in voicemail.conf with mailboxes per user. greeting flags:
bplays the "busy" greeting,uplays the "unavailable" greeting. This gives the caller appropriate contextA named section of the dialplan that groups extensions. Calls enter a specific context and can only reach extensions visible from it, making contexts the basic unit of call routing and security. about why they reached voicemail.
Tips
- Store the extensionA dialplan entry that matches a dialed number or pattern within a context and triggers a sequence of prioritized steps. list in a global variable so you can update it in one place when staff changes.
- The timeout (25 seconds here) should be long enough for someone to reach their phone but short enough that callers don't give up.
- Add
same => n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?done)before the BUSY check if you want to silently handle caller hangups. - For sequential ring (try one, then the next), use separate
Dial()calls chained together instead of&.
User Notes
Know a tip or gotcha for this topic? Share it below and help others.
Contribute a note
Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.