WhitespaceClean-resources/install/scripts
whitespace pass over files for reference regex that was used s/[ \t]+(\r?\n)/\1/
This commit is contained in:
@@ -74,7 +74,7 @@ This method causes the script to get its manadatory arguments directly from the
|
|||||||
session:setVariable("call_block", "")
|
session:setVariable("call_block", "")
|
||||||
|
|
||||||
--send to the log
|
--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"]));
|
params["cid_name"], params["userid"], params["domain_name"]));
|
||||||
|
|
||||||
--get the cache
|
--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";
|
require "resources.functions.database_handle";
|
||||||
dbh = database_handle('system');
|
dbh = database_handle('system');
|
||||||
|
|
||||||
--log if not connect
|
--log if not connect
|
||||||
if dbh:connected() == false then
|
if dbh:connected() == false then
|
||||||
logger("W", "NOTICE", "db was not connected")
|
logger("W", "NOTICE", "db was not connected")
|
||||||
end
|
end
|
||||||
@@ -108,7 +108,7 @@ This method causes the script to get its manadatory arguments directly from the
|
|||||||
found_count = rows["call_block_count"];
|
found_count = rows["call_block_count"];
|
||||||
end)
|
end)
|
||||||
-- dbh:affected_rows() doesn't do anything if using core:db so this is the workaround:
|
-- dbh:affected_rows() doesn't do anything if using core:db so this is the workaround:
|
||||||
|
|
||||||
--set the cache
|
--set the cache
|
||||||
if (found_cid_num) then -- caller id exists
|
if (found_cid_num) then -- caller id exists
|
||||||
if (found_enabled == "true") then
|
if (found_enabled == "true") then
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
--
|
--
|
||||||
-- Contributor(s):
|
-- Contributor(s):
|
||||||
-- Mark J Crane <markjcrane@fusionpbx.com>
|
-- Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
-- Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
-- Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||||
|
|
||||||
--set variables
|
--set variables
|
||||||
flags = "";
|
flags = "";
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
--get the moderator_pin
|
--get the moderator_pin
|
||||||
sql = [[SELECT moderator_pin FROM v_meetings
|
sql = [[SELECT moderator_pin FROM v_meetings
|
||||||
WHERE meeting_uuid = ']] .. meeting_uuid ..[[']];
|
WHERE meeting_uuid = ']] .. meeting_uuid ..[[']];
|
||||||
freeswitch.consoleLog("notice", "[voicemail] sql: " .. sql .. "\n");
|
freeswitch.consoleLog("notice", "[voicemail] sql: " .. sql .. "\n");
|
||||||
status = dbh:query(sql, function(row)
|
status = dbh:query(sql, function(row)
|
||||||
@@ -159,7 +159,7 @@
|
|||||||
|
|
||||||
--get the conference sessions
|
--get the conference sessions
|
||||||
if (conference_session_uuid) then
|
if (conference_session_uuid) then
|
||||||
sql = [[SELECT count(*) as num_rows
|
sql = [[SELECT count(*) as num_rows
|
||||||
FROM v_conference_sessions
|
FROM v_conference_sessions
|
||||||
WHERE conference_session_uuid = ']] .. conference_session_uuid ..[[']];
|
WHERE conference_session_uuid = ']] .. conference_session_uuid ..[[']];
|
||||||
status = dbh:query(sql, function(row)
|
status = dbh:query(sql, function(row)
|
||||||
@@ -435,7 +435,7 @@
|
|||||||
--define the function get_pin_number
|
--define the function get_pin_number
|
||||||
function get_pin_number(domain_uuid, prompt_audio_file)
|
function get_pin_number(domain_uuid, prompt_audio_file)
|
||||||
--if the pin number is provided then require it
|
--if the pin number is provided then require it
|
||||||
if (not pin_number) then
|
if (not pin_number) then
|
||||||
min_digits = 2;
|
min_digits = 2;
|
||||||
max_digits = 20;
|
max_digits = 20;
|
||||||
max_tries = 1;
|
max_tries = 1;
|
||||||
@@ -447,16 +447,16 @@
|
|||||||
WHERE r.domain_uuid = ']] .. domain_uuid ..[['
|
WHERE r.domain_uuid = ']] .. domain_uuid ..[['
|
||||||
AND r.meeting_uuid = m.meeting_uuid
|
AND r.meeting_uuid = m.meeting_uuid
|
||||||
AND m.domain_uuid = ']] .. domain_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 r.enabled = 'true'
|
||||||
AND m.enabled = 'true'
|
AND m.enabled = 'true'
|
||||||
AND (
|
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 <> '' 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 = '' OR r.start_datetime is null )
|
||||||
)
|
)
|
||||||
AND (
|
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 <> '' 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 = '' OR r.stop_datetime is null )
|
||||||
) ]];
|
) ]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
freeswitch.consoleLog("notice", "[conference center] SQL: " .. sql .. "\n");
|
freeswitch.consoleLog("notice", "[conference center] SQL: " .. sql .. "\n");
|
||||||
@@ -496,7 +496,7 @@
|
|||||||
AND r.conference_center_uuid = ']] .. conference_center_uuid ..[['
|
AND r.conference_center_uuid = ']] .. conference_center_uuid ..[['
|
||||||
AND m.domain_uuid = ']] .. domain_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 r.enabled = 'true'
|
||||||
AND m.enabled = 'true'
|
AND m.enabled = 'true'
|
||||||
]];
|
]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
api = freeswitch.API();
|
api = freeswitch.API();
|
||||||
|
|
||||||
--check if the conference exists
|
--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");
|
freeswitch.consoleLog("INFO","" .. cmd .. "\n");
|
||||||
result = trim(api:executeString(cmd));
|
result = trim(api:executeString(cmd));
|
||||||
if (string.sub(result, -9) == "not found") then
|
if (string.sub(result, -9) == "not found") then
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
file_subject = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_subject.tpl";
|
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";
|
file_body = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_body.tpl";
|
||||||
end
|
end
|
||||||
|
|
||||||
--prepare the headers
|
--prepare the headers
|
||||||
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",';
|
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",';
|
||||||
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",';
|
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",';
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
body = body:gsub("'", "'");
|
body = body:gsub("'", "'");
|
||||||
body = body:gsub([["]], """);
|
body = body:gsub([["]], """);
|
||||||
body = trim(body);
|
body = trim(body);
|
||||||
|
|
||||||
--send the email
|
--send the email
|
||||||
cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'";
|
cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'";
|
||||||
if (debug["info"]) then
|
if (debug["info"]) then
|
||||||
@@ -188,7 +188,7 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
elseif (originate_disposition == "USER_NOT_REGISTERED") then
|
elseif (originate_disposition == "USER_NOT_REGISTERED") then
|
||||||
|
|
||||||
--handle USER_NOT_REGISTERED
|
--handle USER_NOT_REGISTERED
|
||||||
forward_user_not_registered_enabled = session:getVariable("forward_user_not_registered_enabled");
|
forward_user_not_registered_enabled = session:getVariable("forward_user_not_registered_enabled");
|
||||||
if (forward_user_not_registered_enabled == "true") then
|
if (forward_user_not_registered_enabled == "true") then
|
||||||
@@ -204,7 +204,7 @@
|
|||||||
--send missed call notification
|
--send missed call notification
|
||||||
missed();
|
missed();
|
||||||
end
|
end
|
||||||
|
|
||||||
--send missed call notification
|
--send missed call notification
|
||||||
--missed();
|
--missed();
|
||||||
|
|
||||||
|
|||||||
@@ -154,8 +154,8 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
--get the fax settings from the database
|
--get the fax settings from the database
|
||||||
sql = [[SELECT * FROM v_fax
|
sql = [[SELECT * FROM v_fax
|
||||||
WHERE fax_uuid = ']] .. fax_uuid ..[['
|
WHERE fax_uuid = ']] .. fax_uuid ..[['
|
||||||
AND domain_uuid = ']] .. domain_uuid ..[[']];
|
AND domain_uuid = ']] .. domain_uuid ..[[']];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
freeswitch.consoleLog("notice", "[fax] SQL: " .. sql .. "\n");
|
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 = quote(php_dir.."/"..php_bin).." "..quote(document_root.."/secure/fax_to_email.php").." ";
|
||||||
cmd = cmd .. "email="..quote(fax_email).." ";
|
cmd = cmd .. "email="..quote(fax_email).." ";
|
||||||
cmd = cmd .. "extension="..quote(fax_extension).." ";
|
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 .. "messages=" .. quote("result:"..fax_result_text.." sender:"..fax_remote_station_id.." pages:"..fax_document_total_pages).." ";
|
||||||
cmd = cmd .. "domain="..quote(domain_name).." ";
|
cmd = cmd .. "domain="..quote(domain_name).." ";
|
||||||
cmd = cmd .. "caller_id_name=" .. quote(caller_id_name or '') .. " ";
|
cmd = cmd .. "caller_id_name=" .. quote(caller_id_name or '') .. " ";
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ local task if fax_task_uuid then
|
|||||||
task = Tasks.select_task(fax_task_uuid)
|
task = Tasks.select_task(fax_task_uuid)
|
||||||
if not task then
|
if not task then
|
||||||
log.warningf("Can not found fax task: %q", tostring(fax_task_uuid))
|
log.warningf("Can not found fax task: %q", tostring(fax_task_uuid))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ local function next_task()
|
|||||||
local mode = (task.retry_counter % #FAX_OPTIONS) + 1
|
local mode = (task.retry_counter % #FAX_OPTIONS) + 1
|
||||||
local dial_string = '{' ..
|
local dial_string = '{' ..
|
||||||
task.dial_string .. "api_hangup_hook='lua app/fax/resources/scripts/queue/retry.lua'," ..
|
task.dial_string .. "api_hangup_hook='lua app/fax/resources/scripts/queue/retry.lua'," ..
|
||||||
FAX_OPTIONS[mode] ..
|
FAX_OPTIONS[mode] ..
|
||||||
'}' .. task.uri
|
'}' .. task.uri
|
||||||
|
|
||||||
local originate = 'originate ' .. dial_string .. ' &lua(app/fax/resources/scripts/queue/exec.lua)'
|
local originate = 'originate ' .. dial_string .. ' &lua(app/fax/resources/scripts/queue/exec.lua)'
|
||||||
|
|||||||
@@ -12,12 +12,12 @@
|
|||||||
local fax_task_uuid = env:getHeader('fax_task_uuid')
|
local fax_task_uuid = env:getHeader('fax_task_uuid')
|
||||||
if not fax_task_uuid then
|
if not fax_task_uuid then
|
||||||
log.warning("No [fax_task_uuid] channel variable")
|
log.warning("No [fax_task_uuid] channel variable")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local task = Tasks.select_task(fax_task_uuid)
|
local task = Tasks.select_task(fax_task_uuid)
|
||||||
if not task then
|
if not task then
|
||||||
log.warningf("Can not find fax task: %q", tostring(fax_task_uuid))
|
log.warningf("Can not find fax task: %q", tostring(fax_task_uuid))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- show all channel variables
|
-- show all channel variables
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ select
|
|||||||
t1.fax_task_uuid as uuid,
|
t1.fax_task_uuid as uuid,
|
||||||
t1.fax_uuid as fax_uuid,
|
t1.fax_uuid as fax_uuid,
|
||||||
t3.domain_name,
|
t3.domain_name,
|
||||||
t3.domain_uuid,
|
t3.domain_uuid,
|
||||||
t1.task_status as status,
|
t1.task_status as status,
|
||||||
t1.task_uri as uri,
|
t1.task_uri as uri,
|
||||||
t1.task_dial_string as dial_string,
|
t1.task_dial_string as dial_string,
|
||||||
@@ -51,7 +51,7 @@ select
|
|||||||
t2.fax_send_greeting as greeting
|
t2.fax_send_greeting as greeting
|
||||||
from v_fax_tasks t1
|
from v_fax_tasks t1
|
||||||
inner join v_fax t2 on t2.fax_uuid = t1.fax_uuid
|
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'
|
where t1.task_interrupted <> 'true'
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@
|
|||||||
--authentication failed
|
--authentication failed
|
||||||
if (authorized == 'false') then
|
if (authorized == 'false') then
|
||||||
result = session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-fail_auth.wav");
|
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
|
--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
|
if (authorized == 'true' and action == "login" and device_uuid_alternate ~= nil) then
|
||||||
|
|||||||
@@ -203,17 +203,17 @@ local log = require "resources.functions.log".ring_group
|
|||||||
else
|
else
|
||||||
--get the strategy of the ring group, if random, we use random() to order the destinations
|
--get the strategy of the ring group, if random, we use random() to order the destinations
|
||||||
sql = [[
|
sql = [[
|
||||||
SELECT
|
SELECT
|
||||||
r.ring_group_strategy
|
r.ring_group_strategy
|
||||||
FROM
|
FROM
|
||||||
v_ring_groups as r
|
v_ring_groups as r
|
||||||
WHERE
|
WHERE
|
||||||
ring_group_uuid = ']]..ring_group_uuid..[['
|
ring_group_uuid = ']]..ring_group_uuid..[['
|
||||||
AND r.domain_uuid = ']]..domain_uuid..[['
|
AND r.domain_uuid = ']]..domain_uuid..[['
|
||||||
AND r.ring_group_enabled = 'true'
|
AND r.ring_group_enabled = 'true'
|
||||||
]];
|
]];
|
||||||
|
|
||||||
|
|
||||||
assert(dbh:query(sql, function(row)
|
assert(dbh:query(sql, function(row)
|
||||||
if (row.ring_group_strategy == "random") then
|
if (row.ring_group_strategy == "random") then
|
||||||
if (database["type"] == "mysql") then
|
if (database["type"] == "mysql") then
|
||||||
@@ -223,23 +223,23 @@ local log = require "resources.functions.log".ring_group
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
sql_order='d.destination_delay, d.destination_number asc'
|
sql_order='d.destination_delay, d.destination_number asc'
|
||||||
end
|
end
|
||||||
end));
|
end));
|
||||||
|
|
||||||
--get the ring group destinations
|
--get the ring group destinations
|
||||||
sql = [[
|
sql = [[
|
||||||
SELECT
|
SELECT
|
||||||
r.ring_group_strategy, r.ring_group_timeout_app, r.ring_group_distinctive_ring,
|
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,
|
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
|
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
|
v_ring_groups as r, v_ring_group_destinations as d
|
||||||
WHERE
|
WHERE
|
||||||
d.ring_group_uuid = r.ring_group_uuid
|
d.ring_group_uuid = r.ring_group_uuid
|
||||||
AND d.ring_group_uuid = ']]..ring_group_uuid..[['
|
AND d.ring_group_uuid = ']]..ring_group_uuid..[['
|
||||||
AND r.domain_uuid = ']]..domain_uuid..[['
|
AND r.domain_uuid = ']]..domain_uuid..[['
|
||||||
AND r.ring_group_enabled = 'true'
|
AND r.ring_group_enabled = 'true'
|
||||||
ORDER BY
|
ORDER BY
|
||||||
]]..sql_order..[[
|
]]..sql_order..[[
|
||||||
]];
|
]];
|
||||||
--freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n");
|
--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
|
--get the dialplan data and save it to a table
|
||||||
if (external) then
|
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)
|
where (d.domain_uuid = ']] .. domain_uuid .. [[' or d.domain_uuid is null)
|
||||||
and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'
|
and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'
|
||||||
and d.dialplan_enabled = 'true'
|
and d.dialplan_enabled = 'true'
|
||||||
and d.dialplan_uuid = s.dialplan_uuid
|
and d.dialplan_uuid = s.dialplan_uuid
|
||||||
order by
|
order by
|
||||||
d.dialplan_order asc,
|
d.dialplan_order asc,
|
||||||
d.dialplan_name asc,
|
d.dialplan_name asc,
|
||||||
d.dialplan_uuid asc,
|
d.dialplan_uuid asc,
|
||||||
s.dialplan_detail_group asc,
|
s.dialplan_detail_group asc,
|
||||||
CASE s.dialplan_detail_tag
|
CASE s.dialplan_detail_tag
|
||||||
WHEN 'condition' THEN 1
|
WHEN 'condition' THEN 1
|
||||||
WHEN 'action' THEN 2
|
WHEN 'action' THEN 2
|
||||||
WHEN 'anti-action' THEN 3
|
WHEN 'anti-action' THEN 3
|
||||||
ELSE 100 END,
|
ELSE 100 END,
|
||||||
s.dialplan_detail_order asc ]]
|
s.dialplan_detail_order asc ]]
|
||||||
--freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n");
|
--freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n");
|
||||||
dialplans = {};
|
dialplans = {};
|
||||||
@@ -374,7 +374,7 @@ local log = require "resources.functions.log".ring_group
|
|||||||
end
|
end
|
||||||
|
|
||||||
--set confirm
|
--set confirm
|
||||||
if (ring_group_strategy == "simultaneous"
|
if (ring_group_strategy == "simultaneous"
|
||||||
or ring_group_strategy == "sequence"
|
or ring_group_strategy == "sequence"
|
||||||
or ring_group_strategy == "rollover") then
|
or ring_group_strategy == "rollover") then
|
||||||
session:execute("set", "group_confirm_key=exec");
|
session:execute("set", "group_confirm_key=exec");
|
||||||
@@ -413,7 +413,7 @@ local log = require "resources.functions.log".ring_group
|
|||||||
--record the session
|
--record the session
|
||||||
if (record_session) then
|
if (record_session) then
|
||||||
record_session = ",api_on_answer='uuid_record "..uuid.." start ".. record_file .. "'";
|
record_session = ",api_on_answer='uuid_record "..uuid.." start ".. record_file .. "'";
|
||||||
else
|
else
|
||||||
record_session = ""
|
record_session = ""
|
||||||
end
|
end
|
||||||
row.record_session = record_session
|
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 the timeout was reached go to the timeout action
|
||||||
if (x > 0) then
|
if (x > 0) then
|
||||||
if (session:getVariable("originate_disposition") == "ALLOTTED_TIMEOUT"
|
if (session:getVariable("originate_disposition") == "ALLOTTED_TIMEOUT"
|
||||||
or session:getVariable("originate_disposition") == "NO_ANSWER"
|
or session:getVariable("originate_disposition") == "NO_ANSWER"
|
||||||
or session:getVariable("originate_disposition") == "NO_USER_RESPONSE") then
|
or session:getVariable("originate_disposition") == "NO_USER_RESPONSE") then
|
||||||
break;
|
break;
|
||||||
end
|
end
|
||||||
@@ -609,12 +609,12 @@ local log = require "resources.functions.log".ring_group
|
|||||||
--timeout destination
|
--timeout destination
|
||||||
if (app_data ~= nil) then
|
if (app_data ~= nil) then
|
||||||
if session:ready() and (
|
if session:ready() and (
|
||||||
session:getVariable("originate_disposition") == "ALLOTTED_TIMEOUT"
|
session:getVariable("originate_disposition") == "ALLOTTED_TIMEOUT"
|
||||||
or session:getVariable("originate_disposition") == "NO_ANSWER"
|
or session:getVariable("originate_disposition") == "NO_ANSWER"
|
||||||
or session:getVariable("originate_disposition") == "NO_USER_RESPONSE"
|
or session:getVariable("originate_disposition") == "NO_USER_RESPONSE"
|
||||||
or session:getVariable("originate_disposition") == "USER_NOT_REGISTERED"
|
or session:getVariable("originate_disposition") == "USER_NOT_REGISTERED"
|
||||||
or session:getVariable("originate_disposition") == "NORMAL_TEMPORARY_FAILURE"
|
or session:getVariable("originate_disposition") == "NORMAL_TEMPORARY_FAILURE"
|
||||||
or session:getVariable("originate_disposition") == "NO_ROUTE_DESTINATION"
|
or session:getVariable("originate_disposition") == "NO_ROUTE_DESTINATION"
|
||||||
or session:getVariable("originate_disposition") == "USER_BUSY"
|
or session:getVariable("originate_disposition") == "USER_BUSY"
|
||||||
or session:getVariable("originate_disposition") == "failure"
|
or session:getVariable("originate_disposition") == "failure"
|
||||||
) then
|
) then
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
--include config.lua
|
--include config.lua
|
||||||
require "resources.functions.config";
|
require "resources.functions.config";
|
||||||
|
|
||||||
--connect to the database
|
--connect to the database
|
||||||
require "resources.functions.database_handle";
|
require "resources.functions.database_handle";
|
||||||
dbh = database_handle('system');
|
dbh = database_handle('system');
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
SELECT COUNT(*) AS in_group FROM
|
SELECT COUNT(*) AS in_group FROM
|
||||||
v_ring_group_destinations
|
v_ring_group_destinations
|
||||||
WHERE
|
WHERE
|
||||||
domain_uuid = ']]..domain_uuid..[['
|
domain_uuid = ']]..domain_uuid..[['
|
||||||
AND ring_group_uuid = ']]..ring_group_uuid..[['
|
AND ring_group_uuid = ']]..ring_group_uuid..[['
|
||||||
AND destination_number = ']]..destination..[['
|
AND destination_number = ']]..destination..[['
|
||||||
]];
|
]];
|
||||||
@@ -118,21 +118,21 @@
|
|||||||
assert(dbh:query(sql, function(row)
|
assert(dbh:query(sql, function(row)
|
||||||
if (row.in_group == "0") then
|
if (row.in_group == "0") then
|
||||||
sql = [[
|
sql = [[
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
v_ring_group_destinations
|
v_ring_group_destinations
|
||||||
( ring_group_destination_uuid,
|
( ring_group_destination_uuid,
|
||||||
domain_uuid,
|
domain_uuid,
|
||||||
ring_group_uuid,
|
ring_group_uuid,
|
||||||
destination_number,
|
destination_number,
|
||||||
destination_delay,
|
destination_delay,
|
||||||
destination_timeout
|
destination_timeout
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
( ']]..ring_group_destination_uuid..[[',
|
( ']]..ring_group_destination_uuid..[[',
|
||||||
']]..domain_uuid..[[',
|
']]..domain_uuid..[[',
|
||||||
']]..ring_group_uuid..[[',
|
']]..ring_group_uuid..[[',
|
||||||
']]..destination..[[',
|
']]..destination..[[',
|
||||||
]]..destination_delay..[[,
|
]]..destination_delay..[[,
|
||||||
]]..destination_timeout..[[
|
]]..destination_timeout..[[
|
||||||
)]];
|
)]];
|
||||||
freeswitch.consoleLog("NOTICE", "[ring_group][destination] SQL "..sql.."\n");
|
freeswitch.consoleLog("NOTICE", "[ring_group][destination] SQL "..sql.."\n");
|
||||||
@@ -148,11 +148,11 @@
|
|||||||
end
|
end
|
||||||
if (menu_selection == "2") then
|
if (menu_selection == "2") then
|
||||||
sql = [[
|
sql = [[
|
||||||
DELETE FROM
|
DELETE FROM
|
||||||
v_ring_group_destinations
|
v_ring_group_destinations
|
||||||
WHERE
|
WHERE
|
||||||
domain_uuid =']]..domain_uuid..[['
|
domain_uuid =']]..domain_uuid..[['
|
||||||
AND ring_group_uuid=']]..ring_group_uuid..[['
|
AND ring_group_uuid=']]..ring_group_uuid..[['
|
||||||
AND destination_number=']]..destination..[['
|
AND destination_number=']]..destination..[['
|
||||||
]];
|
]];
|
||||||
freeswitch.consoleLog("NOTICE", "[ring_group][destination] SQL "..sql.."\n");
|
freeswitch.consoleLog("NOTICE", "[ring_group][destination] SQL "..sql.."\n");
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
--include config.lua
|
--include config.lua
|
||||||
require "resources.functions.config";
|
require "resources.functions.config";
|
||||||
|
|
||||||
--connect to the database
|
--connect to the database
|
||||||
require "resources.functions.database_handle";
|
require "resources.functions.database_handle";
|
||||||
dbh = database_handle('system');
|
dbh = database_handle('system');
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
SELECT COUNT(*) AS in_group FROM
|
SELECT COUNT(*) AS in_group FROM
|
||||||
v_ring_group_destinations
|
v_ring_group_destinations
|
||||||
WHERE
|
WHERE
|
||||||
domain_uuid = ']]..domain_uuid..[['
|
domain_uuid = ']]..domain_uuid..[['
|
||||||
AND ring_group_uuid = ']]..ring_group_uuid..[['
|
AND ring_group_uuid = ']]..ring_group_uuid..[['
|
||||||
AND destination_number = ']]..destination_number..[['
|
AND destination_number = ']]..destination_number..[['
|
||||||
]];
|
]];
|
||||||
@@ -109,21 +109,21 @@
|
|||||||
assert(dbh:query(sql, function(row)
|
assert(dbh:query(sql, function(row)
|
||||||
if (row.in_group == "0") then
|
if (row.in_group == "0") then
|
||||||
sql = [[
|
sql = [[
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
v_ring_group_destinations
|
v_ring_group_destinations
|
||||||
( ring_group_destination_uuid,
|
( ring_group_destination_uuid,
|
||||||
domain_uuid,
|
domain_uuid,
|
||||||
ring_group_uuid,
|
ring_group_uuid,
|
||||||
destination_number,
|
destination_number,
|
||||||
destination_delay,
|
destination_delay,
|
||||||
destination_timeout
|
destination_timeout
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
( ']]..ring_group_destination_uuid..[[',
|
( ']]..ring_group_destination_uuid..[[',
|
||||||
']]..domain_uuid..[[',
|
']]..domain_uuid..[[',
|
||||||
']]..ring_group_uuid..[[',
|
']]..ring_group_uuid..[[',
|
||||||
']]..destination..[[',
|
']]..destination..[[',
|
||||||
]]..destination_delay..[[,
|
]]..destination_delay..[[,
|
||||||
]]..destination_timeout..[[
|
]]..destination_timeout..[[
|
||||||
)]];
|
)]];
|
||||||
freeswitch.consoleLog("NOTICE", "[ring_group][destination] SQL "..sql.."\n");
|
freeswitch.consoleLog("NOTICE", "[ring_group][destination] SQL "..sql.."\n");
|
||||||
@@ -139,11 +139,11 @@
|
|||||||
end
|
end
|
||||||
if (menu_selection == "2") then
|
if (menu_selection == "2") then
|
||||||
sql = [[
|
sql = [[
|
||||||
DELETE FROM
|
DELETE FROM
|
||||||
v_ring_group_destinations
|
v_ring_group_destinations
|
||||||
WHERE
|
WHERE
|
||||||
domain_uuid =']]..domain_uuid..[['
|
domain_uuid =']]..domain_uuid..[['
|
||||||
AND ring_group_uuid=']]..ring_group_uuid..[['
|
AND ring_group_uuid=']]..ring_group_uuid..[['
|
||||||
AND destination_number=']]..destination..[['
|
AND destination_number=']]..destination..[['
|
||||||
]];
|
]];
|
||||||
freeswitch.consoleLog("NOTICE", "[ring_group][destination] SQL "..sql.."\n");
|
freeswitch.consoleLog("NOTICE", "[ring_group][destination] SQL "..sql.."\n");
|
||||||
|
|||||||
@@ -183,7 +183,7 @@
|
|||||||
if (voicemail_attach_file == nil) then
|
if (voicemail_attach_file == nil) then
|
||||||
voicemail_attach_file = "true";
|
voicemail_attach_file = "true";
|
||||||
end
|
end
|
||||||
|
|
||||||
--valid voicemail
|
--valid voicemail
|
||||||
if (voicemail_uuid ~= nil) then
|
if (voicemail_uuid ~= nil) then
|
||||||
--answer the session
|
--answer the session
|
||||||
@@ -340,7 +340,7 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
--get the voicemail destinations
|
--get the voicemail destinations
|
||||||
sql = [[select * from v_voicemail_destinations
|
sql = [[select * from v_voicemail_destinations
|
||||||
where voicemail_uuid = ']]..voicemail_uuid..[[']]
|
where voicemail_uuid = ']]..voicemail_uuid..[[']]
|
||||||
--freeswitch.consoleLog("notice", "[voicemail][destinations] SQL:" .. sql .. "\n");
|
--freeswitch.consoleLog("notice", "[voicemail][destinations] SQL:" .. sql .. "\n");
|
||||||
destinations = {};
|
destinations = {};
|
||||||
@@ -361,7 +361,7 @@
|
|||||||
--determine uuid
|
--determine uuid
|
||||||
if (y == 1) then
|
if (y == 1) then
|
||||||
voicemail_message_uuid = uuid;
|
voicemail_message_uuid = uuid;
|
||||||
else
|
else
|
||||||
voicemail_message_uuid = api:execute("create_uuid");
|
voicemail_message_uuid = api:execute("create_uuid");
|
||||||
end
|
end
|
||||||
y = y + 1;
|
y = y + 1;
|
||||||
@@ -506,7 +506,7 @@
|
|||||||
--callback (works with DTMF)
|
--callback (works with DTMF)
|
||||||
--http://wiki.freeswitch.org/wiki/Mod_fsv
|
--http://wiki.freeswitch.org/wiki/Mod_fsv
|
||||||
--mkdir(voicemail_dir.."/"..voicemail_id);
|
--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(macro_name [,macro_data] [,language]);
|
||||||
--session:sayPhrase("voicemail_menu", "1:2:3:#", default_language);
|
--session:sayPhrase("voicemail_menu", "1:2:3:#", default_language);
|
||||||
--session:streamFile("directory/dir-to_select_entry.wav"); --works with setInputCallback
|
--session:streamFile("directory/dir-to_select_entry.wav"); --works with setInputCallback
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
--check to see if the greeting file exists
|
--check to see if the greeting file exists
|
||||||
if (storage_type == "base64" or storage_type == "http_cache") then
|
if (storage_type == "base64" or storage_type == "http_cache") then
|
||||||
greeting_invalid = true;
|
greeting_invalid = true;
|
||||||
sql = [[SELECT * FROM v_voicemail_greetings
|
sql = [[SELECT * FROM v_voicemail_greetings
|
||||||
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
||||||
AND voicemail_id = ']].. voicemail_id.. [['
|
AND voicemail_id = ']].. voicemail_id.. [['
|
||||||
AND greeting_id = ']].. greeting_id.. [[' ]];
|
AND greeting_id = ']].. greeting_id.. [[' ]];
|
||||||
@@ -59,20 +59,20 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
--validate the greeting_id
|
--validate the greeting_id
|
||||||
if (greeting_id == "0"
|
if (greeting_id == "0"
|
||||||
or greeting_id == "1"
|
or greeting_id == "1"
|
||||||
or greeting_id == "2"
|
or greeting_id == "2"
|
||||||
or greeting_id == "3"
|
or greeting_id == "3"
|
||||||
or greeting_id == "4"
|
or greeting_id == "4"
|
||||||
or greeting_id == "5"
|
or greeting_id == "5"
|
||||||
or greeting_id == "6"
|
or greeting_id == "6"
|
||||||
or greeting_id == "7"
|
or greeting_id == "7"
|
||||||
or greeting_id == "8"
|
or greeting_id == "8"
|
||||||
or greeting_id == "9") then
|
or greeting_id == "9") then
|
||||||
|
|
||||||
--valid greeting_id update the database
|
--valid greeting_id update the database
|
||||||
if (session:ready()) then
|
if (session:ready()) then
|
||||||
if (greeting_id == "0") then
|
if (greeting_id == "0") then
|
||||||
sql = [[UPDATE v_voicemails SET greeting_id = null ]];
|
sql = [[UPDATE v_voicemails SET greeting_id = null ]];
|
||||||
else
|
else
|
||||||
sql = [[UPDATE v_voicemails SET greeting_id = ']]..greeting_id..[[' ]];
|
sql = [[UPDATE v_voicemails SET greeting_id = ']]..greeting_id..[[' ]];
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
|
|
||||||
--get the greeting from the database
|
--get the greeting from the database
|
||||||
if (storage_type == "base64") then
|
if (storage_type == "base64") then
|
||||||
sql = [[SELECT * FROM v_voicemail_greetings
|
sql = [[SELECT * FROM v_voicemail_greetings
|
||||||
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
||||||
AND voicemail_id = ']].. voicemail_id.. [['
|
AND voicemail_id = ']].. voicemail_id.. [['
|
||||||
AND greeting_id = ']].. greeting_id.. [[' ]];
|
AND greeting_id = ']].. greeting_id.. [[' ]];
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
end
|
end
|
||||||
--say the message number
|
--say the message number
|
||||||
if (session:ready()) then
|
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, '');
|
dtmf_digits = macro(session, "message_number", 1, 100, '');
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
end
|
end
|
||||||
--get the recordings from the database
|
--get the recordings from the database
|
||||||
if (storage_type == "base64") then
|
if (storage_type == "base64") then
|
||||||
sql = [[SELECT * FROM v_voicemail_messages
|
sql = [[SELECT * FROM v_voicemail_messages
|
||||||
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
||||||
AND voicemail_message_uuid = ']].. uuid.. [[' ]];
|
AND voicemail_message_uuid = ']].. uuid.. [[' ]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
|
|||||||
@@ -136,7 +136,7 @@
|
|||||||
table.insert(actions, {app="streamFile",data="voicemail/vm-press.wav"});
|
table.insert(actions, {app="streamFile",data="voicemail/vm-press.wav"});
|
||||||
table.insert(actions, {app="streamFile",data="digits/3.wav"});
|
table.insert(actions, {app="streamFile",data="digits/3.wav"});
|
||||||
end
|
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
|
if (name == "record_name") then
|
||||||
table.insert(actions, {app="streamFile",data="voicemail/vm-record_name1.wav"});
|
table.insert(actions, {app="streamFile",data="voicemail/vm-record_name1.wav"});
|
||||||
table.insert(actions, {app="tone_stream",data="L=1;%(1000, 0, 640)"});
|
table.insert(actions, {app="tone_stream",data="L=1;%(1000, 0, 640)"});
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
local accounts = {}
|
local accounts = {}
|
||||||
table.insert(accounts, voicemail_id);
|
table.insert(accounts, voicemail_id);
|
||||||
--get the voicemail id and all related mwi accounts
|
--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 ..[['
|
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
||||||
AND (mwi_account = ']]..voicemail_id..[[' or mwi_account = ']]..voicemail_id..[[@]]..domain_name..[[')]];
|
AND (mwi_account = ']]..voicemail_id..[[' or mwi_account = ']]..voicemail_id..[[@]]..domain_name..[[')]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
sql = [[SELECT count(*) as message_count FROM v_voicemail_messages as m, v_voicemails as v
|
sql = [[SELECT count(*) as message_count FROM v_voicemail_messages as m, v_voicemails as v
|
||||||
WHERE v.domain_uuid = ']] .. domain_uuid ..[['
|
WHERE v.domain_uuid = ']] .. domain_uuid ..[['
|
||||||
AND v.voicemail_uuid = m.voicemail_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 = '') ]];
|
AND (m.message_status is null or m.message_status = '') ]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n");
|
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n");
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
end);
|
end);
|
||||||
|
|
||||||
--send the message waiting event
|
--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");
|
local event = freeswitch.Event("message_waiting");
|
||||||
if (message_count == "0") then
|
if (message_count == "0") then
|
||||||
if (debug["info"]) then
|
if (debug["info"]) then
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
--define on_dtmf call back function
|
--define on_dtmf call back function
|
||||||
function on_dtmf(s, type, obj, arg)
|
function on_dtmf(s, type, obj, arg)
|
||||||
if (type == "dtmf") then
|
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
|
if (obj['digit'] == "#") then
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
--get the greeting from the database
|
--get the greeting from the database
|
||||||
if (storage_type == "base64") then
|
if (storage_type == "base64") then
|
||||||
sql = [[SELECT * FROM v_voicemail_greetings
|
sql = [[SELECT * FROM v_voicemail_greetings
|
||||||
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
||||||
AND voicemail_id = ']].. voicemail_id.. [['
|
AND voicemail_id = ']].. voicemail_id.. [['
|
||||||
AND greeting_id = ']].. greeting_id.. [[' ]];
|
AND greeting_id = ']].. greeting_id.. [[' ]];
|
||||||
|
|||||||
@@ -39,14 +39,14 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
--validate the greeting_id
|
--validate the greeting_id
|
||||||
if (greeting_id == "1"
|
if (greeting_id == "1"
|
||||||
or greeting_id == "2"
|
or greeting_id == "2"
|
||||||
or greeting_id == "3"
|
or greeting_id == "3"
|
||||||
or greeting_id == "4"
|
or greeting_id == "4"
|
||||||
or greeting_id == "5"
|
or greeting_id == "5"
|
||||||
or greeting_id == "6"
|
or greeting_id == "6"
|
||||||
or greeting_id == "7"
|
or greeting_id == "7"
|
||||||
or greeting_id == "8"
|
or greeting_id == "8"
|
||||||
or greeting_id == "9") then
|
or greeting_id == "9") then
|
||||||
--record your greeting at the tone press any key or stop talking to end the recording
|
--record your greeting at the tone press any key or stop talking to end the recording
|
||||||
if (session:ready()) then
|
if (session:ready()) then
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
freeswitch.consoleLog("notice", "[voicemail] ".. storage_type .. " ".. storage_path .."\n");
|
freeswitch.consoleLog("notice", "[voicemail] ".. storage_type .. " ".. storage_path .."\n");
|
||||||
storage_path = storage_path:gsub("${domain_name}", domain_name);
|
storage_path = storage_path:gsub("${domain_name}", domain_name);
|
||||||
session:execute("record", storage_path .."/"..recording_name);
|
session:execute("record", storage_path .."/"..recording_name);
|
||||||
else
|
else
|
||||||
--prepare to record the greeting
|
--prepare to record the greeting
|
||||||
if (session:ready()) then
|
if (session:ready()) then
|
||||||
max_len_seconds = 30;
|
max_len_seconds = 30;
|
||||||
@@ -101,12 +101,12 @@
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--clean up any tmp greeting files
|
--clean up any tmp greeting files
|
||||||
for gid = 1, 9, 1 do
|
for gid = 1, 9, 1 do
|
||||||
if (file_exists(voicemail_dir.."/"..voicemail_id.."/greeting_"..gid..".tmp.wav")) then
|
if (file_exists(voicemail_dir.."/"..voicemail_id.."/greeting_"..gid..".tmp.wav")) then
|
||||||
os.remove(voicemail_dir.."/"..voicemail_id.."/greeting_"..gid..".tmp.wav");
|
os.remove(voicemail_dir.."/"..voicemail_id.."/greeting_"..gid..".tmp.wav");
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
--remove temporary greeting file, if any
|
--remove temporary greeting file, if any
|
||||||
if (file_exists(tmp_file)) then
|
if (file_exists(tmp_file)) then
|
||||||
os.remove(tmp_file);
|
os.remove(tmp_file);
|
||||||
end
|
end
|
||||||
record_greeting(greeting_id);
|
record_greeting(greeting_id);
|
||||||
end
|
end
|
||||||
if (type == "name") then
|
if (type == "name") then
|
||||||
@@ -181,8 +181,8 @@
|
|||||||
--remove temporary greeting file, if any
|
--remove temporary greeting file, if any
|
||||||
if (file_exists(tmp_file)) then
|
if (file_exists(tmp_file)) then
|
||||||
os.remove(tmp_file);
|
os.remove(tmp_file);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--hangup
|
--hangup
|
||||||
if (session:ready()) then
|
if (session:ready()) then
|
||||||
dtmf_digits = '';
|
dtmf_digits = '';
|
||||||
@@ -205,7 +205,7 @@
|
|||||||
--remove temporary greeting file, if any
|
--remove temporary greeting file, if any
|
||||||
if (file_exists(tmp_file)) then
|
if (file_exists(tmp_file)) then
|
||||||
os.remove(tmp_file);
|
os.remove(tmp_file);
|
||||||
end
|
end
|
||||||
advanced();
|
advanced();
|
||||||
end
|
end
|
||||||
if (type == "name") then
|
if (type == "name") then
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
if (dtmf_digits == nil) then
|
if (dtmf_digits == nil) then
|
||||||
dtmf_digits = session:getDigits(max_digits, "#", 1000);
|
dtmf_digits = session:getDigits(max_digits, "#", 1000);
|
||||||
else
|
else
|
||||||
dtmf_digits = dtmf_digits .. session:getDigits(max_digits, "#", 1000);
|
dtmf_digits = dtmf_digits .. session:getDigits(max_digits, "#", 1000);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (dtmf_digits) then
|
if (dtmf_digits) then
|
||||||
@@ -166,10 +166,10 @@
|
|||||||
--delete the wav file, if mp3 exists
|
--delete the wav file, if mp3 exists
|
||||||
if (file_exists(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".mp3")) then
|
if (file_exists(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".mp3")) then
|
||||||
os.remove(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav");
|
os.remove(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav");
|
||||||
else
|
else
|
||||||
vm_message_ext = "wav";
|
vm_message_ext = "wav";
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
freeswitch.consoleLog("notice", "neither mod_shout or lame found, defaulting to wav\n");
|
freeswitch.consoleLog("notice", "neither mod_shout or lame found, defaulting to wav\n");
|
||||||
vm_message_ext = "wav";
|
vm_message_ext = "wav";
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -189,7 +189,7 @@
|
|||||||
os.remove(file);
|
os.remove(file);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
debug["sql"] = false;
|
debug["sql"] = false;
|
||||||
debug["info"] = false;
|
debug["info"] = false;
|
||||||
|
|
||||||
--only run the script a single time
|
--only run the script a single time
|
||||||
runonce = true
|
runonce = true
|
||||||
--connect to the database
|
--connect to the database
|
||||||
require "resources.functions.database_handle";
|
require "resources.functions.database_handle";
|
||||||
@@ -65,10 +65,10 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Send MWI events for voicemail boxes with messages
|
--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
|
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
|
FROM v_voicemail_messages as m, v_voicemails as v, v_domains as d
|
||||||
WHERE v.voicemail_uuid = m.voicemail_uuid
|
WHERE v.voicemail_uuid = m.voicemail_uuid
|
||||||
AND v.domain_uuid = d.domain_uuid
|
AND v.domain_uuid = d.domain_uuid
|
||||||
GROUP BY v.voicemail_id, v.voicemail_uuid, v.domain_uuid, d.domain_name;]];
|
GROUP BY v.voicemail_id, v.voicemail_uuid, v.domain_uuid, d.domain_name;]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n");
|
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n");
|
||||||
@@ -120,5 +120,5 @@
|
|||||||
--slow the loop down
|
--slow the loop down
|
||||||
os.execute("sleep "..sleep);
|
os.execute("sleep "..sleep);
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@
|
|||||||
table.insert(xml, [[ <control action="vol listen dn" digits="4"/>]]);
|
table.insert(xml, [[ <control action="vol listen dn" digits="4"/>]]);
|
||||||
table.insert(xml, [[ <control action="hangup" digits=""/>]]);
|
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="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>]]);
|
||||||
table.insert(xml, [[ <group name="page">]]);
|
table.insert(xml, [[ <group name="page">]]);
|
||||||
table.insert(xml, [[ <control action="mute" digits="0"/>]]);
|
table.insert(xml, [[ <control action="mute" digits="0"/>]]);
|
||||||
|
|||||||
+5
-5
@@ -44,7 +44,7 @@
|
|||||||
assert(dbh:connected());
|
assert(dbh:connected());
|
||||||
|
|
||||||
--get the ivr menu from the database
|
--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 ..[['
|
WHERE ivr_menu_uuid = ']] .. ivr_menu_uuid ..[['
|
||||||
AND ivr_menu_enabled = 'true' ]];
|
AND ivr_menu_enabled = 'true' ]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
--greet long
|
--greet long
|
||||||
if (string.len(ivr_menu_greet_long) > 1) then
|
if (string.len(ivr_menu_greet_long) > 1) then
|
||||||
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_long)) 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..[['
|
WHERE domain_uuid = ']]..domain_uuid..[['
|
||||||
AND recording_filename = ']]..ivr_menu_greet_long..[[' ]];
|
AND recording_filename = ']]..ivr_menu_greet_long..[[' ]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
--greet short
|
--greet short
|
||||||
if (string.len(ivr_menu_greet_short) > 1) then
|
if (string.len(ivr_menu_greet_short) > 1) then
|
||||||
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_greet_short)) 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..[['
|
WHERE domain_uuid = ']]..domain_uuid..[['
|
||||||
AND recording_filename = ']]..ivr_menu_greet_short..[[' ]];
|
AND recording_filename = ']]..ivr_menu_greet_short..[[' ]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
@@ -134,7 +134,7 @@
|
|||||||
--invalid sound
|
--invalid sound
|
||||||
if (string.len(ivr_menu_invalid_sound) > 1) then
|
if (string.len(ivr_menu_invalid_sound) > 1) then
|
||||||
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_invalid_sound)) 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..[['
|
WHERE domain_uuid = ']]..domain_uuid..[['
|
||||||
AND recording_filename = ']]..ivr_menu_invalid_sound..[[' ]];
|
AND recording_filename = ']]..ivr_menu_invalid_sound..[[' ]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
@@ -158,7 +158,7 @@
|
|||||||
--exit sound
|
--exit sound
|
||||||
if (string.len(ivr_menu_exit_sound) > 1) then
|
if (string.len(ivr_menu_exit_sound) > 1) then
|
||||||
if (not file_exists(recordings_dir.."/"..domain_name.."/"..ivr_menu_exit_sound)) 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..[['
|
WHERE domain_uuid = ']]..domain_uuid..[['
|
||||||
AND recording_filename = ']]..ivr_menu_exit_sound..[[' ]];
|
AND recording_filename = ']]..ivr_menu_exit_sound..[[' ]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
|
|||||||
@@ -170,27 +170,27 @@
|
|||||||
--determine the type of condition
|
--determine the type of condition
|
||||||
if (dialplan_detail_type == "hour") then
|
if (dialplan_detail_type == "hour") then
|
||||||
condition_type = 'time';
|
condition_type = 'time';
|
||||||
elseif (dialplan_detail_type == "minute") then
|
elseif (dialplan_detail_type == "minute") then
|
||||||
condition_type = 'time';
|
condition_type = 'time';
|
||||||
elseif (dialplan_detail_type == "minute-of-day") then
|
elseif (dialplan_detail_type == "minute-of-day") then
|
||||||
condition_type = 'time';
|
condition_type = 'time';
|
||||||
elseif (dialplan_detail_type == "mday") then
|
elseif (dialplan_detail_type == "mday") then
|
||||||
condition_type = 'time';
|
condition_type = 'time';
|
||||||
elseif (dialplan_detail_type == "mweek") then
|
elseif (dialplan_detail_type == "mweek") then
|
||||||
condition_type = 'time';
|
condition_type = 'time';
|
||||||
elseif (dialplan_detail_type == "mon") then
|
elseif (dialplan_detail_type == "mon") then
|
||||||
condition_type = 'time';
|
condition_type = 'time';
|
||||||
elseif (dialplan_detail_type == "time-of-day") then
|
elseif (dialplan_detail_type == "time-of-day") then
|
||||||
condition_type = 'time';
|
condition_type = 'time';
|
||||||
elseif (dialplan_detail_type == "yday") then
|
elseif (dialplan_detail_type == "yday") then
|
||||||
condition_type = 'time';
|
condition_type = 'time';
|
||||||
elseif (dialplan_detail_type == "year") then
|
elseif (dialplan_detail_type == "year") then
|
||||||
condition_type = 'time';
|
condition_type = 'time';
|
||||||
elseif (dialplan_detail_type == "wday") then
|
elseif (dialplan_detail_type == "wday") then
|
||||||
condition_type = 'time';
|
condition_type = 'time';
|
||||||
elseif (dialplan_detail_type == "week") then
|
elseif (dialplan_detail_type == "week") then
|
||||||
condition_type = 'time';
|
condition_type = 'time';
|
||||||
elseif (dialplan_detail_type == "date-time") then
|
elseif (dialplan_detail_type == "date-time") then
|
||||||
condition_type = 'time';
|
condition_type = 'time';
|
||||||
else
|
else
|
||||||
condition_type = 'default';
|
condition_type = 'default';
|
||||||
|
|||||||
+3
-3
@@ -57,9 +57,9 @@
|
|||||||
|
|
||||||
--build the call group array
|
--build the call group array
|
||||||
sql = [[
|
sql = [[
|
||||||
select * from v_extensions
|
select * from v_extensions
|
||||||
where domain_uuid = ']]..domain_uuid..[['
|
where domain_uuid = ']]..domain_uuid..[['
|
||||||
order by call_group asc
|
order by call_group asc
|
||||||
]];
|
]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n");
|
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n");
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
--
|
--
|
||||||
-- Contributor(s):
|
-- Contributor(s):
|
||||||
-- Mark J Crane <markjcrane@fusionpbx.com>
|
-- 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
|
--set the default
|
||||||
continue = true;
|
continue = true;
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
number_alias_string = "";
|
number_alias_string = "";
|
||||||
vm_mailto = "";
|
vm_mailto = "";
|
||||||
|
|
||||||
-- event source
|
-- event source
|
||||||
local event_calling_function = params:getHeader("Event-Calling-Function")
|
local event_calling_function = params:getHeader("Event-Calling-Function")
|
||||||
local event_calling_file = params:getHeader("Event-Calling-File")
|
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");
|
dofile(scripts_dir.."/app/xml_handler/resources/scripts/directory/action/directory.lua");
|
||||||
else
|
else
|
||||||
--handle action
|
--handle action
|
||||||
--all other directory actions: sip_auth, user_call
|
--all other directory actions: sip_auth, user_call
|
||||||
--except for the action: group_call
|
--except for the action: group_call
|
||||||
|
|
||||||
if (user == nil) then
|
if (user == nil) then
|
||||||
|
|||||||
@@ -161,7 +161,7 @@
|
|||||||
file_handle:close();
|
file_handle:close();
|
||||||
end
|
end
|
||||||
--iterate array of file paths, get contents of other xml macro files
|
--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
|
if (file_exists(xml_file_path)) then
|
||||||
xml_file = io.open(xml_file_path, "r");
|
xml_file = io.open(xml_file_path, "r");
|
||||||
if (xml_file ~= nil) then
|
if (xml_file ~= nil) then
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
xml_file_content = string.gsub(xml_file_content, "</include>", '');
|
xml_file_content = string.gsub(xml_file_content, "</include>", '');
|
||||||
table.insert(xml, xml_file_content);
|
table.insert(xml, xml_file_content);
|
||||||
--freeswitch.consoleLog("notice", "file contents...\n\n"..xml_file_content.."\n");
|
--freeswitch.consoleLog("notice", "file contents...\n\n"..xml_file_content.."\n");
|
||||||
end
|
end
|
||||||
xml_file:close();
|
xml_file:close();
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ if (session:ready()) then
|
|||||||
|
|
||||||
--hangup the call
|
--hangup the call
|
||||||
session:hangup();
|
session:hangup();
|
||||||
else
|
else
|
||||||
log.notice("execute " .. app .. " " .. data);
|
log.notice("execute " .. app .. " " .. data);
|
||||||
|
|
||||||
--exucute the application
|
--exucute the application
|
||||||
|
|||||||
@@ -176,7 +176,7 @@
|
|||||||
local forward_caller_id = ""
|
local forward_caller_id = ""
|
||||||
if enabled == "true" and not empty(forward_caller_id_uuid) then
|
if enabled == "true" and not empty(forward_caller_id_uuid) then
|
||||||
local sql = "select destination_number, destination_description,"..
|
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 " ..
|
"from v_destinations where domain_uuid = '" .. domain_uuid .. "' and " ..
|
||||||
"destination_type = 'inbound' and destination_uuid = '" .. forward_caller_id_uuid .. "'";
|
"destination_type = 'inbound' and destination_uuid = '" .. forward_caller_id_uuid .. "'";
|
||||||
local row = dbh:first_row(sql)
|
local row = dbh:first_row(sql)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
-- Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
-- Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||||
-- Riccardo Granchi <riccardo.granchi@nems.it>
|
-- 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}}
|
-- action set caller_id_name=${luarun cidlookup.lua ${uuid}}
|
||||||
|
|
||||||
--debug
|
--debug
|
||||||
@@ -47,16 +47,16 @@
|
|||||||
countryCode = api:executeString("uuid_getvar " .. uuid .. " default_countrycode");
|
countryCode = api:executeString("uuid_getvar " .. uuid .. " default_countrycode");
|
||||||
|
|
||||||
if ((countryCode ~= nil) and (string.len(countryCode) > 0)) then
|
if ((countryCode ~= nil) and (string.len(countryCode) > 0)) then
|
||||||
|
|
||||||
countryPrefix = "+" .. countryCode;
|
countryPrefix = "+" .. countryCode;
|
||||||
|
|
||||||
if (string.sub(caller, 1, string.len(countryPrefix)) == countryPrefix) then
|
if (string.sub(caller, 1, string.len(countryPrefix)) == countryPrefix) then
|
||||||
cleanCaller = string.sub(caller, string.len(countryPrefix)+1);
|
cleanCaller = string.sub(caller, string.len(countryPrefix)+1);
|
||||||
freeswitch.consoleLog("NOTICE", "[cidlookup] ignoring local international prefix " .. countryPrefix .. ": " .. caller .. " ==> " .. cleanCaller .. "\n");
|
freeswitch.consoleLog("NOTICE", "[cidlookup] ignoring local international prefix " .. countryPrefix .. ": " .. caller .. " ==> " .. cleanCaller .. "\n");
|
||||||
caller = cleanCaller;
|
caller = cleanCaller;
|
||||||
else
|
else
|
||||||
if ((exitCode ~= nil) and (string.len(exitCode) > 0)) then
|
if ((exitCode ~= nil) and (string.len(exitCode) > 0)) then
|
||||||
|
|
||||||
countryPrefix = exitCode .. countryCode;
|
countryPrefix = exitCode .. countryCode;
|
||||||
|
|
||||||
if (string.sub(caller, 1, string.len(countryPrefix)) == countryPrefix) then
|
if (string.sub(caller, 1, string.len(countryPrefix)) == countryPrefix) then
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
caller = cleanCaller;
|
caller = cleanCaller;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
--include config.lua
|
--include config.lua
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
if ((name == nil) or (string.len(name) == 0)) then
|
if ((name == nil) or (string.len(name) == 0)) then
|
||||||
name = api:executeString("cidlookup " .. caller);
|
name = api:executeString("cidlookup " .. caller);
|
||||||
end
|
end
|
||||||
|
|
||||||
freeswitch.consoleLog("NOTICE", "[cidlookup] uuid_setvar " .. uuid .. " caller_id_name " .. name);
|
freeswitch.consoleLog("NOTICE", "[cidlookup] uuid_setvar " .. uuid .. " caller_id_name " .. name);
|
||||||
api:executeString("uuid_setvar " .. uuid .. " caller_id_name " .. name);
|
api:executeString("uuid_setvar " .. uuid .. " caller_id_name " .. name);
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,7 @@
|
|||||||
--check if a file exists
|
--check if a file exists
|
||||||
require "resources.functions.file_exists"
|
require "resources.functions.file_exists"
|
||||||
|
|
||||||
--define select_entry function
|
--define select_entry function
|
||||||
function select_entry()
|
function select_entry()
|
||||||
dtmf_digits = "";
|
dtmf_digits = "";
|
||||||
digit_timeout = "500";
|
digit_timeout = "500";
|
||||||
@@ -182,7 +182,7 @@
|
|||||||
return dtmf_digits;
|
return dtmf_digits;
|
||||||
end
|
end
|
||||||
|
|
||||||
--define prompt_for_name function
|
--define prompt_for_name function
|
||||||
function prompt_for_name()
|
function prompt_for_name()
|
||||||
dtmf_digits = "";
|
dtmf_digits = "";
|
||||||
min_digits=0; max_digits=3; max_tries=3; digit_timeout = "5000";
|
min_digits=0; max_digits=3; max_tries=3; digit_timeout = "5000";
|
||||||
@@ -196,7 +196,7 @@
|
|||||||
--get the digits for the name
|
--get the digits for the name
|
||||||
dtmf_digits = prompt_for_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");
|
freeswitch.consoleLog("notice", "[directory] first 3 letters of first or last name: " .. dtmf_digits .. "\n");
|
||||||
|
|
||||||
--loop through the extensions to find matches
|
--loop through the extensions to find matches
|
||||||
@@ -214,7 +214,7 @@
|
|||||||
if (row.first_name) then
|
if (row.first_name) then
|
||||||
--play the recorded name
|
--play the recorded name
|
||||||
if (storage_type == "base64") then
|
if (storage_type == "base64") then
|
||||||
sql = [[SELECT * FROM v_voicemails
|
sql = [[SELECT * FROM v_voicemails
|
||||||
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
||||||
AND voicemail_id = ']].. row.extension.. [[' ]];
|
AND voicemail_id = ']].. row.extension.. [[' ]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ freeswitch.consoleLog("info", "[disa.callback] calling " .. aleg_number .. "\n")
|
|||||||
freeswitch.msleep(2000);
|
freeswitch.msleep(2000);
|
||||||
|
|
||||||
while (session1:ready() and not session1:answered()) do
|
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");
|
freeswitch.consoleLog("info", "[disa.callback] timed out for " .. aleg_number .. "\n");
|
||||||
session1:hangup();
|
session1:hangup();
|
||||||
else
|
else
|
||||||
@@ -78,7 +78,7 @@ if session1:ready() and session1:answered() then
|
|||||||
|
|
||||||
session2 = freeswitch.Session(b_dialstring);
|
session2 = freeswitch.Session(b_dialstring);
|
||||||
while (session2:ready() and not session2:answered()) do
|
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");
|
freeswitch.consoleLog("info", "[disa.callback] timed out for " .. bleg_number .. "\n");
|
||||||
session2:hangup();
|
session2:hangup();
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -63,21 +63,21 @@ if (a_user_exists == "true") then
|
|||||||
extension_uuid = trim(api:executeString(cmd));
|
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;
|
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
|
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)
|
where (d.domain_uuid = ']] .. domain_uuid .. [[' or d.domain_uuid is null)
|
||||||
and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'
|
and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'
|
||||||
and d.dialplan_enabled = 'true'
|
and d.dialplan_enabled = 'true'
|
||||||
and d.dialplan_uuid = s.dialplan_uuid
|
and d.dialplan_uuid = s.dialplan_uuid
|
||||||
order by
|
order by
|
||||||
d.dialplan_order asc,
|
d.dialplan_order asc,
|
||||||
d.dialplan_name asc,
|
d.dialplan_name asc,
|
||||||
d.dialplan_uuid asc,
|
d.dialplan_uuid asc,
|
||||||
s.dialplan_detail_group asc,
|
s.dialplan_detail_group asc,
|
||||||
CASE s.dialplan_detail_tag
|
CASE s.dialplan_detail_tag
|
||||||
WHEN 'condition' THEN 1
|
WHEN 'condition' THEN 1
|
||||||
WHEN 'action' THEN 2
|
WHEN 'action' THEN 2
|
||||||
WHEN 'anti-action' THEN 3
|
WHEN 'anti-action' THEN 3
|
||||||
ELSE 100 END,
|
ELSE 100 END,
|
||||||
s.dialplan_detail_order asc ]]
|
s.dialplan_detail_order asc ]]
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
freeswitch.consoleLog("notice", "[disa ] sql for dialplans:" .. sql .. "\n");
|
freeswitch.consoleLog("notice", "[disa ] sql for dialplans:" .. sql .. "\n");
|
||||||
@@ -88,7 +88,7 @@ else
|
|||||||
dialplans[x] = row;
|
dialplans[x] = row;
|
||||||
x = x + 1;
|
x = x + 1;
|
||||||
end));
|
end));
|
||||||
|
|
||||||
y = 0;
|
y = 0;
|
||||||
previous_dialplan_uuid = '';
|
previous_dialplan_uuid = '';
|
||||||
for k, r in pairs(dialplans) do
|
for k, r in pairs(dialplans) do
|
||||||
@@ -151,7 +151,7 @@ freeswitch.consoleLog("info", "[disa.callback] calling " .. aleg_number .. "\n")
|
|||||||
freeswitch.msleep(2000);
|
freeswitch.msleep(2000);
|
||||||
|
|
||||||
while (session1:ready() and not session1:answered()) do
|
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");
|
freeswitch.consoleLog("info", "[disa.callback] timed out for " .. aleg_number .. "\n");
|
||||||
session1:hangup();
|
session1:hangup();
|
||||||
else
|
else
|
||||||
@@ -176,21 +176,21 @@ if session1:ready() and session1:answered() then
|
|||||||
extension_uuid = trim(api:executeString(cmd));
|
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;
|
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
|
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)
|
where (d.domain_uuid = ']] .. domain_uuid .. [[' or d.domain_uuid is null)
|
||||||
and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'
|
and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3'
|
||||||
and d.dialplan_enabled = 'true'
|
and d.dialplan_enabled = 'true'
|
||||||
and d.dialplan_uuid = s.dialplan_uuid
|
and d.dialplan_uuid = s.dialplan_uuid
|
||||||
order by
|
order by
|
||||||
d.dialplan_order asc,
|
d.dialplan_order asc,
|
||||||
d.dialplan_name asc,
|
d.dialplan_name asc,
|
||||||
d.dialplan_uuid asc,
|
d.dialplan_uuid asc,
|
||||||
s.dialplan_detail_group asc,
|
s.dialplan_detail_group asc,
|
||||||
CASE s.dialplan_detail_tag
|
CASE s.dialplan_detail_tag
|
||||||
WHEN 'condition' THEN 1
|
WHEN 'condition' THEN 1
|
||||||
WHEN 'action' THEN 2
|
WHEN 'action' THEN 2
|
||||||
WHEN 'anti-action' THEN 3
|
WHEN 'anti-action' THEN 3
|
||||||
ELSE 100 END,
|
ELSE 100 END,
|
||||||
s.dialplan_detail_order asc ]]
|
s.dialplan_detail_order asc ]]
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
freeswitch.consoleLog("notice", "[disa ] sql for dialplans:" .. sql .. "\n");
|
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)
|
assert(dbh:query(sql, function(row)
|
||||||
dialplans[x] = row;
|
dialplans[x] = row;
|
||||||
x = x + 1;
|
x = x + 1;
|
||||||
end));
|
end));
|
||||||
y = 0;
|
y = 0;
|
||||||
previous_dialplan_uuid = '';
|
previous_dialplan_uuid = '';
|
||||||
for k, r in pairs(dialplans) do
|
for k, r in pairs(dialplans) do
|
||||||
@@ -258,7 +258,7 @@ if session1:ready() and session1:answered() then
|
|||||||
|
|
||||||
session2 = freeswitch.Session(b_dialstring);
|
session2 = freeswitch.Session(b_dialstring);
|
||||||
while (session2:ready() and not session2:answered()) do
|
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");
|
freeswitch.consoleLog("info", "[disa.callback] timed out for " .. bleg_number .. "\n");
|
||||||
session2:hangup();
|
session2:hangup();
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ if ( session:ready() ) then
|
|||||||
else
|
else
|
||||||
caller_id_number = session:getVariable("effective_caller_id_number");
|
caller_id_number = session:getVariable("effective_caller_id_number");
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (caller_id_name) then
|
if (caller_id_name) then
|
||||||
--caller id name provided do nothing
|
--caller id name provided do nothing
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ if ( session:ready() ) then
|
|||||||
end
|
end
|
||||||
|
|
||||||
--contact exists
|
--contact exists
|
||||||
--looks for caller_id_name and caller_id_name
|
--looks for caller_id_name and caller_id_name
|
||||||
end
|
end
|
||||||
|
|
||||||
--if a predefined_destination is provided then set the number to the predefined_destination
|
--if a predefined_destination is provided then set the number to the predefined_destination
|
||||||
@@ -221,7 +221,7 @@ if ( session:ready() ) then
|
|||||||
else
|
else
|
||||||
caller_id_number = session:getVariable("effective_caller_id_number");
|
caller_id_number = session:getVariable("effective_caller_id_number");
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (caller_id_name) then
|
if (caller_id_name) then
|
||||||
--caller id name provided do nothing
|
--caller id name provided do nothing
|
||||||
else
|
else
|
||||||
@@ -244,7 +244,7 @@ if ( session:ready() ) then
|
|||||||
freeswitch.consoleLog("notice", "[disa] cmd "..cmd.."\n");
|
freeswitch.consoleLog("notice", "[disa] cmd "..cmd.."\n");
|
||||||
api:executeString(cmd);
|
api:executeString(cmd);
|
||||||
session:hangup("NORMAL_CLEARING");
|
session:hangup("NORMAL_CLEARING");
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,29 +47,29 @@ if (session:ready()) then
|
|||||||
fifo_count = api:executeString("fifo count " .. extension_queue);
|
fifo_count = api:executeString("fifo count " .. extension_queue);
|
||||||
|
|
||||||
-- freeswitch.consoleLog("notice", "fifo count " .. fifo_count .. "]\n");
|
-- freeswitch.consoleLog("notice", "fifo count " .. fifo_count .. "]\n");
|
||||||
|
|
||||||
-- Parsing queue info
|
-- Parsing queue info
|
||||||
i = 0;
|
i = 0;
|
||||||
v = {};
|
v = {};
|
||||||
for w in string.gmatch(fifo_count,"[^:]+") do
|
for w in string.gmatch(fifo_count,"[^:]+") do
|
||||||
v[i] = w;
|
v[i] = w;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
fifo_name = v[0];
|
fifo_name = v[0];
|
||||||
consumer_count = v[1];
|
consumer_count = v[1];
|
||||||
caller_count = v[2];
|
caller_count = v[2];
|
||||||
member_count = v[3];
|
member_count = v[3];
|
||||||
ring_consumer_count = v[4];
|
ring_consumer_count = v[4];
|
||||||
idle_consumer_count = v[5];
|
idle_consumer_count = v[5];
|
||||||
|
|
||||||
if( not (member_count == "0") ) then
|
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
|
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;
|
end;
|
||||||
|
|
||||||
-- Answerinf the call
|
-- Answerinf the call
|
||||||
session:answer();
|
session:answer();
|
||||||
session:execute( "fifo", extension_queue .. " in" );
|
session:execute( "fifo", extension_queue .. " in" );
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -393,12 +393,12 @@
|
|||||||
--to keep the originate command shorter these are things we always send. One place to adjust for all.
|
--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.."'";
|
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
|
--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
|
if (fax_result_code == "2" or fax_result_code == "3" or hangup_cause_q850 == 17) then
|
||||||
--do nothing. don't want to increment
|
--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;
|
fax_busy_attempts = fax_busy_attempts + 1;
|
||||||
if (fax_busy_attempts > fax_busy_limit) then
|
if (fax_busy_attempts > fax_busy_limit) then
|
||||||
fax_retry_attempts = 17;
|
fax_retry_attempts = 17;
|
||||||
|
|||||||
@@ -306,7 +306,7 @@
|
|||||||
|
|
||||||
else
|
else
|
||||||
log.noticef("Found child call on remote machine `%s`.", call_hostname)
|
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
|
-- forward call to this box
|
||||||
session:execute("export", "sip_h_X-child_intercept_uuid="..uuid);
|
session:execute("export", "sip_h_X-child_intercept_uuid="..uuid);
|
||||||
return make_proxy_call(pickup_number, call_hostname)
|
return make_proxy_call(pickup_number, call_hostname)
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
api = freeswitch.API();
|
api = freeswitch.API();
|
||||||
|
|
||||||
--get the ivr menu from the database
|
--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 ..[['
|
WHERE ivr_menu_uuid = ']] .. ivr_menu_uuid ..[['
|
||||||
AND ivr_menu_enabled = 'true' ]];
|
AND ivr_menu_enabled = 'true' ]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
@@ -435,11 +435,11 @@
|
|||||||
if (storage_type == "base64") then
|
if (storage_type == "base64") then
|
||||||
if (ivr_menu_greet_long_is_base64 and file_exists(ivr_menu_greet_long)) then
|
if (ivr_menu_greet_long_is_base64 and file_exists(ivr_menu_greet_long)) then
|
||||||
--os.remove(ivr_menu_greet_long);
|
--os.remove(ivr_menu_greet_long);
|
||||||
end
|
end
|
||||||
if (ivr_menu_greet_short_is_base64 and file_exists(ivr_menu_greet_short)) then
|
if (ivr_menu_greet_short_is_base64 and file_exists(ivr_menu_greet_short)) then
|
||||||
--os.remove(ivr_menu_greet_short);
|
--os.remove(ivr_menu_greet_short);
|
||||||
end
|
end
|
||||||
if (ivr_menu_invalid_sound_is_base64 and file_exists(ivr_menu_invalid_sound)) then
|
if (ivr_menu_invalid_sound_is_base64 and file_exists(ivr_menu_invalid_sound)) then
|
||||||
--os.remove(ivr_menu_invalid_sound);
|
--os.remove(ivr_menu_invalid_sound);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -43,7 +43,7 @@ if ( session:ready() ) then
|
|||||||
sounds_dir = session:getVariable("sounds_dir");
|
sounds_dir = session:getVariable("sounds_dir");
|
||||||
destinations = session:getVariable("destinations");
|
destinations = session:getVariable("destinations");
|
||||||
if (destinations == nil) then
|
if (destinations == nil) then
|
||||||
destinations = session:getVariable("extension_list");
|
destinations = session:getVariable("extension_list");
|
||||||
end
|
end
|
||||||
destination_table = explode(",",destinations);
|
destination_table = explode(",",destinations);
|
||||||
caller_id_name = session:getVariable("caller_id_name");
|
caller_id_name = session:getVariable("caller_id_name");
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ tries = 0;
|
|||||||
|
|
||||||
function check_pin_number()
|
function check_pin_number()
|
||||||
--sleep
|
--sleep
|
||||||
session:sleep(500);
|
session:sleep(500);
|
||||||
--increment the number of tries
|
--increment the number of tries
|
||||||
tries = tries + 1;
|
tries = tries + 1;
|
||||||
--get the user pin number
|
--get the user pin number
|
||||||
@@ -58,7 +58,7 @@ function check_pin_number()
|
|||||||
if (not auth) then
|
if (not auth) then
|
||||||
if (tries < max_tries) then
|
if (tries < max_tries) then
|
||||||
session:streamFile("phrase:voicemail_fail_auth:#");
|
session:streamFile("phrase:voicemail_fail_auth:#");
|
||||||
|
|
||||||
check_pin_number();
|
check_pin_number();
|
||||||
else
|
else
|
||||||
session:streamFile("phrase:voicemail_fail_auth:#");
|
session:streamFile("phrase:voicemail_fail_auth:#");
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
|||||||
|
|
||||||
-- encoding
|
-- encoding
|
||||||
function base64.enc(data)
|
function base64.enc(data)
|
||||||
return ((data:gsub('.', function(x)
|
return ((data:gsub('.', function(x)
|
||||||
local r,b='',x:byte()
|
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
|
for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
require "resources.functions.trim";
|
require "resources.functions.trim";
|
||||||
|
|
||||||
local api = api
|
local api = api
|
||||||
if not api then
|
if not api then
|
||||||
if freeswitch then
|
if freeswitch then
|
||||||
api = freeswitch.API()
|
api = freeswitch.API()
|
||||||
@@ -92,7 +92,7 @@ function Cache._self_test()
|
|||||||
local ok, err = Cache.get("a")
|
local ok, err = Cache.get("a")
|
||||||
assert(nil == ok)
|
assert(nil == ok)
|
||||||
assert(err == "NOT FOUND")
|
assert(err == "NOT FOUND")
|
||||||
|
|
||||||
local s = "hello \\ ' world"
|
local s = "hello \\ ' world"
|
||||||
assert(true == Cache.set("a", s))
|
assert(true == Cache.set("a", s))
|
||||||
assert(s == Cache.get("a"))
|
assert(s == Cache.get("a"))
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Use default backend
|
-- -- Use default backend
|
||||||
-- dbh = Database.new("system")
|
-- dbh = Database.new("system")
|
||||||
-- .....
|
-- .....
|
||||||
--
|
--
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Use LuaSQL backend
|
-- -- Use LuaSQL backend
|
||||||
-- dbh = Database.backend.luasql("system")
|
-- 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 backend_loader = setmetatable({}, {__index = function(self, backend)
|
||||||
local class = require("resources.functions.database." .. backend)
|
local class = require("resources.functions.database." .. backend)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ local odbc = require "odbc.dba"
|
|||||||
local function remove_null(row, null, null_value)
|
local function remove_null(row, null, null_value)
|
||||||
local o = {}
|
local o = {}
|
||||||
for k, v in pairs(row) do
|
for k, v in pairs(row) do
|
||||||
if v == null then
|
if v == null then
|
||||||
o[k] = null_value
|
o[k] = null_value
|
||||||
else
|
else
|
||||||
o[k] = tostring(v)
|
o[k] = tostring(v)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ local odbcpool = require "odbc.dba.pool"
|
|||||||
local function remove_null(row, null, null_value)
|
local function remove_null(row, null, null_value)
|
||||||
local o = {}
|
local o = {}
|
||||||
for k, v in pairs(row) do
|
for k, v in pairs(row) do
|
||||||
if v == null then
|
if v == null then
|
||||||
o[k] = null_value
|
o[k] = null_value
|
||||||
else
|
else
|
||||||
o[k] = tostring(v)
|
o[k] = tostring(v)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
--add the explode function
|
--add the explode function
|
||||||
function explode ( seperator, str )
|
function explode ( seperator, str )
|
||||||
local pos, arr = 0, {}
|
local pos, arr = 0, {}
|
||||||
if (seperator ~= nil and str ~= nil) then
|
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
|
for st, sp in function() return string.find( str, seperator, pos, true ) end do -- for each divider found
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ function Settings:_load(category, subcategory, name)
|
|||||||
if type(self._db) == 'string' then
|
if type(self._db) == 'string' then
|
||||||
db = Database.new(self._db)
|
db = Database.new(self._db)
|
||||||
end
|
end
|
||||||
|
|
||||||
local found = false
|
local found = false
|
||||||
--get the domain settings
|
--get the domain settings
|
||||||
if domain_uuid then
|
if domain_uuid then
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
return max;
|
return max;
|
||||||
end
|
end
|
||||||
|
|
||||||
--define select_entry function
|
--define select_entry function
|
||||||
function settings(domain_uuid)
|
function settings(domain_uuid)
|
||||||
|
|
||||||
--define the table
|
--define the table
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
subcategory = row.domain_setting_subcategory;
|
subcategory = row.domain_setting_subcategory;
|
||||||
name = row.domain_setting_name;
|
name = row.domain_setting_name;
|
||||||
value = row.domain_setting_value;
|
value = row.domain_setting_value;
|
||||||
|
|
||||||
--add the category array
|
--add the category array
|
||||||
if (array[category] == nil) then
|
if (array[category] == nil) then
|
||||||
array[category] = {}
|
array[category] = {}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
---
|
---
|
||||||
-- @tparam table dict Dictionary
|
-- @tparam table dict Dictionary
|
||||||
-- @tparam[opt='en'] string language default language
|
-- @tparam[opt='en'] string language default language
|
||||||
-- @tparam[opt='us'] string dialect default language
|
-- @tparam[opt='us'] string dialect default language
|
||||||
-- @return[1] nil if key is unknown
|
-- @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[2] empty string if language/dialect unknown or there no appropriate value for default language/dialect
|
||||||
-- @return[3] translated value accordint dictionary/language/dialect
|
-- @return[3] translated value accordint dictionary/language/dialect
|
||||||
--
|
--
|
||||||
-- @usage
|
-- @usage
|
||||||
-- local dict = {
|
-- local dict = {
|
||||||
-- ['label-text'] = {
|
-- ['label-text'] = {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
function on_dtmf(s, type, obj, arg)
|
function on_dtmf(s, type, obj, arg)
|
||||||
if (type == "dtmf") then
|
if (type == "dtmf") then
|
||||||
session:setVariable("dtmf_digits", obj['digit']);
|
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
|
if (obj['digit'] == "*") then
|
||||||
return("false"); --return to previous
|
return("false"); --return to previous
|
||||||
elseif (obj['digit'] == "0") then
|
elseif (obj['digit'] == "0") then
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
--if base64, get from db, create temp file
|
--if base64, get from db, create temp file
|
||||||
if (storage_type == "base64") then
|
if (storage_type == "base64") then
|
||||||
if (not file_exists(recordings_dir.."/"..file_name_only)) 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 ..[['
|
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
||||||
AND recording_filename = ']].. file_name_only.. [[' ]];
|
AND recording_filename = ']].. file_name_only.. [[' ]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
@@ -110,13 +110,13 @@
|
|||||||
file:close();
|
file:close();
|
||||||
end
|
end
|
||||||
end);
|
end);
|
||||||
else
|
else
|
||||||
file_name = recordings_dir.."/"..file_name_only;
|
file_name = recordings_dir.."/"..file_name_only;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--adjust file path
|
--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
|
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;
|
file_name = sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..file_name_only;
|
||||||
elseif (file_exists(recordings_dir.."/"..file_name_only)) then
|
elseif (file_exists(recordings_dir.."/"..file_name_only)) then
|
||||||
@@ -128,10 +128,10 @@
|
|||||||
if (session:ready()) then
|
if (session:ready()) then
|
||||||
session:answer();
|
session:answer();
|
||||||
slept = session:getVariable("slept");
|
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");
|
freeswitch.consoleLog("notice", "[ivr_menu] sleeping (1s)\n");
|
||||||
session:sleep(1000);
|
session:sleep(1000);
|
||||||
if (slept == "false") then
|
if (slept == "false") then
|
||||||
session:setVariable("slept", "true");
|
session:setVariable("slept", "true");
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -144,5 +144,5 @@
|
|||||||
if (storage_type == "base64") then
|
if (storage_type == "base64") then
|
||||||
if (file_exists(file_name)) then
|
if (file_exists(file_name)) then
|
||||||
--os.remove(file_name);
|
--os.remove(file_name);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user