[asterisk-users] Sticky Park
Mat Murdock
mmurdock at kimballequipment.com
Thu Aug 27 12:52:54 CDT 2009
My company for various reasons has asked that I come up with a way to
have previously parked calls be re-parked in the same parking slot. I
have looked at setting up asterisk so that the receptionist chooses
which slot to place a call, but I think there is an easier way. That is
when I came up with the idea of "Sticky Park". Here is how it would
work. A call would come in and the receptionist will park the call as
she normally does. Asterisk will the pick the first open parking slot,
let's say 702 because there is already a call on 701. Lets say that the
call parked on 701 is picked up, freeing 701. So, 701 is free and 702
has our call parked on it. Now the call on 702 rings back to the
receptionist because it has timed out. She asks the person if they
would like to continue hold and will again park the call as she normally
does. Asterisk will then re-park the call back onto 702 because that is
where it came from. The normal behavior of Asterisk would of been to
park it on 701 because it is the first free parking slot. That is why I
call it "Sticky Park". So what happens if between the time she picks
up the call and re-parks it someone else parks a call on 702? Then I
think Asterisk should then pick the first available parking slot and
that call becomes stuck to that parking slot if additional re-parks are
necessary.
Here is my dialplan on how I thought I could accomplish this with
dial-plan magic.
Here is the relevant features.conf entries.
[general]
parkext => 799 ;We need to use our own 700 extension so lets get this
out of the way.
parkpos => 702-706
comebacktoorigin = no ;This causes calls that have timed out to
come to the parkedcallstimeout context at s,1.
Ok now onto my Dial Plan.
[from_internal]
include => parkedcalls ; Gotta have this or things don't work.
;I do an attended transfer to 700.
exten => 700,1,Answer()
;Just so I can see if anything has been set
exten => 700,n,NoOp(I want to be parked on: ${PARKINGEXTEN})
;Also so I can see what the state of that parking slot is.
exten => 700,n,NoOp(Device State is:
${DEVICE_STATE(park:${PARKINGEXTEN}@parkedcalls)})
;Check to see if PARKINGEXTEN is set. If not then this must be a new
call being park, let's let asterisk find a spot for it.
exten => 700,n,GotoIf($[${LEN(${PARKINGEXTEN})}=0]?parkcall)
;Ok Looks like this call has been parked before. Let's see if we can
repark it in the same spot again. If it not INUSE then let's park the call.
exten =>
700,n,GotoIf($[${DEVICE_STATE(park:${PARKINGEXTEN}@parkedcalls)}=INUSE]?:parkcall)
;Previous slot is not occupied lets clear the PARKINGEXTEN variable so
that when we park the call Asterisk will find the first available slot.
exten => 700,n,Set(PARKINGEXTEN=)
;Lets park the call.
exten => 700,n(parkcall),Park()
exten => 700,n,Hangup()
[parkedcallstimeout]
exten => _SIP011XX,1,Answer()
exten => _SIP011XX,n,NoOp(Call Parked on: ${PARKINGSLOT})
exten => _SIP011XX,n,NoOp(This is who parked us: ${EXTEN})
exten => _SIP011XX,n,Set(PARKINGEXTEN=${PARKINGSLOT})
;This sets the PARKINGEXTEN to the parking slot we were parked in.
exten =>
_SIP011XX,n,Dial(SIP/${EXTEN:4:4},${RINGTIMER},${INTERNAL_DIAL_OPTIONS})
;This send the call back to the person who parked it. There are a
couple of global variables I use here. Nothing unusual here.
So what is the problem? Well the problem is that the PARKINGEXTEN
variable gets reset after the dial command in parkedcallstimeout. That
makes it so I cannot find out where that call was originally parked If
I can find out how to get that little bit of information when the call
is re-parked then I think this will work. If anyone has any suggestions
on how to accomplish this I would be grateful.
Thanks,
Mat Murdock
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the asterisk-users
mailing list