Reparking a call on the same position

Attempting to use soft keys on Cisco SPA508G phones to implement Parking with BLF. I have the parking lot set up (10000) in Asterisk 13.5, with spaces from 10001-10050 (I’ll use the whole range when it goes live). Each button has fnc=blf+sd;sub=10001@$PROXY;ext=10001@$PROXY; (10002, 10003, etc.) which works for the BLF, Park, and ParkedCall. Once the call is parked, the light turns solid red. When the button is pressed again, the call is retrieved, and the light goes green. This is a little misleading. The hint returns to Idle, but the calling extension is still in the application Park(10000), and the callee (parker/retriever) is showing ParkedCall(10000,10001). That parking position is not really available. The callee can then repark the call on a different parking space, but cannot repark on the same space (I need to find a way to repark in the same space). If the callee tries to park on the same space, both caller and callee hear MOH. The caller appears to be in the same place, and the callee is now parking himself.

Ideally, for my scenario, I would like to see the parked call hint show ringing so the light will blink red (or any other device state that will show blinking). When it’s picked up, either go solid red (InUse) or join the endpoints, and remove the Park/ParkedCall completely. I’ve been trying a number of configs for this over the past few days. Besides modifying the source to set the hints does anyone else have an idea to make this work for me? Thanks.

Here’s what the code looks like right now. I’ve made so many changes to try and get it all to work, there may be some pieces missing. At this point, it’s working, but can’t repark, and when the parked call is answered, the hint changes to Idle.

extensions.conf
[subInternalDialer]

same => n,GotoIf($["${devicetype}" = “parking”]?parking,s,1)

[parking]
exten => s,1,NoOp(${ARG1} - ${CHANNEL} - ${parkedchan} - ${CHANNEL(parkinglot)} - ${BLINDTRANSFER})
same => n,Set(lot=10000)
same => n,Set(pos=${ARG1})
same => n,GotoIf($["${DEVICE_STATE(park:${pos}@parkedcalls)}"=“NOT_INUSE”]?park:pickup)

same => n(park),Set(PARKINGEXTEN=${pos})
same => n,Park(${lot})

same => n(pickup),NoOp(${ARG1})
same => n,ParkedCall(${lot},${pos})

exten => i,1,Hangup()
exten => t,1,Hangup()
exten => h,1,Hangup()

[hints]
exten => _10XXX,hint,park:${EXTEN}@parkedcalls
exten => _ZXXXX,hint,SIP/${EXTEN}

res_parking.conf
[general]
parkeddynamic = yes

[10000]
findslot => first
parkinghints => yes
parkingtime => 60
comebacktoorigin => yes
parkedcalltransfers => both
parkedcallreparking => both

context => parkedcalls
parkext => 10000
parkpos => 10001-10020

I just found EXTENSION_STATE. I may see how that works since I’m using the parking space as an extension rather than a device.

Just in case anyone is interested, I have it mostly working. I just need to handle the reparks to the same position (pickup exten will park to a new position, any other extensions will just hang up - we don’t want the call to be picked up is it’s in use). I’ll post the code when I’m done.

I’m using subscribecontext=hints in sip.conf. Then, in my from-internal-sip context, I goto the hints,${EXTEN},1. Do a lookup in a table to see if the parking position is in use using AGI. Return the position, or look for the next empty one and return that position. All the while setting custom hints that get subscribed to from the phones.

When the parker presses the button, it dials 10001 (10002, 10003, etc.) which then parks or picks up the call in a parking lot containing 20001-29999. I set the custom hint to RINGING and the BLF starts blinking red.

When it’s picked up, the AGI returns the parking position, and the call is bridged (ParkedCall). The hint is set to INUSE and the BLF goes solid red.

When the call ends, the hint is set to NOT_INUSE, and the BLF goes back to green. The database is updated so that parking position is available again.

I wouldn’t label it a hack, but more of a round-about.

I found the answer, but it wasn’t as asterisk issue. It was a # in the extended function of the soft key.

So in asterisk…

res_parking.conf

[locallot] 
findslot => first
;parkinghints => yes
parkingtime => 300 
comebacktoorigin => yes
parkedcalltransfers => both
parkedcallreparking => both
;parkext_exclusive=yes

context => parkedcalls
parkext => 10000
parkpos => 10001-10999

sip.conf

[general]
context=default 
allowguest=no
srvlookup=no
udpbindaddr=0.0.0.0 
tcpenable=yes                  

disallow=all
allow=ulaw
allow=alaw
allow=gsm

rtcachefriends=yes

subscribecontext=hints
callcounter=yes
busylevel=1
allowsubscribe=yes
notifyringing=yes
match_auth_username=yes

extensions.conf

[from-internal-sip]
include => parkedcalls
;;;;;;;;;;Parking;;;;;;;;;;;;;
exten	=> _10XXX,1,Goto(hints,${EXTEN},1)
same	=> n,Hangup()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
...
[hints]
exten => _ZXXXX,hint,SIP/${EXTEN}

exten	=> _10XXX,hint,Custom:${EXTEN}@hints
exten	=> _10XXX,1,NoOp(Parking for ${EXTEN} State: ${DEVICE_STATE(Custom:${pos}@hints)})
same	=> n,Set(lot=locallot)
same	=> n,Set(pos=${EXTEN})
same	=> n,Set(PARKINGEXTEN=${pos})

same	=> n,GotoIf($["${DEVICE_STATE(Custom:${pos}@hints)}"="RINGING"]?pickup:park)

same	=> n(park),Set(DEVICE_STATE(Custom:${EXTEN}@hints)=RINGING)
same	=> n,Park(${lot})
same	=> n,Hangup()

same	=> n(pickup),Set(DEVICE_STATE(Custom:${pos}@hints)=INUSE)
same	=> n,ParkedCall(${lot},${pos})
same	=> n,Hangup()

exten	=> i,1,Hangup()
exten	=> t,1,Hangup()
exten	=> h,1,Set(DEVICE_STATE(Custom:${pos}@hints)=NOT_INUSE)
same	=> n,Hangup()

On the phone, under Attended Console, change…
Server Type to RFC3265_4235

For the Extended Function keys in the Phone tab…
fnc=sd+blf;ext=10001#@$PROXY;sub=10001@$PROXY;
fnc=sd+blf;ext=10002#@$PROXY;sub=10002@$PROXY;
fnc=sd+blf;ext=10003#@$PROXY;sub=10003@$PROXY;

That should give 3 parking spots for any phones you add them to.