Update disa.lua

This commit is contained in:
FusionPBX 2019-09-29 15:35:26 -06:00 committed by GitHub
parent 822de6b21f
commit f50b7be40a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 14 deletions

View File

@ -16,15 +16,15 @@
--
-- The Initial Developer of the Original Code is
-- Mark J Crane <markjcrane@fusionpbx.com>
-- Copyright (C) 2010-2018
-- Copyright (C) 2010-2019
-- the Initial Developer. All Rights Reserved.
--
-- Contributor(s):
-- Mark J Crane <markjcrane@fusionpbx.com>
--predefined variables
predefined_destination = "";
fallback_destination = "";
predefined_destination = '';
fallback_destination = '';
--define the trim function
require "resources.functions.trim";
@ -47,8 +47,8 @@
sound_extension = session:getVariable("sound_extension");
pin_number = session:getVariable("pin_number");
sounds_dir = session:getVariable("sounds_dir");
caller_id_name = session:getVariable("caller_id_name");
caller_id_number = session:getVariable("caller_id_number");
--caller_id_name = session:getVariable("caller_id_name");
--caller_id_number = session:getVariable("caller_id_number");
predefined_destination = session:getVariable("predefined_destination");
fallback_destination = session:getVariable("fallback_destination");
digit_min_length = session:getVariable("digit_min_length");
@ -131,6 +131,7 @@
if (predefined_destination) then
destination_number = predefined_destination;
else
session:sleep(1000);
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+");
if (string.len(destination_number) == 0 and fallback_destination) then
@ -178,6 +179,14 @@
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
if (session:ready()) then
if (user_exists == true) then
@ -185,8 +194,13 @@
session:execute("transfer", destination_number .. " XML " .. context);
else
--exteernal call
if (caller_id_name) then
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);
end
session:execute("transfer", destination_number .. " XML " .. context);
end
end