WhitespaceClean-resources/install/scripts

whitespace pass over files
for reference regex that was used s/[ \t]+(\r?\n)/\1/
This commit is contained in:
mafoo
2016-03-11 13:21:52 +00:00
parent 66ba2802bd
commit 0eb7d5ddac
55 changed files with 269 additions and 269 deletions

View File

@@ -74,7 +74,7 @@ This method causes the script to get its manadatory arguments directly from the
session:setVariable("call_block", "")
--send to the log
logger("D", "NOTICE", "params are: " .. string.format("'%s', '%s', '%s', '%s'", params["cid_num"],
logger("D", "NOTICE", "params are: " .. string.format("'%s', '%s', '%s', '%s'", params["cid_num"],
params["cid_name"], params["userid"], params["domain_name"]));
--get the cache
@@ -91,7 +91,7 @@ This method causes the script to get its manadatory arguments directly from the
require "resources.functions.database_handle";
dbh = database_handle('system');
--log if not connect
--log if not connect
if dbh:connected() == false then
logger("W", "NOTICE", "db was not connected")
end
@@ -108,7 +108,7 @@ This method causes the script to get its manadatory arguments directly from the
found_count = rows["call_block_count"];
end)
-- dbh:affected_rows() doesn't do anything if using core:db so this is the workaround:
--set the cache
if (found_cid_num) then -- caller id exists
if (found_enabled == "true") then

View File

@@ -26,7 +26,7 @@
--
-- Contributor(s):
-- Mark J Crane <markjcrane@fusionpbx.com>
-- Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
-- Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
--set variables
flags = "";
@@ -80,7 +80,7 @@
end
--get the moderator_pin
sql = [[SELECT moderator_pin FROM v_meetings
sql = [[SELECT moderator_pin FROM v_meetings
WHERE meeting_uuid = ']] .. meeting_uuid ..[[']];
freeswitch.consoleLog("notice", "[voicemail] sql: " .. sql .. "\n");
status = dbh:query(sql, function(row)
@@ -159,7 +159,7 @@
--get the conference sessions
if (conference_session_uuid) then
sql = [[SELECT count(*) as num_rows
sql = [[SELECT count(*) as num_rows
FROM v_conference_sessions
WHERE conference_session_uuid = ']] .. conference_session_uuid ..[[']];
status = dbh:query(sql, function(row)
@@ -435,7 +435,7 @@
--define the function get_pin_number
function get_pin_number(domain_uuid, prompt_audio_file)
--if the pin number is provided then require it
if (not pin_number) then
if (not pin_number) then
min_digits = 2;
max_digits = 20;
max_tries = 1;
@@ -447,16 +447,16 @@
WHERE r.domain_uuid = ']] .. domain_uuid ..[['
AND r.meeting_uuid = m.meeting_uuid
AND m.domain_uuid = ']] .. domain_uuid ..[['
AND (m.moderator_pin = ']] .. pin_number ..[[' or m.participant_pin = ']] .. pin_number ..[[')
AND (m.moderator_pin = ']] .. pin_number ..[[' or m.participant_pin = ']] .. pin_number ..[[')
AND r.enabled = 'true'
AND m.enabled = 'true'
AND (
( r.start_datetime <> '' AND r.start_datetime is not null AND r.start_datetime <= ']] .. os.date("%Y-%m-%d %X") .. [[' ) OR
( r.start_datetime = '' OR r.start_datetime is null )
( r.start_datetime <> '' AND r.start_datetime is not null AND r.start_datetime <= ']] .. os.date("%Y-%m-%d %X") .. [[' ) OR
( r.start_datetime = '' OR r.start_datetime is null )
)
AND (
( r.stop_datetime <> '' AND r.stop_datetime is not null AND r.stop_datetime > ']] .. os.date("%Y-%m-%d %X") .. [[' ) OR
( r.stop_datetime = '' OR r.stop_datetime is null )
( r.stop_datetime <> '' AND r.stop_datetime is not null AND r.stop_datetime > ']] .. os.date("%Y-%m-%d %X") .. [[' ) OR
( r.stop_datetime = '' OR r.stop_datetime is null )
) ]];
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[conference center] SQL: " .. sql .. "\n");
@@ -496,7 +496,7 @@
AND r.conference_center_uuid = ']] .. conference_center_uuid ..[['
AND m.domain_uuid = ']] .. domain_uuid ..[['
AND (m.moderator_pin = ']] .. pin_number ..[[' or m.participant_pin = ']] .. pin_number ..[[')
AND r.enabled = 'true'
AND r.enabled = 'true'
AND m.enabled = 'true'
]];
if (debug["sql"]) then

View File

@@ -17,7 +17,7 @@
api = freeswitch.API();
--check if the conference exists
cmd = "conference "..meeting_uuid.."-"..domain_name.." xml_list";
cmd = "conference "..meeting_uuid.."-"..domain_name.." xml_list";
freeswitch.consoleLog("INFO","" .. cmd .. "\n");
result = trim(api:executeString(cmd));
if (string.sub(result, -9) == "not found") then

View File

@@ -52,7 +52,7 @@
file_subject = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_subject.tpl";
file_body = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_body.tpl";
end
--prepare the headers
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",';
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",';
@@ -86,7 +86,7 @@
body = body:gsub("'", "&#39;");
body = body:gsub([["]], "&#34;");
body = trim(body);
--send the email
cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'";
if (debug["info"]) then
@@ -188,7 +188,7 @@
end
elseif (originate_disposition == "USER_NOT_REGISTERED") then
--handle USER_NOT_REGISTERED
forward_user_not_registered_enabled = session:getVariable("forward_user_not_registered_enabled");
if (forward_user_not_registered_enabled == "true") then
@@ -204,7 +204,7 @@
--send missed call notification
missed();
end
--send missed call notification
--missed();

View File

@@ -154,8 +154,8 @@
end
--get the fax settings from the database
sql = [[SELECT * FROM v_fax
WHERE fax_uuid = ']] .. fax_uuid ..[['
sql = [[SELECT * FROM v_fax
WHERE fax_uuid = ']] .. fax_uuid ..[['
AND domain_uuid = ']] .. domain_uuid ..[[']];
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[fax] SQL: " .. sql .. "\n");
@@ -196,7 +196,7 @@
cmd = quote(php_dir.."/"..php_bin).." "..quote(document_root.."/secure/fax_to_email.php").." ";
cmd = cmd .. "email="..quote(fax_email).." ";
cmd = cmd .. "extension="..quote(fax_extension).." ";
cmd = cmd .. "name="..quote(fax_file).." ";
cmd = cmd .. "name="..quote(fax_file).." ";
cmd = cmd .. "messages=" .. quote("result:"..fax_result_text.." sender:"..fax_remote_station_id.." pages:"..fax_document_total_pages).." ";
cmd = cmd .. "domain="..quote(domain_name).." ";
cmd = cmd .. "caller_id_name=" .. quote(caller_id_name or '') .. " ";

View File

@@ -22,7 +22,7 @@ local task if fax_task_uuid then
task = Tasks.select_task(fax_task_uuid)
if not task then
log.warningf("Can not found fax task: %q", tostring(fax_task_uuid))
return
return
end
end

View File

@@ -55,7 +55,7 @@ local function next_task()
local mode = (task.retry_counter % #FAX_OPTIONS) + 1
local dial_string = '{' ..
task.dial_string .. "api_hangup_hook='lua app/fax/resources/scripts/queue/retry.lua'," ..
FAX_OPTIONS[mode] ..
FAX_OPTIONS[mode] ..
'}' .. task.uri
local originate = 'originate ' .. dial_string .. ' &lua(app/fax/resources/scripts/queue/exec.lua)'

View File

@@ -12,12 +12,12 @@
local fax_task_uuid = env:getHeader('fax_task_uuid')
if not fax_task_uuid then
log.warning("No [fax_task_uuid] channel variable")
return
return
end
local task = Tasks.select_task(fax_task_uuid)
if not task then
log.warningf("Can not find fax task: %q", tostring(fax_task_uuid))
return
return
end
-- show all channel variables

View File

@@ -37,7 +37,7 @@ select
t1.fax_task_uuid as uuid,
t1.fax_uuid as fax_uuid,
t3.domain_name,
t3.domain_uuid,
t3.domain_uuid,
t1.task_status as status,
t1.task_uri as uri,
t1.task_dial_string as dial_string,
@@ -51,7 +51,7 @@ select
t2.fax_send_greeting as greeting
from v_fax_tasks t1
inner join v_fax t2 on t2.fax_uuid = t1.fax_uuid
inner join v_domains t3 on t2.domain_uuid = t3.domain_uuid
inner join v_domains t3 on t2.domain_uuid = t3.domain_uuid
where t1.task_interrupted <> 'true'
]]

View File

@@ -119,7 +119,7 @@
--authentication failed
if (authorized == 'false') then
result = session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-fail_auth.wav");
end
end
--this device already has an alternate find the correct device_uuid and then override current one
if (authorized == 'true' and action == "login" and device_uuid_alternate ~= nil) then

View File

@@ -203,17 +203,17 @@ local log = require "resources.functions.log".ring_group
else
--get the strategy of the ring group, if random, we use random() to order the destinations
sql = [[
SELECT
SELECT
r.ring_group_strategy
FROM
FROM
v_ring_groups as r
WHERE
ring_group_uuid = ']]..ring_group_uuid..[['
AND r.domain_uuid = ']]..domain_uuid..[['
AND r.ring_group_enabled = 'true'
WHERE
ring_group_uuid = ']]..ring_group_uuid..[['
AND r.domain_uuid = ']]..domain_uuid..[['
AND r.ring_group_enabled = 'true'
]];
assert(dbh:query(sql, function(row)
if (row.ring_group_strategy == "random") then
if (database["type"] == "mysql") then
@@ -223,23 +223,23 @@ local log = require "resources.functions.log".ring_group
end
else
sql_order='d.destination_delay, d.destination_number asc'
end
end
end));
--get the ring group destinations
sql = [[
SELECT
r.ring_group_strategy, r.ring_group_timeout_app, r.ring_group_distinctive_ring,
d.destination_number, d.destination_delay, d.destination_timeout, d.destination_prompt,
SELECT
r.ring_group_strategy, r.ring_group_timeout_app, r.ring_group_distinctive_ring,
d.destination_number, d.destination_delay, d.destination_timeout, d.destination_prompt,
r.ring_group_timeout_data, r.ring_group_cid_name_prefix, r.ring_group_cid_number_prefix, r.ring_group_ringback, r.ring_group_skip_active
FROM
FROM
v_ring_groups as r, v_ring_group_destinations as d
WHERE
d.ring_group_uuid = r.ring_group_uuid
AND d.ring_group_uuid = ']]..ring_group_uuid..[['
AND r.domain_uuid = ']]..domain_uuid..[['
AND r.ring_group_enabled = 'true'
ORDER BY
WHERE
d.ring_group_uuid = r.ring_group_uuid
AND d.ring_group_uuid = ']]..ring_group_uuid..[['
AND r.domain_uuid = ']]..domain_uuid..[['
AND r.ring_group_enabled = 'true'
ORDER BY
]]..sql_order..[[
]];
--freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n");
@@ -282,21 +282,21 @@ local log = require "resources.functions.log".ring_group
--get the dialplan data and save it to a table
if (external) then
sql = [[select * from v_dialplans as d, v_dialplan_details as s
sql = [[select * from v_dialplans as d, v_dialplan_details as s
where (d.domain_uuid = ']] .. domain_uuid .. [[' or d.domain_uuid is null)
and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'
and d.dialplan_enabled = 'true'
and d.dialplan_uuid = s.dialplan_uuid
order by
d.dialplan_order asc,
d.dialplan_name asc,
d.dialplan_uuid asc,
s.dialplan_detail_group asc,
CASE s.dialplan_detail_tag
WHEN 'condition' THEN 1
WHEN 'action' THEN 2
WHEN 'anti-action' THEN 3
ELSE 100 END,
and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'
and d.dialplan_enabled = 'true'
and d.dialplan_uuid = s.dialplan_uuid
order by
d.dialplan_order asc,
d.dialplan_name asc,
d.dialplan_uuid asc,
s.dialplan_detail_group asc,
CASE s.dialplan_detail_tag
WHEN 'condition' THEN 1
WHEN 'action' THEN 2
WHEN 'anti-action' THEN 3
ELSE 100 END,
s.dialplan_detail_order asc ]]
--freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n");
dialplans = {};
@@ -374,7 +374,7 @@ local log = require "resources.functions.log".ring_group
end
--set confirm
if (ring_group_strategy == "simultaneous"
if (ring_group_strategy == "simultaneous"
or ring_group_strategy == "sequence"
or ring_group_strategy == "rollover") then
session:execute("set", "group_confirm_key=exec");
@@ -413,7 +413,7 @@ local log = require "resources.functions.log".ring_group
--record the session
if (record_session) then
record_session = ",api_on_answer='uuid_record "..uuid.." start ".. record_file .. "'";
else
else
record_session = ""
end
row.record_session = record_session
@@ -569,8 +569,8 @@ local log = require "resources.functions.log".ring_group
--if the timeout was reached go to the timeout action
if (x > 0) then
if (session:getVariable("originate_disposition") == "ALLOTTED_TIMEOUT"
or session:getVariable("originate_disposition") == "NO_ANSWER"
if (session:getVariable("originate_disposition") == "ALLOTTED_TIMEOUT"
or session:getVariable("originate_disposition") == "NO_ANSWER"
or session:getVariable("originate_disposition") == "NO_USER_RESPONSE") then
break;
end
@@ -609,12 +609,12 @@ local log = require "resources.functions.log".ring_group
--timeout destination
if (app_data ~= nil) then
if session:ready() and (
session:getVariable("originate_disposition") == "ALLOTTED_TIMEOUT"
or session:getVariable("originate_disposition") == "NO_ANSWER"
or session:getVariable("originate_disposition") == "NO_USER_RESPONSE"
or session:getVariable("originate_disposition") == "USER_NOT_REGISTERED"
or session:getVariable("originate_disposition") == "NORMAL_TEMPORARY_FAILURE"
or session:getVariable("originate_disposition") == "NO_ROUTE_DESTINATION"
session:getVariable("originate_disposition") == "ALLOTTED_TIMEOUT"
or session:getVariable("originate_disposition") == "NO_ANSWER"
or session:getVariable("originate_disposition") == "NO_USER_RESPONSE"
or session:getVariable("originate_disposition") == "USER_NOT_REGISTERED"
or session:getVariable("originate_disposition") == "NORMAL_TEMPORARY_FAILURE"
or session:getVariable("originate_disposition") == "NO_ROUTE_DESTINATION"
or session:getVariable("originate_disposition") == "USER_BUSY"
or session:getVariable("originate_disposition") == "failure"
) then

View File

@@ -25,7 +25,7 @@
--include config.lua
require "resources.functions.config";
--connect to the database
require "resources.functions.database_handle";
dbh = database_handle('system');
@@ -109,7 +109,7 @@
SELECT COUNT(*) AS in_group FROM
v_ring_group_destinations
WHERE
domain_uuid = ']]..domain_uuid..[['
domain_uuid = ']]..domain_uuid..[['
AND ring_group_uuid = ']]..ring_group_uuid..[['
AND destination_number = ']]..destination..[['
]];
@@ -118,21 +118,21 @@
assert(dbh:query(sql, function(row)
if (row.in_group == "0") then
sql = [[
INSERT INTO
v_ring_group_destinations
INSERT INTO
v_ring_group_destinations
( ring_group_destination_uuid,
domain_uuid,
ring_group_uuid,
domain_uuid,
ring_group_uuid,
destination_number,
destination_delay,
destination_timeout
)
VALUES
)
VALUES
( ']]..ring_group_destination_uuid..[[',
']]..domain_uuid..[[',
']]..ring_group_uuid..[[',
']]..destination..[[',
]]..destination_delay..[[,
']]..domain_uuid..[[',
']]..ring_group_uuid..[[',
']]..destination..[[',
]]..destination_delay..[[,
]]..destination_timeout..[[
)]];
freeswitch.consoleLog("NOTICE", "[ring_group][destination] SQL "..sql.."\n");
@@ -148,11 +148,11 @@
end
if (menu_selection == "2") then
sql = [[
DELETE FROM
v_ring_group_destinations
WHERE
domain_uuid =']]..domain_uuid..[['
AND ring_group_uuid=']]..ring_group_uuid..[['
DELETE FROM
v_ring_group_destinations
WHERE
domain_uuid =']]..domain_uuid..[['
AND ring_group_uuid=']]..ring_group_uuid..[['
AND destination_number=']]..destination..[['
]];
freeswitch.consoleLog("NOTICE", "[ring_group][destination] SQL "..sql.."\n");

View File

@@ -25,7 +25,7 @@
--include config.lua
require "resources.functions.config";
--connect to the database
require "resources.functions.database_handle";
dbh = database_handle('system');
@@ -100,7 +100,7 @@
SELECT COUNT(*) AS in_group FROM
v_ring_group_destinations
WHERE
domain_uuid = ']]..domain_uuid..[['
domain_uuid = ']]..domain_uuid..[['
AND ring_group_uuid = ']]..ring_group_uuid..[['
AND destination_number = ']]..destination_number..[['
]];
@@ -109,21 +109,21 @@
assert(dbh:query(sql, function(row)
if (row.in_group == "0") then
sql = [[
INSERT INTO
v_ring_group_destinations
INSERT INTO
v_ring_group_destinations
( ring_group_destination_uuid,
domain_uuid,
ring_group_uuid,
domain_uuid,
ring_group_uuid,
destination_number,
destination_delay,
destination_timeout
)
VALUES
)
VALUES
( ']]..ring_group_destination_uuid..[[',
']]..domain_uuid..[[',
']]..ring_group_uuid..[[',
']]..destination..[[',
]]..destination_delay..[[,
']]..domain_uuid..[[',
']]..ring_group_uuid..[[',
']]..destination..[[',
]]..destination_delay..[[,
]]..destination_timeout..[[
)]];
freeswitch.consoleLog("NOTICE", "[ring_group][destination] SQL "..sql.."\n");
@@ -139,11 +139,11 @@
end
if (menu_selection == "2") then
sql = [[
DELETE FROM
v_ring_group_destinations
WHERE
domain_uuid =']]..domain_uuid..[['
AND ring_group_uuid=']]..ring_group_uuid..[['
DELETE FROM
v_ring_group_destinations
WHERE
domain_uuid =']]..domain_uuid..[['
AND ring_group_uuid=']]..ring_group_uuid..[['
AND destination_number=']]..destination..[['
]];
freeswitch.consoleLog("NOTICE", "[ring_group][destination] SQL "..sql.."\n");

View File

@@ -183,7 +183,7 @@
if (voicemail_attach_file == nil) then
voicemail_attach_file = "true";
end
--valid voicemail
if (voicemail_uuid ~= nil) then
--answer the session
@@ -340,7 +340,7 @@
end
--get the voicemail destinations
sql = [[select * from v_voicemail_destinations
sql = [[select * from v_voicemail_destinations
where voicemail_uuid = ']]..voicemail_uuid..[[']]
--freeswitch.consoleLog("notice", "[voicemail][destinations] SQL:" .. sql .. "\n");
destinations = {};
@@ -361,7 +361,7 @@
--determine uuid
if (y == 1) then
voicemail_message_uuid = uuid;
else
else
voicemail_message_uuid = api:execute("create_uuid");
end
y = y + 1;
@@ -506,7 +506,7 @@
--callback (works with DTMF)
--http://wiki.freeswitch.org/wiki/Mod_fsv
--mkdir(voicemail_dir.."/"..voicemail_id);
--session:recordFile(file_name, max_len_secs, silence_threshold, silence_secs)
--session:recordFile(file_name, max_len_secs, silence_threshold, silence_secs)
--session:sayPhrase(macro_name [,macro_data] [,language]);
--session:sayPhrase("voicemail_menu", "1:2:3:#", default_language);
--session:streamFile("directory/dir-to_select_entry.wav"); --works with setInputCallback

View File

@@ -38,7 +38,7 @@
--check to see if the greeting file exists
if (storage_type == "base64" or storage_type == "http_cache") then
greeting_invalid = true;
sql = [[SELECT * FROM v_voicemail_greetings
sql = [[SELECT * FROM v_voicemail_greetings
WHERE domain_uuid = ']] .. domain_uuid ..[['
AND voicemail_id = ']].. voicemail_id.. [['
AND greeting_id = ']].. greeting_id.. [[' ]];
@@ -59,20 +59,20 @@
end
--validate the greeting_id
if (greeting_id == "0"
or greeting_id == "1"
or greeting_id == "2"
or greeting_id == "3"
or greeting_id == "4"
or greeting_id == "5"
or greeting_id == "6"
or greeting_id == "7"
or greeting_id == "8"
if (greeting_id == "0"
or greeting_id == "1"
or greeting_id == "2"
or greeting_id == "3"
or greeting_id == "4"
or greeting_id == "5"
or greeting_id == "6"
or greeting_id == "7"
or greeting_id == "8"
or greeting_id == "9") then
--valid greeting_id update the database
if (session:ready()) then
if (greeting_id == "0") then
if (greeting_id == "0") then
sql = [[UPDATE v_voicemails SET greeting_id = null ]];
else
sql = [[UPDATE v_voicemails SET greeting_id = ']]..greeting_id..[[' ]];
@@ -87,7 +87,7 @@
--get the greeting from the database
if (storage_type == "base64") then
sql = [[SELECT * FROM v_voicemail_greetings
sql = [[SELECT * FROM v_voicemail_greetings
WHERE domain_uuid = ']] .. domain_uuid ..[['
AND voicemail_id = ']].. voicemail_id.. [['
AND greeting_id = ']].. greeting_id.. [[' ]];

View File

@@ -42,7 +42,7 @@
end
--say the message number
if (session:ready()) then
if (string.len(dtmf_digits) == 0) then
if (string.len(dtmf_digits) == 0) then
dtmf_digits = macro(session, "message_number", 1, 100, '');
end
end
@@ -72,7 +72,7 @@
end
--get the recordings from the database
if (storage_type == "base64") then
sql = [[SELECT * FROM v_voicemail_messages
sql = [[SELECT * FROM v_voicemail_messages
WHERE domain_uuid = ']] .. domain_uuid ..[['
AND voicemail_message_uuid = ']].. uuid.. [[' ]];
if (debug["sql"]) then

View File

@@ -136,7 +136,7 @@
table.insert(actions, {app="streamFile",data="voicemail/vm-press.wav"});
table.insert(actions, {app="streamFile",data="digits/3.wav"});
end
--At the tone please record your name press any key or stop talking to end the recording
--At the tone please record your name press any key or stop talking to end the recording
if (name == "record_name") then
table.insert(actions, {app="streamFile",data="voicemail/vm-record_name1.wav"});
table.insert(actions, {app="tone_stream",data="L=1;%(1000, 0, 640)"});

View File

@@ -29,7 +29,7 @@
local accounts = {}
table.insert(accounts, voicemail_id);
--get the voicemail id and all related mwi accounts
sql = [[SELECT extension, number_alias from v_extensions
sql = [[SELECT extension, number_alias from v_extensions
WHERE domain_uuid = ']] .. domain_uuid ..[['
AND (mwi_account = ']]..voicemail_id..[[' or mwi_account = ']]..voicemail_id..[[@]]..domain_name..[[')]];
if (debug["sql"]) then
@@ -47,7 +47,7 @@
sql = [[SELECT count(*) as message_count FROM v_voicemail_messages as m, v_voicemails as v
WHERE v.domain_uuid = ']] .. domain_uuid ..[['
AND v.voicemail_uuid = m.voicemail_uuid
AND v.voicemail_id = ']] .. voicemail_id ..[['
AND v.voicemail_id = ']] .. voicemail_id ..[['
AND (m.message_status is null or m.message_status = '') ]];
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n");
@@ -57,7 +57,7 @@
end);
--send the message waiting event
for key,value in pairs(accounts) do
for key,value in pairs(accounts) do
local event = freeswitch.Event("message_waiting");
if (message_count == "0") then
if (debug["info"]) then

View File

@@ -26,7 +26,7 @@
--define on_dtmf call back function
function on_dtmf(s, type, obj, arg)
if (type == "dtmf") then
freeswitch.console_log("info", "[voicemail] dtmf digit: " .. obj['digit'] .. ", duration: " .. obj['duration'] .. "\n");
freeswitch.console_log("info", "[voicemail] dtmf digit: " .. obj['digit'] .. ", duration: " .. obj['duration'] .. "\n");
if (obj['digit'] == "#") then
return 0;
else

View File

@@ -43,7 +43,7 @@
--get the greeting from the database
if (storage_type == "base64") then
sql = [[SELECT * FROM v_voicemail_greetings
sql = [[SELECT * FROM v_voicemail_greetings
WHERE domain_uuid = ']] .. domain_uuid ..[['
AND voicemail_id = ']].. voicemail_id.. [['
AND greeting_id = ']].. greeting_id.. [[' ]];

View File

@@ -39,14 +39,14 @@
end
--validate the greeting_id
if (greeting_id == "1"
or greeting_id == "2"
or greeting_id == "3"
or greeting_id == "4"
or greeting_id == "5"
or greeting_id == "6"
or greeting_id == "7"
or greeting_id == "8"
if (greeting_id == "1"
or greeting_id == "2"
or greeting_id == "3"
or greeting_id == "4"
or greeting_id == "5"
or greeting_id == "6"
or greeting_id == "7"
or greeting_id == "8"
or greeting_id == "9") then
--record your greeting at the tone press any key or stop talking to end the recording
if (session:ready()) then
@@ -59,7 +59,7 @@
freeswitch.consoleLog("notice", "[voicemail] ".. storage_type .. " ".. storage_path .."\n");
storage_path = storage_path:gsub("${domain_name}", domain_name);
session:execute("record", storage_path .."/"..recording_name);
else
else
--prepare to record the greeting
if (session:ready()) then
max_len_seconds = 30;
@@ -101,12 +101,12 @@
end
end
end
--clean up any tmp greeting files
for gid = 1, 9, 1 do
if (file_exists(voicemail_dir.."/"..voicemail_id.."/greeting_"..gid..".tmp.wav")) then
os.remove(voicemail_dir.."/"..voicemail_id.."/greeting_"..gid..".tmp.wav");
end
end
end

View File

@@ -170,7 +170,7 @@
--remove temporary greeting file, if any
if (file_exists(tmp_file)) then
os.remove(tmp_file);
end
end
record_greeting(greeting_id);
end
if (type == "name") then
@@ -181,8 +181,8 @@
--remove temporary greeting file, if any
if (file_exists(tmp_file)) then
os.remove(tmp_file);
end
end
end
end
--hangup
if (session:ready()) then
dtmf_digits = '';
@@ -205,7 +205,7 @@
--remove temporary greeting file, if any
if (file_exists(tmp_file)) then
os.remove(tmp_file);
end
end
advanced();
end
if (type == "name") then

View File

@@ -40,7 +40,7 @@
if (dtmf_digits == nil) then
dtmf_digits = session:getDigits(max_digits, "#", 1000);
else
dtmf_digits = dtmf_digits .. session:getDigits(max_digits, "#", 1000);
dtmf_digits = dtmf_digits .. session:getDigits(max_digits, "#", 1000);
end
end
if (dtmf_digits) then
@@ -166,10 +166,10 @@
--delete the wav file, if mp3 exists
if (file_exists(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".mp3")) then
os.remove(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav");
else
else
vm_message_ext = "wav";
end
else
else
freeswitch.consoleLog("notice", "neither mod_shout or lame found, defaulting to wav\n");
vm_message_ext = "wav";
end

View File

@@ -189,7 +189,7 @@
os.remove(file);
end
end
end
end

View File

@@ -36,7 +36,7 @@
debug["sql"] = false;
debug["info"] = false;
--only run the script a single time
--only run the script a single time
runonce = true
--connect to the database
require "resources.functions.database_handle";
@@ -65,10 +65,10 @@
end
--Send MWI events for voicemail boxes with messages
sql = [[SELECT v.voicemail_id, v.voicemail_uuid, v.domain_uuid, d.domain_name, COUNT(*) AS message_count
FROM v_voicemail_messages as m, v_voicemails as v, v_domains as d
WHERE v.voicemail_uuid = m.voicemail_uuid
AND v.domain_uuid = d.domain_uuid
sql = [[SELECT v.voicemail_id, v.voicemail_uuid, v.domain_uuid, d.domain_name, COUNT(*) AS message_count
FROM v_voicemail_messages as m, v_voicemails as v, v_domains as d
WHERE v.voicemail_uuid = m.voicemail_uuid
AND v.domain_uuid = d.domain_uuid
GROUP BY v.voicemail_id, v.voicemail_uuid, v.domain_uuid, d.domain_name;]];
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n");
@@ -120,5 +120,5 @@
--slow the loop down
os.execute("sleep "..sleep);
end
end

View File

@@ -59,7 +59,7 @@
table.insert(xml, [[ <control action="vol listen dn" digits="4"/>]]);
table.insert(xml, [[ <control action="hangup" digits=""/>]]);
table.insert(xml, [[ <control action="execute_application" digits="0" data="lua app/conference_center/resources/scripts/mute.lua non_moderator"/>]]);
table.insert(xml, [[ <control action="execute_application" digits="*" data="lua app/conference_center/resources/scripts/unmute.lua non_moderator"/>]]);
table.insert(xml, [[ <control action="execute_application" digits="*" data="lua app/conference_center/resources/scripts/unmute.lua non_moderator"/>]]);
table.insert(xml, [[ </group>]]);
table.insert(xml, [[ <group name="page">]]);
table.insert(xml, [[ <control action="mute" digits="0"/>]]);

View File

@@ -44,7 +44,7 @@
assert(dbh:connected());
--get the ivr menu from the database
sql = [[SELECT * FROM v_ivr_menus
sql = [[SELECT * FROM v_ivr_menus
WHERE ivr_menu_uuid = ']] .. ivr_menu_uuid ..[['
AND ivr_menu_enabled = 'true' ]];
if (debug["sql"]) then
@@ -86,7 +86,7 @@
--greet long
if (string.len(ivr_menu_greet_long) > 1) then
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long)) then
sql = [[SELECT * FROM v_recordings
sql = [[SELECT * FROM v_recordings
WHERE domain_uuid = ']]..domain_uuid..[['
AND recording_filename = ']]..ivr_menu_greet_long..[[' ]];
if (debug["sql"]) then
@@ -110,7 +110,7 @@
--greet short
if (string.len(ivr_menu_greet_short) > 1) then
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_short)) then
sql = [[SELECT * FROM v_recordings
sql = [[SELECT * FROM v_recordings
WHERE domain_uuid = ']]..domain_uuid..[['
AND recording_filename = ']]..ivr_menu_greet_short..[[' ]];
if (debug["sql"]) then
@@ -134,7 +134,7 @@
--invalid sound
if (string.len(ivr_menu_invalid_sound) > 1) then
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_invalid_sound)) then
sql = [[SELECT * FROM v_recordings
sql = [[SELECT * FROM v_recordings
WHERE domain_uuid = ']]..domain_uuid..[['
AND recording_filename = ']]..ivr_menu_invalid_sound..[[' ]];
if (debug["sql"]) then
@@ -158,7 +158,7 @@
--exit sound
if (string.len(ivr_menu_exit_sound) > 1) then
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound)) then
sql = [[SELECT * FROM v_recordings
sql = [[SELECT * FROM v_recordings
WHERE domain_uuid = ']]..domain_uuid..[['
AND recording_filename = ']]..ivr_menu_exit_sound..[[' ]];
if (debug["sql"]) then

View File

@@ -170,27 +170,27 @@
--determine the type of condition
if (dialplan_detail_type == "hour") then
condition_type = 'time';
elseif (dialplan_detail_type == "minute") then
elseif (dialplan_detail_type == "minute") then
condition_type = 'time';
elseif (dialplan_detail_type == "minute-of-day") then
elseif (dialplan_detail_type == "minute-of-day") then
condition_type = 'time';
elseif (dialplan_detail_type == "mday") then
elseif (dialplan_detail_type == "mday") then
condition_type = 'time';
elseif (dialplan_detail_type == "mweek") then
elseif (dialplan_detail_type == "mweek") then
condition_type = 'time';
elseif (dialplan_detail_type == "mon") then
elseif (dialplan_detail_type == "mon") then
condition_type = 'time';
elseif (dialplan_detail_type == "time-of-day") then
elseif (dialplan_detail_type == "time-of-day") then
condition_type = 'time';
elseif (dialplan_detail_type == "yday") then
elseif (dialplan_detail_type == "yday") then
condition_type = 'time';
elseif (dialplan_detail_type == "year") then
elseif (dialplan_detail_type == "year") then
condition_type = 'time';
elseif (dialplan_detail_type == "wday") then
elseif (dialplan_detail_type == "wday") then
condition_type = 'time';
elseif (dialplan_detail_type == "week") then
elseif (dialplan_detail_type == "week") then
condition_type = 'time';
elseif (dialplan_detail_type == "date-time") then
elseif (dialplan_detail_type == "date-time") then
condition_type = 'time';
else
condition_type = 'default';

View File

@@ -57,9 +57,9 @@
--build the call group array
sql = [[
select * from v_extensions
where domain_uuid = ']]..domain_uuid..[['
order by call_group asc
select * from v_extensions
where domain_uuid = ']]..domain_uuid..[['
order by call_group asc
]];
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n");

View File

@@ -26,7 +26,7 @@
--
-- Contributor(s):
-- Mark J Crane <markjcrane@fusionpbx.com>
-- Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
-- Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
--set the default
continue = true;
@@ -46,7 +46,7 @@
number_alias_string = "";
vm_mailto = "";
-- event source
-- event source
local event_calling_function = params:getHeader("Event-Calling-Function")
local event_calling_file = params:getHeader("Event-Calling-File")
@@ -67,7 +67,7 @@
dofile(scripts_dir.."/app/xml_handler/resources/scripts/directory/action/directory.lua");
else
--handle action
--all other directory actions: sip_auth, user_call
--all other directory actions: sip_auth, user_call
--except for the action: group_call
if (user == nil) then

View File

@@ -161,7 +161,7 @@
file_handle:close();
end
--iterate array of file paths, get contents of other xml macro files
for key, xml_file_path in pairs(xml_file_paths) do
for key, xml_file_path in pairs(xml_file_paths) do
if (file_exists(xml_file_path)) then
xml_file = io.open(xml_file_path, "r");
if (xml_file ~= nil) then
@@ -170,7 +170,7 @@
xml_file_content = string.gsub(xml_file_content, "</include>", '');
table.insert(xml, xml_file_content);
--freeswitch.consoleLog("notice", "file contents...\n\n"..xml_file_content.."\n");
end
end
xml_file:close();
end
end

View File

@@ -125,7 +125,7 @@ if (session:ready()) then
--hangup the call
session:hangup();
else
else
log.notice("execute " .. app .. " " .. data);
--exucute the application

View File

@@ -176,7 +176,7 @@
local forward_caller_id = ""
if enabled == "true" and not empty(forward_caller_id_uuid) then
local sql = "select destination_number, destination_description,"..
"destination_caller_id_number, destination_caller_id_name " ..
"destination_caller_id_number, destination_caller_id_name " ..
"from v_destinations where domain_uuid = '" .. domain_uuid .. "' and " ..
"destination_type = 'inbound' and destination_uuid = '" .. forward_caller_id_uuid .. "'";
local row = dbh:first_row(sql)

View File

@@ -23,7 +23,7 @@
-- Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
-- Riccardo Granchi <riccardo.granchi@nems.it>
--
-- add this in Inbound Routes before transfer to use it:
-- add this in Inbound Routes before transfer to use it:
-- action set caller_id_name=${luarun cidlookup.lua ${uuid}}
--debug
@@ -47,16 +47,16 @@
countryCode = api:executeString("uuid_getvar " .. uuid .. " default_countrycode");
if ((countryCode ~= nil) and (string.len(countryCode) > 0)) then
countryPrefix = "+" .. countryCode;
if (string.sub(caller, 1, string.len(countryPrefix)) == countryPrefix) then
cleanCaller = string.sub(caller, string.len(countryPrefix)+1);
freeswitch.consoleLog("NOTICE", "[cidlookup] ignoring local international prefix " .. countryPrefix .. ": " .. caller .. " ==> " .. cleanCaller .. "\n");
caller = cleanCaller;
else
if ((exitCode ~= nil) and (string.len(exitCode) > 0)) then
countryPrefix = exitCode .. countryCode;
if (string.sub(caller, 1, string.len(countryPrefix)) == countryPrefix) then
@@ -65,7 +65,7 @@
caller = cleanCaller;
end;
end;
end;
end;
end;
--include config.lua
@@ -104,7 +104,7 @@
if ((name == nil) or (string.len(name) == 0)) then
name = api:executeString("cidlookup " .. caller);
end
freeswitch.consoleLog("NOTICE", "[cidlookup] uuid_setvar " .. uuid .. " caller_id_name " .. name);
api:executeString("uuid_setvar " .. uuid .. " caller_id_name " .. name);

View File

@@ -165,7 +165,7 @@
--check if a file exists
require "resources.functions.file_exists"
--define select_entry function
--define select_entry function
function select_entry()
dtmf_digits = "";
digit_timeout = "500";
@@ -182,7 +182,7 @@
return dtmf_digits;
end
--define prompt_for_name function
--define prompt_for_name function
function prompt_for_name()
dtmf_digits = "";
min_digits=0; max_digits=3; max_tries=3; digit_timeout = "5000";
@@ -196,7 +196,7 @@
--get the digits for the name
dtmf_digits = prompt_for_name();
--show the dtmf digits
--show the dtmf digits
freeswitch.consoleLog("notice", "[directory] first 3 letters of first or last name: " .. dtmf_digits .. "\n");
--loop through the extensions to find matches
@@ -214,7 +214,7 @@
if (row.first_name) then
--play the recorded name
if (storage_type == "base64") then
sql = [[SELECT * FROM v_voicemails
sql = [[SELECT * FROM v_voicemails
WHERE domain_uuid = ']] .. domain_uuid ..[['
AND voicemail_id = ']].. row.extension.. [[' ]];
if (debug["sql"]) then

View File

@@ -59,7 +59,7 @@ freeswitch.consoleLog("info", "[disa.callback] calling " .. aleg_number .. "\n")
freeswitch.msleep(2000);
while (session1:ready() and not session1:answered()) do
if os.time() > t_started + 30 then
if os.time() > t_started + 30 then
freeswitch.consoleLog("info", "[disa.callback] timed out for " .. aleg_number .. "\n");
session1:hangup();
else
@@ -78,7 +78,7 @@ if session1:ready() and session1:answered() then
session2 = freeswitch.Session(b_dialstring);
while (session2:ready() and not session2:answered()) do
if os.time() > t_started2 + 30 then
if os.time() > t_started2 + 30 then
freeswitch.consoleLog("info", "[disa.callback] timed out for " .. bleg_number .. "\n");
session2:hangup();
else

View File

@@ -63,21 +63,21 @@ if (a_user_exists == "true") then
extension_uuid = trim(api:executeString(cmd));
a_dialstring = "[origination_caller_id_number=*3472,outbound_caller_id_number=*3472,call_timeout=30,context="..context..",sip_invite_domain="..context..",domain_name="..context..",domain="..context..",accountcode="..accountcode..",domain_uuid="..domain_uuid.."]user/"..aleg_number.."@"..context;
else
sql = [[select * from v_dialplans as d, v_dialplan_details as s
sql = [[select * from v_dialplans as d, v_dialplan_details as s
where (d.domain_uuid = ']] .. domain_uuid .. [[' or d.domain_uuid is null)
and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'
and d.dialplan_enabled = 'true'
and d.dialplan_uuid = s.dialplan_uuid
order by
d.dialplan_order asc,
d.dialplan_name asc,
d.dialplan_uuid asc,
s.dialplan_detail_group asc,
CASE s.dialplan_detail_tag
WHEN 'condition' THEN 1
WHEN 'action' THEN 2
WHEN 'anti-action' THEN 3
ELSE 100 END,
and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'
and d.dialplan_enabled = 'true'
and d.dialplan_uuid = s.dialplan_uuid
order by
d.dialplan_order asc,
d.dialplan_name asc,
d.dialplan_uuid asc,
s.dialplan_detail_group asc,
CASE s.dialplan_detail_tag
WHEN 'condition' THEN 1
WHEN 'action' THEN 2
WHEN 'anti-action' THEN 3
ELSE 100 END,
s.dialplan_detail_order asc ]]
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[disa ] sql for dialplans:" .. sql .. "\n");
@@ -88,7 +88,7 @@ else
dialplans[x] = row;
x = x + 1;
end));
y = 0;
previous_dialplan_uuid = '';
for k, r in pairs(dialplans) do
@@ -151,7 +151,7 @@ freeswitch.consoleLog("info", "[disa.callback] calling " .. aleg_number .. "\n")
freeswitch.msleep(2000);
while (session1:ready() and not session1:answered()) do
if os.time() > t_started + 30 then
if os.time() > t_started + 30 then
freeswitch.consoleLog("info", "[disa.callback] timed out for " .. aleg_number .. "\n");
session1:hangup();
else
@@ -176,21 +176,21 @@ if session1:ready() and session1:answered() then
extension_uuid = trim(api:executeString(cmd));
b_dialstring = "[origination_caller_id_number=*3472,outbound_caller_id_number=*3472,call_timeout=30,context="..context..",sip_invite_domain="..context..",domain_name="..context..",domain="..context..",accountcode="..accountcode..",domain_uuid="..domain_uuid.."]user/"..bleg_number.."@"..context;
else
sql = [[select * from v_dialplans as d, v_dialplan_details as s
sql = [[select * from v_dialplans as d, v_dialplan_details as s
where (d.domain_uuid = ']] .. domain_uuid .. [[' or d.domain_uuid is null)
and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'
and d.dialplan_enabled = 'true'
and d.dialplan_uuid = s.dialplan_uuid
order by
d.dialplan_order asc,
d.dialplan_name asc,
d.dialplan_uuid asc,
s.dialplan_detail_group asc,
CASE s.dialplan_detail_tag
WHEN 'condition' THEN 1
WHEN 'action' THEN 2
WHEN 'anti-action' THEN 3
ELSE 100 END,
and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'
and d.dialplan_enabled = 'true'
and d.dialplan_uuid = s.dialplan_uuid
order by
d.dialplan_order asc,
d.dialplan_name asc,
d.dialplan_uuid asc,
s.dialplan_detail_group asc,
CASE s.dialplan_detail_tag
WHEN 'condition' THEN 1
WHEN 'action' THEN 2
WHEN 'anti-action' THEN 3
ELSE 100 END,
s.dialplan_detail_order asc ]]
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[disa ] sql for dialplans:" .. sql .. "\n");
@@ -200,7 +200,7 @@ if session1:ready() and session1:answered() then
assert(dbh:query(sql, function(row)
dialplans[x] = row;
x = x + 1;
end));
end));
y = 0;
previous_dialplan_uuid = '';
for k, r in pairs(dialplans) do
@@ -258,7 +258,7 @@ if session1:ready() and session1:answered() then
session2 = freeswitch.Session(b_dialstring);
while (session2:ready() and not session2:answered()) do
if os.time() > t_started2 + 30 then
if os.time() > t_started2 + 30 then
freeswitch.consoleLog("info", "[disa.callback] timed out for " .. bleg_number .. "\n");
session2:hangup();
else

View File

@@ -102,7 +102,7 @@ if ( session:ready() ) then
else
caller_id_number = session:getVariable("effective_caller_id_number");
end
else
else
if (caller_id_name) then
--caller id name provided do nothing
else

View File

@@ -195,7 +195,7 @@ if ( session:ready() ) then
end
--contact exists
--looks for caller_id_name and caller_id_name
--looks for caller_id_name and caller_id_name
end
--if a predefined_destination is provided then set the number to the predefined_destination
@@ -221,7 +221,7 @@ if ( session:ready() ) then
else
caller_id_number = session:getVariable("effective_caller_id_number");
end
else
else
if (caller_id_name) then
--caller id name provided do nothing
else
@@ -244,7 +244,7 @@ if ( session:ready() ) then
freeswitch.consoleLog("notice", "[disa] cmd "..cmd.."\n");
api:executeString(cmd);
session:hangup("NORMAL_CLEARING");
return;
return;
end

View File

@@ -47,29 +47,29 @@ if (session:ready()) then
fifo_count = api:executeString("fifo count " .. extension_queue);
-- freeswitch.consoleLog("notice", "fifo count " .. fifo_count .. "]\n");
-- Parsing queue info
i = 0;
v = {};
v = {};
for w in string.gmatch(fifo_count,"[^:]+") do
v[i] = w;
i = i + 1;
end
fifo_name = v[0];
consumer_count = v[1];
caller_count = v[2];
member_count = v[3];
ring_consumer_count = v[4];
idle_consumer_count = v[5];
if( not (member_count == "0") ) then
freeswitch.consoleLog("notice", "Adding member [" .. extension .. "] to fifo " .. extension_queue .. " \n");
freeswitch.consoleLog("notice", "Adding member [" .. extension .. "] to fifo " .. extension_queue .. " \n");
session:execute("set", "fifo_member_add_result=${fifo_member(add " .. extension_queue .." {fifo_member_wait=nowait}user/" .. extension .. " " ..fifo_simo .. " " ..fifo_timeout .. " " .. fifo_lag .. "} )"); --simo timeout lag
end;
-- Answerinf the call
-- Answerinf the call
session:answer();
session:execute( "fifo", extension_queue .. " in" );
end

View File

@@ -393,12 +393,12 @@
--to keep the originate command shorter these are things we always send. One place to adjust for all.
originate_same = "for_fax=1,accountcode='"..accountcode.."',domain_uuid="..domain_uuid..",domain_name="..domain_name..",mailto_address='"..email_address.."',mailfrom_address='"..from_address.."',origination_caller_id_name='"..origination_caller_id_name.. "',origination_caller_id_number="..origination_caller_id_number..",fax_uri="..fax_uri..",fax_retry_limit="..fax_retry_limit..",fax_retry_sleep="..fax_retry_sleep..",fax_verbose=true,fax_file='"..fax_file.."'";
if (fax_retry_attempts < fax_retry_limit) then
if (fax_retry_attempts < fax_retry_limit) then
--timed out waitng for comm or on first message, or busy code
if (fax_result_code == "2" or fax_result_code == "3" or hangup_cause_q850 == 17) then
--do nothing. don't want to increment
freeswitch.consoleLog("INFO","[FAX] Last Fax was probably Busy, don't increment retry_attempts. \n");
freeswitch.consoleLog("INFO","[FAX] Last Fax was probably Busy, don't increment retry_attempts. \n");
fax_busy_attempts = fax_busy_attempts + 1;
if (fax_busy_attempts > fax_busy_limit) then
fax_retry_attempts = 17;

View File

@@ -306,7 +306,7 @@
else
log.noticef("Found child call on remote machine `%s`.", call_hostname)
-- we can not find parent on this box because channel on other box so we have to
-- we can not find parent on this box because channel on other box so we have to
-- forward call to this box
session:execute("export", "sip_h_X-child_intercept_uuid="..uuid);
return make_proxy_call(pickup_number, call_hostname)

View File

@@ -95,7 +95,7 @@
api = freeswitch.API();
--get the ivr menu from the database
sql = [[SELECT * FROM v_ivr_menus
sql = [[SELECT * FROM v_ivr_menus
WHERE ivr_menu_uuid = ']] .. ivr_menu_uuid ..[['
AND ivr_menu_enabled = 'true' ]];
if (debug["sql"]) then
@@ -435,11 +435,11 @@
if (storage_type == "base64") then
if (ivr_menu_greet_long_is_base64 and file_exists(ivr_menu_greet_long)) then
--os.remove(ivr_menu_greet_long);
end
end
if (ivr_menu_greet_short_is_base64 and file_exists(ivr_menu_greet_short)) then
--os.remove(ivr_menu_greet_short);
end
end
if (ivr_menu_invalid_sound_is_base64 and file_exists(ivr_menu_invalid_sound)) then
--os.remove(ivr_menu_invalid_sound);
end
end
end

View File

@@ -43,7 +43,7 @@ if ( session:ready() ) then
sounds_dir = session:getVariable("sounds_dir");
destinations = session:getVariable("destinations");
if (destinations == nil) then
destinations = session:getVariable("extension_list");
destinations = session:getVariable("extension_list");
end
destination_table = explode(",",destinations);
caller_id_name = session:getVariable("caller_id_name");

View File

@@ -35,7 +35,7 @@ tries = 0;
function check_pin_number()
--sleep
session:sleep(500);
session:sleep(500);
--increment the number of tries
tries = tries + 1;
--get the user pin number
@@ -58,7 +58,7 @@ function check_pin_number()
if (not auth) then
if (tries < max_tries) then
session:streamFile("phrase:voicemail_fail_auth:#");
check_pin_number();
else
session:streamFile("phrase:voicemail_fail_auth:#");

View File

@@ -7,7 +7,7 @@ local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
-- encoding
function base64.enc(data)
return ((data:gsub('.', function(x)
return ((data:gsub('.', function(x)
local r,b='',x:byte()
for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
return r;

View File

@@ -8,7 +8,7 @@
require "resources.functions.trim";
local api = api
local api = api
if not api then
if freeswitch then
api = freeswitch.API()
@@ -92,7 +92,7 @@ function Cache._self_test()
local ok, err = Cache.get("a")
assert(nil == ok)
assert(err == "NOT FOUND")
local s = "hello \\ ' world"
assert(true == Cache.set("a", s))
assert(s == Cache.get("a"))

View File

@@ -1,10 +1,10 @@
---
-- @usage
-- @usage
-- -- Use default backend
-- dbh = Database.new("system")
-- .....
--
-- @usage
-- @usage
-- -- Use LuaSQL backend
-- dbh = Database.backend.luasql("system")
-- .....
@@ -163,7 +163,7 @@ end
-----------------------------------------------------------
-----------------------------------------------------------
local Database = {} do
local Database = {} do
local backend_loader = setmetatable({}, {__index = function(self, backend)
local class = require("resources.functions.database." .. backend)

View File

@@ -8,7 +8,7 @@ local odbc = require "odbc.dba"
local function remove_null(row, null, null_value)
local o = {}
for k, v in pairs(row) do
if v == null then
if v == null then
o[k] = null_value
else
o[k] = tostring(v)

View File

@@ -9,7 +9,7 @@ local odbcpool = require "odbc.dba.pool"
local function remove_null(row, null, null_value)
local o = {}
for k, v in pairs(row) do
if v == null then
if v == null then
o[k] = null_value
else
o[k] = tostring(v)

View File

@@ -1,6 +1,6 @@
--add the explode function
function explode ( seperator, str )
function explode ( seperator, str )
local pos, arr = 0, {}
if (seperator ~= nil and str ~= nil) then
for st, sp in function() return string.find( str, seperator, pos, true ) end do -- for each divider found

View File

@@ -95,7 +95,7 @@ function Settings:_load(category, subcategory, name)
if type(self._db) == 'string' then
db = Database.new(self._db)
end
local found = false
--get the domain settings
if domain_uuid then

View File

@@ -41,7 +41,7 @@
return max;
end
--define select_entry function
--define select_entry function
function settings(domain_uuid)
--define the table
@@ -124,7 +124,7 @@
subcategory = row.domain_setting_subcategory;
name = row.domain_setting_name;
value = row.domain_setting_value;
--add the category array
if (array[category] == nil) then
array[category] = {}

View File

@@ -1,11 +1,11 @@
---
---
-- @tparam table dict Dictionary
-- @tparam[opt='en'] string language default language
-- @tparam[opt='us'] string dialect default language
-- @return[1] nil if key is unknown
-- @return[2] empty string if language/dialect unknown or there no appropriate value for default language/dialect
-- @return[3] translated value accordint dictionary/language/dialect
--
--
-- @usage
-- local dict = {
-- ['label-text'] = {

View File

@@ -63,7 +63,7 @@
function on_dtmf(s, type, obj, arg)
if (type == "dtmf") then
session:setVariable("dtmf_digits", obj['digit']);
freeswitch.console_log("info", "[streamfile] dtmf digit: " .. obj['digit'] .. ", duration: " .. obj['duration'] .. "\n");
freeswitch.console_log("info", "[streamfile] dtmf digit: " .. obj['digit'] .. ", duration: " .. obj['duration'] .. "\n");
if (obj['digit'] == "*") then
return("false"); --return to previous
elseif (obj['digit'] == "0") then
@@ -92,7 +92,7 @@
--if base64, get from db, create temp file
if (storage_type == "base64") then
if (not file_exists(recordings_dir.."/"..file_name_only)) then
sql = [[SELECT * FROM v_recordings
sql = [[SELECT * FROM v_recordings
WHERE domain_uuid = ']] .. domain_uuid ..[['
AND recording_filename = ']].. file_name_only.. [[' ]];
if (debug["sql"]) then
@@ -110,13 +110,13 @@
file:close();
end
end);
else
else
file_name = recordings_dir.."/"..file_name_only;
end
end
end
--adjust file path
if (not file_exists(file_name)) then
if (not file_exists(file_name)) then
if (file_exists(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..file_name_only)) then
file_name = sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..file_name_only;
elseif (file_exists(recordings_dir.."/"..file_name_only)) then
@@ -128,10 +128,10 @@
if (session:ready()) then
session:answer();
slept = session:getVariable("slept");
if (slept == nil or slept == "false") then
if (slept == nil or slept == "false") then
freeswitch.consoleLog("notice", "[ivr_menu] sleeping (1s)\n");
session:sleep(1000);
if (slept == "false") then
if (slept == "false") then
session:setVariable("slept", "true");
end
end
@@ -144,5 +144,5 @@
if (storage_type == "base64") then
if (file_exists(file_name)) then
--os.remove(file_name);
end
end
end