Summary:ASTERISK-03247: [patch] new app RetryDial in app_dial.c
Reporter:Anthony Minessale (anthm)Labels:
Date Opened:2005-01-10 15:25:42.000-0600Date Closed:2008-01-15 15:22:16.000-0600
Versions:Frequency of
Environment:Attachments:( 0) retrydial_rev0.diff
( 1) retrydial_rev1.diff
( 2) retrydial_rev2.diff
( 3) retrydial_rev3.diff
( 4) retrydial_rev4.diff
Description:This application adds RetryDial to app_dial.c.
The functionaliy can be summerized by the Documentation system in asterisk.

*CLI> show application RetryDial

 -= Info about application 'RetryDial' =-

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 be transferred to
the extension 'v' in the context defined by 'context'

If 'loops' is set to 0, the call will retry endlessly.

While waiting, a 1 digit extension may be dialed.  If that extension exists in 'context',
The call will exit the application to that extension immmediately.

If unspecified, 'loops' defaults to 12, 'sleep' defaults to 10
and 'context' defaults to the current context

All the arguements after the first ':' are passed directly to Dial() (show application Dial)


Disclaimer on file.
anthmct@yahoo.com (works on paypal too *wink*)

Comments:By: () 2005-01-10 19:12:41.000-0600

With this, would it be possible to ringback the user and bridge the retried call when the user answers the phone? For instance, you could possible have a recording that says: "This line is busy. We can continue to try the number for you for an additional charge of xxx cents and call you when the person is busy if you press 1.". Or something like that? Probably implementable in the dialplan in conjunction with other commands. I'm just mostly wondering if the user hangs up, will the channel still be available to retry the number?

By: Brian West (bkw918) 2005-01-10 19:19:52.000-0600

ya if a user hangs up then it would stop retrying


By: Anthony Minessale (anthm) 2005-01-10 20:13:30.000-0600

This will not call the caller back.  You are thinking of an auto-callback feature.  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.

By: Anthony Minessale (anthm) 2005-01-12 12:21:56.000-0600

rev1 to match CVS

By: Anthony Minessale (anthm) 2005-01-12 12:59:37.000-0600

rev2 (optimized a bit)

By: () 2005-01-12 20:16:13.000-0600

I'm going to do some testing on this tomorrow, I'll let you know how it goes.

By: Mark Spencer (markster) 2005-01-12 23:33:45.000-0600

I'm pretty sure that the pressing a digit will only work during the sleep.  Maybe it's useful to have an option to enable that behavior during dial.

Also, the "v" thing should probably go away (instead, it should just go to the next step) and the jumping out should be an option.  

Maybe we should make the context for the exit an option (e.g. e(foo))

By: Anthony Minessale (anthm) 2005-01-13 10:13:15.000-0600

rev3 loses "v"

By: () 2005-01-13 10:34:54.000-0600

The 6th hunk fails because you added a new line.

File to patch: apps/app_dial.c
patching file apps/app_dial.c
Hunk ASTERISK-2 FAILED at 1117.
1 out of 7 hunks FAILED -- saving rejects to file apps/app_dial.c.rej

Removing that problem lines lets the patch go through successfully. I've posted the correction in retrydial_rev4.diff.txt

edited on: 01-13-05 10:37

By: Anthony Minessale (anthm) 2005-01-13 11:54:56.000-0600

stay tuned

By: Anthony Minessale (anthm) 2005-01-13 13:06:05.000-0600

Ok, the right rev3 is uploaded.

This one gets rid of the v extension it just continues on in the dialplan if the loops run out.

It also adds the 'd' flag to regular app_dial, if set, this flag 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.

** side note, '*' and '#' are still hardcoded into app_dial for the hangup and transfer keys.. so that needs fixing I think maybe some of app_dial could be moved into a core function you can control from the loadable app_dial or something like that.

Anyway, 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 moh is playing just like markster proposed.


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

exten => _1XXX,1,SetVar(BOX=${EXTEN})
exten => _1XXX,2,RetryDial(please-wait|vcon|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)

edited on: 01-13-05 13:06

By: Anthony Minessale (anthm) 2005-01-15 10:43:20.000-0600


By: Anthony Minessale (anthm) 2005-01-17 18:10:40.000-0600


By: Mark Spencer (markster) 2005-01-17 21:09:54.000-0600

Merged with the following changes:

1) Handle macrocontext

2) Properly call LOCAL_USER_REMOVE during error conditions

3) Only wait for digits in RetryDial when said option is enabled.

By: Digium Subversion (svnbot) 2008-01-15 15:22:16.000-0600

Repository: asterisk
Revision: 4828

U   trunk/apps/app_dial.c
U   trunk/doc/README.variables

r4828 | markster | 2008-01-15 15:22:16 -0600 (Tue, 15 Jan 2008) | 2 lines

Merge anthm's RetryDial with changes (bug ASTERISK-3247)