Make it so that if a call is parked to an occupied parking lot it is returned to sender.

This commit is contained in:
Mark Crane 2013-09-16 21:35:37 +00:00
parent 57aa300ce4
commit eb7acb1f53
1 changed files with 37 additions and 27 deletions

View File

@ -194,7 +194,17 @@
event:addHeader("answer-state", "confirmed");
event:fire();
--start the fifo monitor on its own so that it doesn't block the script execution
api = freeswitch.API();
cmd = "luarun park_monitor.lua "..uuid.." "..domain_name.." "..park_extension.." "..park_timeout_type.." "..park_timeout_seconds.." "..park_timeout_destination;
result = api:executeString(cmd);
else
context = session:getVariable("context");
caller_id_number = session:getVariable("caller_id_number");
dialed_extension = session:getVariable("dialed_extension");
dialed_user = session:getVariable("dialed_user");
cmd = "user_exists id ".. caller_id_number .." "..domain_name;
if (api:executeString(cmd) == "true") then
--bridge the current call to the call that is parked
--set the presence to terminated
event = freeswitch.Event("PRESENCE_IN");
@ -221,13 +231,13 @@
--connect the calls
cmd = "uuid_bridge "..uuid.." "..lot_uuid;
result = trim(api:executeString(cmd));
else
--transfer the call back to the callee
session:execute("transfer", dialed_user .." XML "..context);
end
end
--continue running when the session ends
session:setAutoHangup(false);
--start the fifo monitor on its own so that it doesn't block the script execution
api = freeswitch.API();
cmd = "luarun park_monitor.lua "..uuid.." "..domain_name.." "..park_extension.." "..park_timeout_type.." "..park_timeout_seconds.." "..park_timeout_destination;
result = api:executeString(cmd);
end