Asterisk cmd RetryDial


This is simply a variant of the Dial command.



Place a call, retrying on failure allowing optional exit extension.


Attempt to place a call. If no channel can be reached, play the file defined by 'announce' waiting 'sleep' seconds to retry the call.
If the specified number of attempts matches 'loops' the call will continue with the next priority.

If 'loops' is set to -1, the call will retry endlessly. While waiting, a 1 digit extension may be dialed. If the 1 digit extension exists in the context defined in ${EXITCONTEXT}, the call will exit the RetryDial() application to that extension immmediately.
'sleep' defaults to 10 seconds if any value less than 1 is supplied.

All the arguements after the 'loops' parameter are passed directly to Dial() (show application Dial)


exten => 1,1,Voicemail(${BOX})

exten => _1XXX,1,SetVar(BOX=${EXTEN})
exten => _1XXX,2,SetVar(EXITCONTEXT=vcon)
exten => _1XXX,2,RetryDial(please-wait|5|3|SIP/${BOX}|60|d)
exten => _1XXX,3,Playback(sorry-pal)
exten => _1XXX,4,Hangup

The file announces "I am currently busy, press 1 to leave me voicemail or stay on the line"
Because you added the 'd' flag you can now dial 1 even when the call is in the ring state. If you want to never let them hear the ringing just add the 'm' flag too.
It will try to call them for 60 seconds at a time and wait 5 sec between each failure in the event of a busy signal. This will repeat up to 3 times (that is what the 5|3 is for)


See bug/patch 3313

This will not call the caller back, i.e. is not a auto-callback feature as such. This app is for a situation where you would play a file that says "I am currently on the phone, press 1 to leave me a voice mail or stay on the line to wait for me." or "press 1 to leave me a voicemail or 2 to try my cell" but once you hangup that's it, it gives up.

If the 'd' flag is set it trumps the 'H' flag and intercepts any dtmf while you are waiting for the call to be answered and returns that value on the spot. This allows you to dial an exit extension while waiting for the call to be answered. So, if you set this 'd' flag in the dialargs portion of the RetryDial() then you will be able to cancel out the call while waiting for the call to be picked up as well as when music-on-hold is playing.

See also

Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Created by: JustRumours, Last modification: Sun 08 of Mar, 2009 (13:41 UTC) by agorosti
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+