mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Merge pull request #1479 from mafoo/WhitespaceClean-resources/install/scripts
WhitespaceClean-resources/install/scripts
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", "")
|
||||
|
||||
--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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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("'", "'");
|
||||
body = body:gsub([["]], """);
|
||||
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();
|
||||
|
||||
|
||||
@@ -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 '') .. " ";
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
]]
|
||||
|
||||
|
||||
@@ -128,7 +128,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 and device_uuid ~= nil and domain_uuid ~= nil) then
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.. [[' ]];
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)"});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.. [[' ]];
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -189,7 +189,7 @@
|
||||
os.remove(file);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -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
|
||||
|
||||
@@ -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"/>]]);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user