Merge remote-tracking branch 'upstream/master' into ivr_menu
This commit is contained in:
@@ -83,6 +83,7 @@
|
||||
require "resources.functions.base64";
|
||||
|
||||
--set the voicemail message path
|
||||
mkdir(voicemail_dir.."/"..voicemail_id);
|
||||
message_location = voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext;
|
||||
|
||||
--save the recording to the file system
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
require "resources.functions.base64";
|
||||
|
||||
--set the voicemail message path
|
||||
mkdir(voicemail_dir.."/"..voicemail_id);
|
||||
greeting_location = voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".wav"; --vm_message_ext;
|
||||
|
||||
--if not found, save greeting to local file system
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
-- notice, this list of conditions and the following disclaimer in the
|
||||
-- documentation and/or other materials provided with the distribution.
|
||||
--
|
||||
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
-- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
-- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
-- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
-- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- Part of FusionPBX
|
||||
-- Copyright (C) 2013 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- Copyright (C) 2013-2015 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- All rights reserved.
|
||||
--
|
||||
-- Redistribution and use in source and binary forms, with or without
|
||||
@@ -12,7 +12,7 @@
|
||||
-- notice, this list of conditions and the following disclaimer in the
|
||||
-- documentation and/or other materials provided with the distribution.
|
||||
--
|
||||
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
-- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
-- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
-- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
-- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
@@ -79,7 +79,7 @@
|
||||
--delete the greeting (retain local for better responsiveness)
|
||||
--os.remove(real_file);
|
||||
end
|
||||
|
||||
|
||||
--if base64, encode file
|
||||
if (storage_type == "base64") then
|
||||
--include the base64 function
|
||||
@@ -90,7 +90,7 @@
|
||||
f:close();
|
||||
greeting_base64 = base64.encode(file_content);
|
||||
end
|
||||
|
||||
|
||||
--delete the previous recording
|
||||
sql = "delete from v_voicemail_greetings ";
|
||||
sql = sql .. "where domain_uuid = '".. domain_uuid .. "' ";
|
||||
@@ -144,7 +144,7 @@
|
||||
else
|
||||
dbh:query(sql);
|
||||
end
|
||||
|
||||
|
||||
--use the new greeting
|
||||
local array = {}
|
||||
table.insert(array, "update v_voicemails ");
|
||||
@@ -153,7 +153,7 @@
|
||||
table.insert(array, "and voicemail_id = '".. voicemail_id .."' ");
|
||||
sql = table.concat(array, "\n");
|
||||
dbh:query(sql);
|
||||
|
||||
|
||||
advanced();
|
||||
end
|
||||
if (type == "name") then
|
||||
|
||||
@@ -108,8 +108,12 @@
|
||||
if (debug["sql"]) then
|
||||
log.notice("SQL: " .. sql);
|
||||
end
|
||||
x = 0;
|
||||
local x = 0;
|
||||
local pass
|
||||
dbh:query(sql, function(row)
|
||||
--clear flag pass
|
||||
pass = false
|
||||
|
||||
--get the dialplan
|
||||
domain_uuid = row.domain_uuid;
|
||||
dialplan_uuid = row.dialplan_uuid;
|
||||
@@ -281,8 +285,26 @@
|
||||
|
||||
--increment the x
|
||||
x = x + 1;
|
||||
|
||||
--set flag pass
|
||||
pass = true
|
||||
end);
|
||||
|
||||
-- prevent partial dialplan (pass=nil may be error in sql or empty resultset)
|
||||
if pass == false then
|
||||
log.errf('context: %s, extension: %s, type: %s, data: %s ',
|
||||
call_context,
|
||||
dialplan_name or '----',
|
||||
dialplan_detail_tag or '----',
|
||||
dialplan_detail_data or '----'
|
||||
)
|
||||
|
||||
--close the database connection
|
||||
dbh:release();
|
||||
|
||||
error('error while build context: ' .. call_context)
|
||||
end
|
||||
|
||||
--close the extension tag if it was left open
|
||||
if (dialplan_tag_status == "open") then
|
||||
table.insert(xml, [[ </condition>]]);
|
||||
|
||||
@@ -183,6 +183,9 @@
|
||||
status = dbh:query(sql, function(row)
|
||||
--add functions
|
||||
require "resources.functions.base64";
|
||||
--make sure the recordings directory exists
|
||||
require "resources.functions.mkdir";
|
||||
mkdir(recordings_dir.."/"..domain_name);
|
||||
--add the path to filename
|
||||
ivr_menu_greet_long = recordings_dir.."/"..domain_name.."/"..greet_long_file_name;
|
||||
ivr_menu_greet_long_is_base64 = true;
|
||||
|
||||
@@ -9,11 +9,15 @@
|
||||
require "resources.functions.trim";
|
||||
|
||||
local api = api
|
||||
if (not api) and freeswitch then api = freeswitch.API() else
|
||||
api = {}
|
||||
function api:execute()
|
||||
return '-ERR UNSUPPORTTED'
|
||||
end
|
||||
if not api then
|
||||
if freeswitch then
|
||||
api = freeswitch.API()
|
||||
else
|
||||
api = {}
|
||||
function api:execute()
|
||||
return '-ERR UNSUPPORTTED'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function send_event(action, key)
|
||||
|
||||
@@ -42,7 +42,7 @@ local function tracef(type, name, level, ...)
|
||||
end
|
||||
|
||||
local LEVELS = {
|
||||
'error',
|
||||
'err',
|
||||
'warning',
|
||||
'notice',
|
||||
'info',
|
||||
|
||||
@@ -54,9 +54,7 @@
|
||||
end
|
||||
|
||||
--set the recordings directory
|
||||
if (domain_count > 1) then
|
||||
recordings_dir = recordings_dir .. "/"..domain_name;
|
||||
end
|
||||
recordings_dir = recordings_dir .. "/"..domain_name;
|
||||
|
||||
--check if a file exists
|
||||
require "resources.functions.file_exists";
|
||||
@@ -139,6 +137,7 @@
|
||||
end
|
||||
session:setInputCallback("on_dtmf", "");
|
||||
session:streamFile(file_name);
|
||||
session:unsetInputCallback();
|
||||
end
|
||||
|
||||
--if base64, remove temp file (increases responsiveness when files remain local)
|
||||
|
||||
@@ -467,9 +467,13 @@ function save_module_xml() {
|
||||
function save_var_xml() {
|
||||
global $config, $db, $domain_uuid;
|
||||
|
||||
//open the vars.xml file
|
||||
$fout = fopen($_SESSION['switch']['conf']['dir']."/vars.xml","w");
|
||||
$xml = '';
|
||||
|
||||
//get the hostname
|
||||
$hostname = trim(event_socket_request_cmd('api switchname'));
|
||||
|
||||
//build the xml
|
||||
$sql = "select * from v_vars ";
|
||||
$sql .= "where var_enabled = 'true' ";
|
||||
$sql .= "order by var_cat, var_order asc ";
|
||||
@@ -477,6 +481,7 @@ function save_var_xml() {
|
||||
$prep_statement->execute();
|
||||
$prev_var_cat = '';
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
$xml = '';
|
||||
foreach ($result as &$row) {
|
||||
if ($row['var_cat'] != 'Provision') {
|
||||
if ($prev_var_cat != $row['var_cat']) {
|
||||
@@ -484,10 +489,10 @@ function save_var_xml() {
|
||||
if (strlen($row["var_description"]) > 0) {
|
||||
$xml .= "<!-- ".base64_decode($row['var_description'])." -->\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strlen($row['var_hostname']) == 0) {
|
||||
$xml .= "<X-PRE-PROCESS cmd=\"set\" data=\"".$row['var_name']."=".$row['var_value']."\"/>\n";
|
||||
} elseif ($row['var_hostname'] == system('hostname')) {
|
||||
} elseif ($row['var_hostname'] == $hostname) {
|
||||
$xml .= "<X-PRE-PROCESS cmd=\"set\" data=\"".$row['var_name']."=".$row['var_value']."\"/>\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<YealinkIPPhoneDirectory>
|
||||
{assign var=x value=1}
|
||||
{foreach $extensions as $row}
|
||||
<DirectoryEntry>
|
||||
{if $row.directory_full_name != ""}
|
||||
<Name>{$row.directory_full_name}</Name>
|
||||
{else}
|
||||
<Name>{$row.effective_caller_id_name}</Name>
|
||||
{/if}
|
||||
{if $row.number_alias != ""}
|
||||
<Telephone>{$row.number_alias}</Telephone>
|
||||
{else}
|
||||
<Telephone>{$row.extension}</Telephone>
|
||||
{/if}
|
||||
</DirectoryEntry>
|
||||
{assign var=x value=$x+1}
|
||||
{/foreach}
|
||||
</YealinkIPPhoneDirectory>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user