Merge pull request #15 from fusionpbx/master

13
This commit is contained in:
blackc2004
2016-02-04 07:53:47 -08:00
17 changed files with 4720 additions and 35 deletions

View File

@@ -1,26 +1,31 @@
RewriteEngine On
RewriteRule ^([A-Fa-f0-9]{12})(\.(xml|cfg))?$ app/provision/index.php?mac=$1 [QSA]
RewriteRule ^([A-Fa-f0-9]{2}[:-][A-Fa-f0-9]{2}[:-][A-Fa-f0-9]{2}[:-][A-Fa-f0-9]{2}[:-][A-Fa-f0-9]{2}[:-][A-Fa-f0-9]{2}[:-])(\.(xml|cfg))?$ app/provision/index.php?mac=$1 [QSA]
RewriteRule ^(kt.*?-)([A-Fa-f0-9]{12})(\.(xml))$ app/provision/index.php?mac=$2 [QSA]
RewriteRule ^(cfg)([A-Fa-f0-9]{12})(\.(xml))$ app/provision/index.php?mac=$2 [QSA]
# $mac or $mac.cfg/xml
RewriteRule ^([A-Fa-f0-9]{12})(?:\.xml|\.cfg)?$ app/provision/index.php?mac=$1 [QSA]
# $m:a:c or $m:a:c.cfg/xml
RewriteRule ^((?:[A-Fa-f0-9]{2}[:-]){5}[A-Fa-f0-9]{2})(?:\.xml|\.cfg)?$ app/provision/index.php?mac=$1 [QSA]
# kt*-$mac.xml
RewriteRule ^kt.*?-([A-Fa-f0-9]{12})\.xml$ app/provision/index.php?mac=$1 [QSA]
# cfg-$mac.xml
RewriteRule ^cfg([A-Fa-f0-9]{12})\.xml$ app/provision/index.php?mac=$1 [QSA]
#Snom m3
RewriteRule ^(m3/settings/)([A-Fa-f0-9]{12})(\.(cfg))?$ app/provision/index.php?mac=$2 [QSA]
RewriteRule ^m3/settings/([A-Fa-f0-9]{12})(?:\.cfg)?$ app/provision/index.php?mac=$1 [QSA]
#Grandstream
RewriteRule ^(?:.*/)?provision/cfg([A-Fa-f0-9]{12})(\.(xml|cfg))?$ app/provision/?mac=$1 [QSA]
RewriteRule ^provision/cfg([A-Fa-f0-9]{12})(?:\.xml|\.cfg)?$ app/provision/?mac=$1 [QSA]
#Yealink
RewriteRule ^(?:.*/)?provision/([A-Fa-f0-9]{12})(\.(xml|cfg))?$ app/provision/index.php?mac=$1 [QSA]
#Yealink and Polycom
RewriteRule ^provision/([A-Fa-f0-9]{12})(?:\.xml|\.cfg)?$ app/provision/index.php?mac=$1 [QSA]
#Polycom
RewriteRule ^(?:.*/)?provision/000000000000.cfg$ app/provison/?mac=$1&file={$mac}.cfg [QSA]
RewriteRule ^(?:.*/)?provision/features.cfg$ app/provision/?mac=$1&file=features.cfg [QSA]
RewriteRule ^(?:.*/)?provision/([A-Fa-f0-9]{12})-sip.cfg$ app/provision/?mac=$1&file=sip.cfg [QSA]
RewriteRule ^(?:.*/)?provision/([A-Fa-f0-9]{12})-phone.cfg$ app/provision/?mac=$1 [QSA]
RewriteRule ^(?:.*/)?provision/([A-Fa-f0-9]{12})-registration.cfg$ app/provision/?mac=$1&file={$mac}-registration.cfg [QSA]
RewriteRule ^(?:.*/)?provision/([A-Fa-f0-9]{12})-site.cfg$ app/provision/?mac=$1&file=site.cfg [QSA]
RewriteRule ^(?:.*/)?provision/([A-Fa-f0-9]{12})-web.cfg$ app/provision/?mac=$1&file=web.cfg [QSA]
RewriteRule ^provision/000000000000.cfg$ app/provision/?mac=$1&file={$mac}.cfg [QSA]
RewriteRule ^provision/features.cfg$ app/provision/?mac=$1&file=features.cfg [QSA]
RewriteRule ^provision/([A-Fa-f0-9]{12})-sip.cfg$ app/provision/?mac=$1&file=sip.cfg [QSA]
RewriteRule ^provision/([A-Fa-f0-9]{12})-phone.cfg$ app/provision/?mac=$1 [QSA]
RewriteRule ^provision/([A-Fa-f0-9]{12})-registration.cfg$ app/provision/?mac=$1&file={$mac}-registration.cfg [QSA]
RewriteRule ^provision/([A-Fa-f0-9]{12})-site.cfg$ app/provision/?mac=$1&file=site.cfg [QSA]
RewriteRule ^provision/([A-Fa-f0-9]{12})-web.cfg$ app/provision/?mac=$1&file=web.cfg [QSA]
RewriteRule ^provision/([A-Fa-f0-9]{12})-directory.xml$ app/provision/?mac=$1&file=directory.xml [QSA]
Options -Indexes

View File

@@ -364,7 +364,7 @@ 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;
$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; }
}

View File

@@ -744,7 +744,7 @@ 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;
$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; }
}

View File

@@ -560,7 +560,7 @@ 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_uuid"]."' selected='selected'>".$row["phrase_name"]."</option>\n";
}
@@ -899,7 +899,7 @@ 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_uuid"]."' selected='selected'>".$row["phrase_name"]."</option>\n";
}
@@ -995,7 +995,7 @@ 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_uuid"]."' selected='selected'>".$row["phrase_name"]."</option>\n";
}

View File

@@ -28,10 +28,11 @@
$apps[$x]['destinations'][$y]['name'] = "phrases";
$apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and phrase_enabled = 'true' ";
$apps[$x]['destinations'][$y]['order_by'] = "phrase_name asc";
$apps[$x]['destinations'][$y]['field']['uuid'] = "phrase_uuid";
$apps[$x]['destinations'][$y]['field']['name'] = "phrase_name";
$apps[$x]['destinations'][$y]['field']['destination'] = "phrase_name";
$apps[$x]['destinations'][$y]['select_value']['dialplan'] = "phrase:\${destination}.\${domain_uuid}";
$apps[$x]['destinations'][$y]['select_value']['ivr'] = "menu-exec-app:phrase \${destination}.\${domain_uuid}";
$apps[$x]['destinations'][$y]['select_value']['dialplan'] = "phrase:\${uuid}";
$apps[$x]['destinations'][$y]['select_value']['ivr'] = "menu-exec-app:phrase \${uuid}";
$apps[$x]['destinations'][$y]['select_label'] = "\${name}";
//permission details

View File

@@ -142,7 +142,7 @@ echo "<br><br>";
echo "<form name='frm' method='post' action=''>\n";
if (permission_exists("upgrade_source") && !is_dir("/usr/share/examples/fusionpbx")) {
if (permission_exists("upgrade_source") && !is_dir("/usr/share/examples/fusionpbx") && is_writeable($_SERVER["PROJECT_ROOT"]."/.git")) {
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo " <td width='30%' class='vncell'>\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

@@ -193,6 +193,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

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

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