Summary:ASTERISK-16643: [patch] Allow user more control over parked calls that expire from a one touch park
Reporter:Mitch Sharp (bluecrow76)Labels:
Date Opened:2010-09-02 17:51:42Date Closed:2012-01-20 14:54:01.000-0600
Versions:Frequency of
Environment:Attachments:( 0) asterisk-
( 1) asterisk-trunk-park-features-2010SEP02.diff
( 2) asterisk-trunk-park-features-comebackcontext-consolidated.diff
( 3) patch-asterisk-trunk-park-features.diff
Description:This patch allows the user more control of calls that expire after being parked using one touch parking.

The current behavior of a call expiring after being one touch parked is to create an extension in a context that dials the device that parked the call for 30 seconds with appropriate dial arguments.  After that 30 seconds expires, the call terminates because there is no more dial plan for asterisk to process.

This patch can be applied against, the current beta of 1.8 and trunk.

I am running this in production on, and, along with my other patches to parking (0017946).


This patch adds the following:

1. A features.conf variable comebackdialtime

comebackdialtime allows the user to set the amount of time the returning call will Dial the device that parked it.  It would be better for the user to be able to set this time to a longer time so that the user ends of hanging up from a lack of attention rather than the system bailing on the user because it ran out of options.

2. Addition of setting two new channel variables: PARKER and PARKINGSLOT

PARKER is the device that originally parked the channel.
PARKINGSLOT is the slot number the channel just expired out of.

These can be used in conjunction with the next option.

3. A features.conf option comebacktocustom

When set to yes, comebacktocustom will attempt to send the call to the parking lot context at extension 's', priority '1'.  This allows you to change the callerid or set a different ring tone and then send the call back to the original device that parked the call.

Setting this to 'yes' overrides comebacktoorigin.

The user must create the dialplan in the parking lot context for
extension 's'.  This is not done dynamically.

If the parking lot context at extension 's', priority '1' does not exist,
this option is ignored and it is as if the option was set to no.  This
check occurs on a per-call basis.

Sample dialplan:
exten => s,1,DumpChan()
exten => s,n,ExecIf($["${OriginalCIDName}" = ""]?Set(OriginalCIDName=${CALLERID(name)})
exten => s,n,Set(CALLERID(name)=P${PARKINGSLOT}:${OriginalCIDName})
exten => s,n,Dial(${PARKER},30,TKtwk)
exten => s,n,ExecIf($["${DIALSTATUS}" = "ANSWER"]?Hangup())
exten => s,n,Goto(incoming,s,reception)
Comments:By: Mitch Sharp (bluecrow76) 2010-09-02 18:03:06

The submitted patches were made against svn trunk.  The code will run on any 1.6.2.X and 1.8 beta, but the patch itself will throw errors if you try it against those versions.

By: David Woolley (davidw) 2010-09-03 04:39:53

No valid patch has been submitted.  The only attachment is marked as debug information, not as, licensed to Digium, code.  You need to agree the electronic submission licence terms, then submit the patch with the "code or documentation" box ticked.  (The licence is one that you give to Digium, not one that Digium gives to you.)

By: Mitch Sharp (bluecrow76) 2010-09-03 09:27:37

Sorry!  Forgot to make the extension diff and check the code box.  Fixed.

By: Leif Madsen (lmadsen) 2010-09-07 12:48:05

This wouldn't go into 1.6.2.x, but it may go into 1.8 at the discretion of Russell Bryant.

By: Russell Bryant (russell) 2010-09-09 16:26:12

The comebacktoorigin option already allows executing custom dialplan in the case of a timed out parked call.  Can you clarify why that doesn't do what you need?

;comebacktoorigin = yes         ; Setting this option configures the behavior of call parking when the
                               ; parked call times out (See the parkingtime option).  The default value is 'yes'.
                               ; 'yes' - When the parked call times out, attempt to send the call back to the peer
                               ;         that parked this call.  This is done by saving off the name of the channel
                               ;         that parked the call.
                               ; 'no'  - This option is useful for performing custom dialplan functionality prior to
                               ;         sending the call back to the extension that initially parked the call, or to
                               ;         an entirely different destination.
                               ;         When the parked call times out, send it back to the dialplan.  The location
                               ;         will be the 'parkedcallstimeout' context.  The extension will be built from
                               ;         the saved channel name that parked the call.  For example, if a SIP peer named
                               ;         '0004F2040001' parked this call, the extension will be 'SIP_0004F2040001'.
                               ;         (Note that an underscore is used here because the '/' character has a special
                               ;         meaning in extension names for CallerID matching.)  If this extension does not
                               ;         exist, the call will be sent to the 's' extension, instead.  Finally, if the 's'
                               ;         extension of 'parkedcallstimeout' does not exist, the call will fall back to the
                               ;         's' extension of the 'default' context.
                               ;         Additionally, in this example an extension of 'SIP_0004F2040001' will be
                               ;         created in the 'park-dial' context.  This extension will be set up to do a
                               ;         Dial() to 'SIP/0004F2040001'.

By: Mitch Sharp (bluecrow76) 2010-09-09 17:10:26

It looks like I completely missed that.  I developed this code to fill a need in the 1.6.2 code base for a customer and then submitted the patch against trunk.  It looks like I developed very similar functionality.  It was fun though!  :-)

The only thing that I can see that comebacktocustom does different is this.  comebacktoorigin sends all calls to the same context, parkedcallstimeout.  comebacktocustom sends calls to the parking lot context at s,1.  I live in a multitenant world, so some tenants will want to handle timed out calls differently (some want a particular callerid, some a particular ring tone, some both).

I could emulate that behavior by setting a channel variable that tells me where to jump out of parkedcallstimeout to handle things differently per customer.

I also added two channel variables when the call times out, PARKER and PARKINGSLOT.  PARKER is the device that originally parked the call so the dialplan can know who to call back.  Technically, that was not previously available to the dialplan unless you took the flat extension and tried to tweak it back to a channel name.  PARKINGSLOT was previously only set if comebacktoorigin was set to no.

So it looks like comebacktocustom just allows the user using multiple parking lots more flexibility in that the timeout context can be custom per parking lot, plus a few other options.


By: Leif Madsen (lmadsen) 2010-09-13 10:51:21

That looks like a discussion question, and thus should be proposed on the asterisk-dev list.


By: Mitch Sharp (bluecrow76) 2010-10-01 01:10:09

Updated the patch and opened a review request on the review board:

By: Mitch Sharp (bluecrow76) 2010-10-01 02:07:20

Uploaded minor change.

By: Mitch Sharp (bluecrow76) 2011-04-21 16:08:09

Just posted latest patch... working on checking for changes in trunk.

By: Russell Bryant (russell) 2011-04-22 08:19:44

Since this is effectively a new feature, it will only be able to go into trunk.