mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Merge pull request #1053 from moteus/require_config
Change. Use `require "resources.functions.config"` to load config file.
This commit is contained in:
@@ -28,12 +28,12 @@
|
||||
-- Luis Daniel Lucio Qurioz <dlucio@okay.com.mx>
|
||||
|
||||
--connect to the database
|
||||
dofile(scripts_dir.."/resources/functions/database_handle.lua");
|
||||
require "resources.functions.database_handle";
|
||||
dbh = database_handle('system');
|
||||
|
||||
--include functions
|
||||
dofile(scripts_dir.."/resources/functions/trim.lua");
|
||||
dofile(scripts_dir.."/resources/functions/explode.lua");
|
||||
require "resources.functions.trim";
|
||||
require "resources.functions.explode";
|
||||
|
||||
--get the variables
|
||||
domain_name = session:getVariable("domain_name");
|
||||
@@ -329,16 +329,16 @@
|
||||
or ring_group_strategy == "sequence"
|
||||
or ring_group_strategy == "rollover") then
|
||||
session:execute("set", "group_confirm_key=exec");
|
||||
session:execute("set", "group_confirm_file=lua ".. scripts_dir .."/confirm.lua");
|
||||
session:execute("set", "group_confirm_file=lua ".. scripts_dir:gsub('\\','/') .."/confirm.lua");
|
||||
end
|
||||
|
||||
--determine confirm prompt
|
||||
if (destination_prompt == nil) then
|
||||
group_confirm = "confirm=false,";
|
||||
elseif (destination_prompt == "1") then
|
||||
group_confirm = "group_confirm_key=exec,group_confirm_file=lua ".. scripts_dir .."/confirm.lua,confirm=true,";
|
||||
group_confirm = "group_confirm_key=exec,group_confirm_file=lua ".. scripts_dir:gsub('\\','/') .."/confirm.lua,confirm=true,";
|
||||
elseif (destination_prompt == "2") then
|
||||
group_confirm = "group_confirm_key=exec,group_confirm_file=lua ".. scripts_dir .."/confirm.lua,confirm=true,";
|
||||
group_confirm = "group_confirm_key=exec,group_confirm_file=lua ".. scripts_dir:gsub('\\','/') .."/confirm.lua,confirm=true,";
|
||||
else
|
||||
group_confirm = "confirm=false,";
|
||||
end
|
||||
|
||||
@@ -23,27 +23,17 @@
|
||||
-- Mark J Crane <markjcrane@fusionpbx.com>
|
||||
|
||||
--include config.lua
|
||||
scripts_dir = string.sub(debug.getinfo(1).source,2,string.len(debug.getinfo(1).source)-(string.len(argv[0])+1));
|
||||
require "resources.functions.config";
|
||||
|
||||
--set variables
|
||||
max_tries = "3";
|
||||
digit_timeout = "5000";
|
||||
|
||||
--add a trim function
|
||||
function trim (s)
|
||||
return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
|
||||
end
|
||||
--define the trim function
|
||||
require "resources.functions.trim";
|
||||
|
||||
--add the explode function
|
||||
function explode ( seperator, str )
|
||||
local pos, arr = 0, {}
|
||||
for st, sp in function() return string.find( str, seperator, pos, true ) end do -- for each divider found
|
||||
table.insert( arr, string.sub( str, pos, st-1 ) ) -- attach chars left of current divider
|
||||
pos = sp + 1 -- jump past current divider
|
||||
end
|
||||
table.insert( arr, string.sub( str, pos ) ) -- attach chars right of last divider
|
||||
return arr
|
||||
end
|
||||
--define the explode function
|
||||
require "resources.functions.explode";
|
||||
|
||||
--get the argv values
|
||||
script_name = argv[0];
|
||||
|
||||
@@ -33,21 +33,11 @@
|
||||
uuid = argv[1];
|
||||
timeout = argv[2];
|
||||
|
||||
--add a trim function
|
||||
function trim (s)
|
||||
return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
|
||||
end
|
||||
--define the trim function
|
||||
require "resources.functions.trim";
|
||||
|
||||
--add the explode function
|
||||
function explode ( seperator, str )
|
||||
local pos, arr = 0, {}
|
||||
for st, sp in function() return string.find( str, seperator, pos, true ) end do -- for each divider found
|
||||
table.insert( arr, string.sub( str, pos, st-1 ) ) -- attach chars left of current divider
|
||||
pos = sp + 1 -- jump past current divider
|
||||
end
|
||||
table.insert( arr, string.sub( str, pos ) ) -- attach chars right of last divider
|
||||
return arr
|
||||
end
|
||||
--define the explode function
|
||||
require "resources.functions.explode";
|
||||
|
||||
--prepare the api
|
||||
api = freeswitch.API();
|
||||
|
||||
Reference in New Issue
Block a user