[asterisk-users] parking - why doesn't this work?

Noah Engelberth nengelberth at team-meta.net
Mon Oct 14 15:31:06 CDT 2013


You can hack together a way with custom device states and manual use of the Park() and ParkPickup() functions, but it won't be particularly pretty.  A rough dialplan might look like the following (adjust to match your requirements, especially if a park fails or something similar):

exten => _70[1234],1,Verbose(5,Park pickup or park call for slot ${EXTEN})
same => n,GotoIf($[${DEVICE_STATE(park:${EXTEN}@parkinglot)} = NOT_INUSE]?park,pickup)
; Currently no call parked - park call
same => n(park),Set(__PARKINGEXTEN=${EXTEN})
same => n,Set(__RETURNTO=${CALLERID(num)})
same => n,Dial(Local/s at park,)
; Park failed, clear the device state and return
same => n,Goto(parking-return,${RETURNTO},1)
; Currently a call parked - pick up
same => n(pickup),ParkedCall(${EXTEN}@parkinglot)
same => n,Hangup()

[park]
exten => s,1,Verbose(5,Park call)
same => n,Park(<timeout in ms>,parking-return,${RETURNTO},1,s,parkinglot)

[parking-return]
exten => _X.,1,Verbose(5,Return parked call to internal phone)
same => n,Set(CALLERID(name)=PK:${CALLERID(name))
same => n,Dial(Local/${EXTEN}@users,)
same => ; some fallback for if the return user doesn't answer

Basically, the idea is, check to see if the parking space is occupied.  If it is occupied, someone is trying to pickup the parked call, so connect them with the ParkedCall() application.  If it is not occupied, someone is trying to park a call, so set up the PARKINGEXTEN variable with "where to park it" (e.g. 701), and set up the RETURNTO variable with "where to return if the park fails or times out" (in my example, based on the caller ID number of the parking channel - make sure it's set to something that will return either via a local channel like I have in my example or a direct dial to a SIP/ or other channel).

By putting the double underscore (__) in front of the variable name when we set it, we tell Asterisk to automatically set that variable on any channel spawned as a descendant of this channel (necessary for parking via a Local channel).

I'm suggesting parking via local channel so that the RETURNTO variable survives on an attended transfer.  Also, the specific example I have above will not work properly with unattended (blind) transfers to the parking extension.  If you want to support a blind transfer to the parking space, you need to find a way to use the BLINDTRANSFER and BLIND_XFER_PEER channel variables to set RETURNTO correctly.

There're plenty of other ways to do it, but the core of what you'll need to investigate for "SLA parking" is to use ${PARKINGEXTEN} to tell Asterisk where to park the call, and use the features.conf settings for the parking lot to prevent Asterisk from automatically hunting into additional spaces (if you allow Asterisk to hunt into a new slot, and two people try to park on 701 at the same time, one of the two calls will wind up on 702 and the ,s, option in the Park() application means Asterisk won't be reading back parking slots to the Parker, so you won't know which call lost the race.  Practically speaking, it's not a huge problem, but the best practice would be to prevent the auto-hunting and avoid the race condition altogether).


Thank you,

Noah Engelberth
MetaLINK Technologies

From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Matt Hamilton
Sent: Monday, October 14, 2013 10:28 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] parking - why doesn't this work?


Parking/unparking will be done from multiple phones so that someone else can pickup/unpark the call from their phone that I parked on mine. I'm just testing it on one phone now.

I'm trying to simulate the SLA functionality (which Asterisk has, but it's not very scalable and they haven't really been doing much development/improvement on that lately). We have been using SLA for a while, but we are also looking at other options. Unfortunately, conventional parking (pressing #700 and announcing the parking space) is not suitable for our very fast paced environment.


----------------------------------------
> Date: Mon, 14 Oct 2013 16:15:22 +0200
> From: webaccounts at jgoettgens.de<mailto:webaccounts at jgoettgens.de>
> To: asterisk-users at lists.digium.com<mailto:asterisk-users at lists.digium.com>
> Subject: Re: [asterisk-users] parking - why doesn't this work?
>
> Hmmm, do I understand you correctly that you park and unpark a call using the same phone?
>
> If yes, why does simply "holding" the call does not work? The SPA504 has an extra large button
> on the right for this and you don't need any support in the dialplan.
>
> jg
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
> http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20131014/304bfdc5/attachment.html>


More information about the asterisk-users mailing list