Add caller id prefix option to call park.

This commit is contained in:
Mark Crane
2012-10-23 04:59:09 +00:00
parent 6b7bb9e179
commit be23b9216e
2 changed files with 54 additions and 19 deletions
+38 -3
View File
@@ -1,5 +1,29 @@
-- park_monitor.lua -- park_monitor.lua
--Date: 4 Oct. 2011 -- Part of FusionPBX
-- Copyright (C) 2010 Mark J Crane <markjcrane@fusionpbx.com>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- 2. Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--Description: --Description:
--if the call has been answered --if the call has been answered
--then send presence terminate, and delete from the database --then send presence terminate, and delete from the database
@@ -55,7 +79,6 @@
--delete the lot from the database --delete the lot from the database
dbh:query("DELETE from park WHERE lot = '"..park_extension.."' and domain = '"..domain_name.."' "); dbh:query("DELETE from park WHERE lot = '"..park_extension.."' and domain = '"..domain_name.."' ");
--end the loop --end the loop
break; break;
else else
@@ -132,12 +155,24 @@
--end the loop --end the loop
break; break;
end end
end end
--if the timeout was reached transfer the call --if the timeout was reached transfer the call
--get the park status
cmd = "uuid_getvar "..uuid.." park_status"; cmd = "uuid_getvar "..uuid.." park_status";
park_status = trim(api:executeString(cmd)); park_status = trim(api:executeString(cmd));
--get and set the the caller id prefix
cmd = "uuid_getvar "..uuid.." park_caller_id_prefix";
park_caller_id_prefix = trim(api:executeString(cmd));
if (park_caller_id_prefix) then
--get the caller id name
cmd = "uuid_getvar "..uuid.." effective_caller_id_name";
caller_id_name = trim(api:executeString(cmd));
--set the caller id name and prefix
cmd = "uuid_setvar "..uuid.." effective_caller_id_name '"..park_caller_id_prefix.."#"..caller_id_name.."'";
result = trim(api:executeString(cmd));
end
--transfer the call to the timeout destination
if (park_timeout_type == "transfer" and park_status == "timeout") then if (park_timeout_type == "transfer" and park_status == "timeout") then
--set the park status --set the park status
cmd = "uuid_setvar "..uuid.." park_status unparked"; cmd = "uuid_setvar "..uuid.." park_status unparked";