Merge remote-tracking branch 'upstream/master' into ivr_menu

This commit is contained in:
Alexey Melnichuk
2016-02-04 12:14:27 +03:00
16 changed files with 4718 additions and 36 deletions

View File

@@ -364,8 +364,8 @@ else {
if (count($result) > 0) {
echo "<optgroup label='Phrases'>\n";
foreach ($result as &$row) {
$selected = ($conference_center_greeting == "phrase:".$row["phrase_name"].".".$domain_uuid) ? true : false;
echo " <option value='phrase:".$row["phrase_name"].".".$domain_uuid."' ".(($selected) ? "selected='selected'" : null).">".$row["phrase_name"]."</option>\n";
$selected = ($conference_center_greeting == "phrase:".$row["phrase_uuid"]) ? true : false;
echo " <option value='phrase:".$row["phrase_uuid"]."' ".(($selected) ? "selected='selected'" : null).">".$row["phrase_name"]."</option>\n";
if ($selected) { $tmp_selected = true; }
}
unset ($prep_statement);

View File

@@ -744,8 +744,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if (count($result) > 0) {
echo "<optgroup label='Phrases'>\n";
foreach ($result as &$row) {
$selected = ($fax_send_greeting == "phrase:".$row["phrase_name"].".".$domain_uuid) ? true : false;
echo " <option value='phrase:".$row["phrase_name"].".".$domain_uuid."' ".(($selected) ? "selected='selected'" : null).">".$row["phrase_name"]."</option>\n";
$selected = ($fax_send_greeting == "phrase:".$row["phrase_uuid"]) ? true : false;
echo " <option value='phrase:".$row["phrase_uuid"]."' ".(($selected) ? "selected='selected'" : null).">".$row["phrase_name"]."</option>\n";
if ($selected) { $tmp_selected = true; }
}
unset ($prep_statement);

View File

@@ -498,7 +498,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
*/
//select
if (if_group("superadmin")) {
if (!$tmp_selected) {
if (!$tmp_selected && strlen($ivr_menu_greet_long) > 0) {
echo "<optgroup label='Selected'>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_greet_long)) {
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_greet_long."' selected='selected'>".$ivr_menu_greet_long."</option>\n";
@@ -560,12 +560,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (count($result) > 0) {
echo "<optgroup label='Phrases'>\n";
foreach ($result as &$row) {
if ($ivr_menu_greet_short == "phrase:".$row["phrase_name"].".".$domain_uuid) {
if ($ivr_menu_greet_short == "phrase:".$row["phrase_uuid"]) {
$tmp_selected = true;
echo " <option value='phrase:".$row["phrase_name"].".".$domain_uuid."' selected='selected'>".$row["phrase_name"]."</option>\n";
echo " <option value='phrase:".$row["phrase_uuid"]."' selected='selected'>".$row["phrase_name"]."</option>\n";
}
else {
echo " <option value='phrase:".$row["phrase_name"].".".$domain_uuid."'>".$row["phrase_name"]."</option>\n";
echo " <option value='phrase:".$row["phrase_uuid"]."'>".$row["phrase_name"]."</option>\n";
}
}
echo "</optgroup>\n";
@@ -899,12 +899,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (count($result) > 0) {
echo "<optgroup label='Phrases'>\n";
foreach ($result as &$row) {
if ($ivr_menu_invalid_sound == "phrase:".$row["phrase_name"].".".$domain_uuid) {
if ($ivr_menu_invalid_sound == "phrase:".$row["phrase_uuid"]) {
$tmp_selected = true;
echo " <option value='phrase:".$row["phrase_name"].".".$domain_uuid."' selected='selected'>".$row["phrase_name"]."</option>\n";
echo " <option value='phrase:".$row["phrase_uuid"]."' selected='selected'>".$row["phrase_name"]."</option>\n";
}
else {
echo " <option value='phrase:".$row["phrase_name"].".".$domain_uuid."'>".$row["phrase_name"]."</option>\n";
echo " <option value='phrase:".$row["phrase_uuid"]."'>".$row["phrase_name"]."</option>\n";
}
}
unset ($prep_statement);
@@ -933,7 +933,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
//select
if (if_group("superadmin")) {
if (!$tmp_selected) {
if (!$tmp_selected && strlen($ivr_menu_invalid_sound) > 0) {
echo "<optgroup label='Selected'>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_invalid_sound)) {
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_invalid_sound."' selected='selected'>".$ivr_menu_invalid_sound."</option>\n";
@@ -995,12 +995,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (count($result) > 0) {
echo "<optgroup label='Phrases'>\n";
foreach ($result as &$row) {
if ($ivr_menu_exit_sound == "phrase:".$row["phrase_name"].".".$domain_uuid) {
if ($ivr_menu_exit_sound == "phrase:".$row["phrase_uuid"]) {
$tmp_selected = true;
echo " <option value='phrase:".$row["phrase_name"].".".$domain_uuid."' selected='selected'>".$row["phrase_name"]."</option>\n";
echo " <option value='phrase:".$row["phrase_uuid"]."' selected='selected'>".$row["phrase_name"]."</option>\n";
}
else {
echo " <option value='phrase:".$row["phrase_name"].".".$domain_uuid."'>".$row["phrase_name"]."</option>\n";
echo " <option value='phrase:".$row["phrase_uuid"]."'>".$row["phrase_name"]."</option>\n";
}
}
unset ($prep_statement);
@@ -1029,7 +1029,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
//select
if (if_group("superadmin")) {
if (!$tmp_selected) {
if (!$tmp_selected && strlen($ivr_menu_exit_sound) > 0) {
echo "<optgroup label='Selected'>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_exit_sound)) {
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_exit_sound."' selected='selected'>".$ivr_menu_exit_sound."</option>\n";

View File

@@ -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

View File

@@ -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

View File

@@ -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,

View File

@@ -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

View File

@@ -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>]]);

View File

@@ -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;

View File

@@ -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)

View File

@@ -42,7 +42,7 @@ local function tracef(type, name, level, ...)
end
local LEVELS = {
'error',
'err',
'warning',
'notice',
'info',

View File

@@ -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)

View File

@@ -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";
}
}

View File

@@ -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