Jeremy,<br><br>My apologies for taking so long to reply. I was kicking around ways to do this. Comments inline.<br><br><div class="gmail_quote">On Tue, Oct 5, 2010 at 11:10 AM, Jeremy Stricker <span dir="ltr"><<a href="mailto:jstricker@lightnex.com" target="_blank">jstricker@lightnex.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hello all,<br>
<br>
Is there anyway to set a call timeout when a call is valet parked so<br>
that it will ring back to the extension that parked it if it isn't<br>
answered by the intended recipient? We have an user who parks calls and<br>
then blindly announces the parking spot over an intercom. With this<br>
setup there is a great risk of a caller getting stuck in park. If there<br>
isn't a timeout method, can anyone recommend any alternate setup that<br>
would allow at least two parking spots with visual indication of calls<br>
parked on the handsets (Aastra 6730i and 6757i).<br></blockquote><div><br>I couldn't find a simple way to do this but the following method worked for me in a lab environment. Assume that 6100 is the park extension and 6101-6199 are the parking stalls. Add these <condition> blocks to the end of your "global" extension (it needs to be executed for every call):<br>
<br><font size="1"><span style="font-family: courier new,monospace;"> <condition field="${ani}" expression="^(10\d\d)$"> <!-- include only 'parker' extensions --></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"></span></font><font size="1"><span style="font-family: courier new,monospace;"> <condition field="destination_number" expression="^(6100)$"></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"> <anti-action application="hash" data="insert/valet_recall/${destination_number}/${uuid}"/></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </condition></span></font><br style="font-family: courier new,monospace;"><br>Then create the valet_park extensions:<br><br><font size="1"><span style="font-family: courier new,monospace;"> <extension name="valet_park_retrieve"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> <condition field="destination_number" expression="^(61\d[1-9])$"></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> <action application="answer"/><br>
<action application="lua" data="cancel_valet_recall.lua valet_lot $1"/><br style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"> <action application="valet_park" data="valet_lot $1"/></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </condition></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </extension></span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> <extension
name="valet_park_with_recall_timer"></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
<condition field="destination_number" expression="^(6100)$"></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
<action application="answer"/></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> <action application="set" data="valet_uuid=${hash(select/valet_recall/${caller_id_number})}"/></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> <action application="log" data="INFO Pulled [${valet_uuid}] from hash valet_recall/${caller_id_number}"/><br> <!-- the magic happens on the next line. The +30 means 30 seconds later x-fer the call back to the parker --><br style="font-family: courier new,monospace;">
</span><span style="font-family: courier new,monospace;"> <action application="set" data="api_res=${sched_api +30 uuid_transfer ${valet_uuid} ${valet_uuid} ${ani}}"/> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> <action application="valet_park" data="valet_lot auto in 6101 6199"/></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
</span><span style="font-family: courier new,monospace;"> </condition></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
</extension></span></font><br>
<br>The trick is to use "sched_api" API to schedule the other leg to be transferred back to the parker. We use the hash API to store some information, namely the parker's extension number and the uuid of the parked leg. Change the +30 to however many seconds you want the call to be parked before recalling. Here's the catch: if someone does come along and grab that call out of the parking stall then we need to remove the scheduled transfer! I thought a Lua script would be the easiest way to handle that, so when the person picking up the parked call dials 6001 e.g. then it launches a quickie Lua script that removes the sched_api from the task list. Here's the Lua script:<br>
<br><font size="1"><span style="font-family: courier new,monospace;">-- cancel_valet_recall.lua</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-- </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">-- parse the valet lot in question and find the uuid for the extension</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-- remove the uuid from the sched task list since this call is now being unparked</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">--</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">valet_lot = argv[1]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">valet_ext = argv[2]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">uuid = session:getVariable('uuid') </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">--freeswitch.consoleLog('INFO','Lot: ' .. valet_lot .. ' , Ext: ' .. valet_ext .. ' , uuid: ' .. uuid .. "\n")</span><span style="font-family: courier new,monospace;"><br>
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">api = freeswitch.API()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">if ( valet_lot == nil and valet_ext == nil ) then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> -- improper args... (feel free to do some better error handling)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">else</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> -- sched_del uuid for the uuid in valet_lot, valet_ext</span><span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> valet_info = api:executeString('valet_info ' .. valet_lot)<br></span><span style="font-family: courier new,monospace;"> -- freeswitch.consoleLog("INFO","\n" .. valet_info .. "\n\n")<br>
</span><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> valet_data = string.match(valet_info,"<extension uuid=.->" .. valet_ext .. "</extension>")<br></span><span style="font-family: courier new,monospace;"> -- freeswitch.consoleLog("INFO","uuid data line is: " .. valet_data .. "\n\n")<br>
</span><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> valet_uuid = string.gsub(valet_data,'<extension uuid="(.-)">' .. valet_ext .. "</extension>","%1")<br></span><span style="font-family: courier new,monospace;"> --freeswitch.consoleLog("INFO","valet uuid is: " .. valet_uuid .. "\n\n")<br>
</span><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> -- perform the sched_del<br></span><span style="font-family: courier new,monospace;"> api_res = api:executeString('sched_del ' .. valet_uuid)<br></span><span style="font-family: courier new,monospace;"> --freeswitch.consoleLog("INFO","result of sched_del " .. valet_uuid .. " is " .. api_res .. "\n\n")<br>
</span><span style="font-family: courier new,monospace;">end </span></font><br><br>Throw this into conf/scripts/cancel_valet_recall.lua and give it a shot. Let me know how it goes. If it works and if no one has any obvious improvements then I will toss it up on the wiki as an example of how to do a valet_park recall timer. <br>
<br>If you want to learn more about how this works then uncomment the log statements in the Lua script. Also after parking but before picking up the call go to the fs_cli and do "show tasks" and you'll see what the task looks like. I used the parked leg's uuid as the 'group id' in sched_api so that it is easy to find and remove when unparking the call.<br>
<br>Have fun and let me know if this helps or not.<br>-MC<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Secondly, is there anyway to stop read-back of the parking spot on the<br>
parkee's side of the call? Currently, the parker performs an attended<br>
transfer, waits for and hears the spot read-back. The parkee hears MOH<br>
while the transfer is being performed, but then the spot announcement<br>
themselves as soon as the parker finishes the attended transfer by<br>
hanging up.<br></blockquote><div><br>The parker is hanging up too soon. If he/she waits until he/she hears music and then completes the transfer it should be okay. I just tested this.<br>-MC<br>
</div></div><br>