Update disa.lua
This commit is contained in:
@@ -16,15 +16,15 @@
|
|||||||
--
|
--
|
||||||
-- The Initial Developer of the Original Code is
|
-- The Initial Developer of the Original Code is
|
||||||
-- Mark J Crane <markjcrane@fusionpbx.com>
|
-- Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
-- Copyright (C) 2010-2018
|
-- Copyright (C) 2010-2019
|
||||||
-- the Initial Developer. All Rights Reserved.
|
-- the Initial Developer. All Rights Reserved.
|
||||||
--
|
--
|
||||||
-- Contributor(s):
|
-- Contributor(s):
|
||||||
-- Mark J Crane <markjcrane@fusionpbx.com>
|
-- Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
|
|
||||||
--predefined variables
|
--predefined variables
|
||||||
predefined_destination = "";
|
predefined_destination = '';
|
||||||
fallback_destination = "";
|
fallback_destination = '';
|
||||||
|
|
||||||
--define the trim function
|
--define the trim function
|
||||||
require "resources.functions.trim";
|
require "resources.functions.trim";
|
||||||
@@ -47,8 +47,8 @@
|
|||||||
sound_extension = session:getVariable("sound_extension");
|
sound_extension = session:getVariable("sound_extension");
|
||||||
pin_number = session:getVariable("pin_number");
|
pin_number = session:getVariable("pin_number");
|
||||||
sounds_dir = session:getVariable("sounds_dir");
|
sounds_dir = session:getVariable("sounds_dir");
|
||||||
caller_id_name = session:getVariable("caller_id_name");
|
--caller_id_name = session:getVariable("caller_id_name");
|
||||||
caller_id_number = session:getVariable("caller_id_number");
|
--caller_id_number = session:getVariable("caller_id_number");
|
||||||
predefined_destination = session:getVariable("predefined_destination");
|
predefined_destination = session:getVariable("predefined_destination");
|
||||||
fallback_destination = session:getVariable("fallback_destination");
|
fallback_destination = session:getVariable("fallback_destination");
|
||||||
digit_min_length = session:getVariable("digit_min_length");
|
digit_min_length = session:getVariable("digit_min_length");
|
||||||
@@ -131,6 +131,7 @@
|
|||||||
if (predefined_destination) then
|
if (predefined_destination) then
|
||||||
destination_number = predefined_destination;
|
destination_number = predefined_destination;
|
||||||
else
|
else
|
||||||
|
session:sleep(1000);
|
||||||
dtmf = ""; --clear dtmf digits to prepare for next dtmf request
|
dtmf = ""; --clear dtmf digits to prepare for next dtmf request
|
||||||
destination_number = session:playAndGetDigits(digit_min_length, digit_max_length, extension_tries, digit_timeout, "#", sound_extension, "", "\\d+");
|
destination_number = session:playAndGetDigits(digit_min_length, digit_max_length, extension_tries, digit_timeout, "#", sound_extension, "", "\\d+");
|
||||||
if (string.len(destination_number) == 0 and fallback_destination) then
|
if (string.len(destination_number) == 0 and fallback_destination) then
|
||||||
@@ -178,6 +179,14 @@
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--get the caller id number
|
||||||
|
--if (session:ready()) then
|
||||||
|
-- min_digits = 7;
|
||||||
|
-- max_digits = 20;
|
||||||
|
-- session:sleep(1000);
|
||||||
|
-- caller_id_number = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-id_number.wav", "", "\\d+");
|
||||||
|
--end
|
||||||
|
|
||||||
--send the destination
|
--send the destination
|
||||||
if (session:ready()) then
|
if (session:ready()) then
|
||||||
if (user_exists == true) then
|
if (user_exists == true) then
|
||||||
@@ -185,8 +194,13 @@
|
|||||||
session:execute("transfer", destination_number .. " XML " .. context);
|
session:execute("transfer", destination_number .. " XML " .. context);
|
||||||
else
|
else
|
||||||
--exteernal call
|
--exteernal call
|
||||||
|
if (caller_id_name) then
|
||||||
session:execute("set", "effective_caller_id_name="..caller_id_name);
|
session:execute("set", "effective_caller_id_name="..caller_id_name);
|
||||||
|
end
|
||||||
|
if (caller_id_number) then
|
||||||
|
session:execute("set", "outbound_caller_id_number="..caller_id_number);
|
||||||
session:execute("set", "effective_caller_id_number="..caller_id_number);
|
session:execute("set", "effective_caller_id_number="..caller_id_number);
|
||||||
|
end
|
||||||
session:execute("transfer", destination_number .. " XML " .. context);
|
session:execute("transfer", destination_number .. " XML " .. context);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user