mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-04 10:43:49 +00:00
Queues a.k.a. fifo fix the back button, fix memcache, the title of the page, and remove the redundant files.
This commit is contained in:
@@ -1,208 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2010
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('fifo_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
require_once "resources/header.php";
|
||||
$page["title"] = $text['title-queues'];
|
||||
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//get http values and set them as variables
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo "<td align=\"center\">\n";
|
||||
echo "<br />";
|
||||
|
||||
echo " <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'><span class=\"vexpl\"><strong>".$text['header-queues']."</strong></span></td>\n";
|
||||
echo " <td align='right'>\n";
|
||||
//echo " <input type='button' class='btn' value='advanced' onclick=\"document.location.href='fifo.php';\">\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>\n";
|
||||
echo " <span class=\"vexpl\">\n";
|
||||
echo " ".$text['description-queues']."\n";
|
||||
echo " </span>\n";
|
||||
echo " </td>\n";
|
||||
echo "\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>";
|
||||
|
||||
echo " <br />";
|
||||
echo " <br />";
|
||||
|
||||
//get the number of rows in the dialplan
|
||||
$sql = "";
|
||||
$sql .= " select count(*) as num_rows from v_dialplans ";
|
||||
$sql .= " where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= " and app_uuid = '16589224-c876-aeb3-f59f-523a1c0801f7' ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } else { $sql .= "order by dialplan_order, dialplan_name asc "; }
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
unset($prep_statement, $result);
|
||||
|
||||
//paging prep
|
||||
$rows_per_page = 20;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the dialplans
|
||||
$sql = "";
|
||||
$sql .= " select * from v_dialplans ";
|
||||
$sql .= " where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= " and app_uuid = '16589224-c876-aeb3-f59f-523a1c0801f7' ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } else { $sql .= "order by dialplan_order, dialplan_name asc "; }
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('dialplan_name', $text['label-name'], $order_by, $order);
|
||||
echo th_order_by('dialplan_order', $text['label-order'], $order_by, $order);
|
||||
echo th_order_by('dialplan_enabled', $text['label-enabled'], $order_by, $order);
|
||||
echo th_order_by('dialplan_description', $text['label-description'], $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
if (permission_exists('fifo_add')) {
|
||||
echo " <a href='fifo_add.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row['dialplan_name']."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row['dialplan_order']."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ";
|
||||
if ($row['dialplan_enabled'] == 'true') {
|
||||
echo $text['option-true'];
|
||||
}
|
||||
else {
|
||||
echo $text['option-false'];
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo " <td valign='top' class='row_stylebg' width='30%'>".$row['dialplan_description']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
if (permission_exists('fifo_edit')) {
|
||||
echo " <a href='fifo_edit.php?id=".$row['dialplan_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('fifo_delete')) {
|
||||
echo " <a href='fifo_delete.php?id=".$row['dialplan_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='5'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
if (permission_exists('fifo_add')) {
|
||||
echo " <a href='fifo_add.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='5' align='left'>\n";
|
||||
echo "<br />\n";
|
||||
if ($v_path_show) {
|
||||
echo $_SESSION['switch']['conf']['dir']."/dialplan/default/";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
|
||||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
unset ($result_count);
|
||||
unset ($result);
|
||||
unset ($key);
|
||||
unset ($val);
|
||||
unset ($c);
|
||||
?>
|
||||
@@ -258,7 +258,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//delete the dialplan context from memcache
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
if ($fp) {
|
||||
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
|
||||
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"];
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
}
|
||||
|
||||
@@ -283,9 +283,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo " <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'><span class=\"vexpl\"><strong>".$text['header-queue_add']."</strong></span></td>\n";
|
||||
echo " <td align='left'><span class=\"vexpl\"><span class='title'>".$text['header-queue_add']."</span></span></td>\n";
|
||||
echo " <td align='right'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='fifo.php'\" value='".$text['button-back']."'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=16589224-c876-aeb3-f59f-523a1c0801f7'\" value='".$text['button-back']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2010
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('fifo_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
//get the id
|
||||
if (count($_GET)>0) {
|
||||
$id = $_GET["id"];
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
|
||||
//start the atomic transaction
|
||||
$count = $db->exec("BEGIN;");
|
||||
|
||||
//delete child data
|
||||
$sql = "";
|
||||
$sql .= "delete from v_dialplan_details ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and dialplan_uuid = '$id' ";
|
||||
//echo $sql;
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//delete parent data
|
||||
$sql = "";
|
||||
$sql .= "delete from v_dialplans ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and dialplan_uuid = '$id' ";
|
||||
//echo $sql;
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//commit the atomic transaction
|
||||
$count = $db->exec("COMMIT;");
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
//delete the dialplan context from memcache
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
if ($fp) {
|
||||
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
require_once "resources/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=fifo.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo $text['message-delete']."\n";
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2010
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists("fifo_delete")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$id = $_GET["id"];
|
||||
$dialplan_uuid = check_str($_REQUEST["id2"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
//delete the data
|
||||
$sql = "delete from v_dialplan_details ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and dialplan_detail_uuid = '$id' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
//delete the dialplan context from memcache
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
if ($fp) {
|
||||
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
require_once "resources/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=fifo_edit.php?id=".$dialplan_uuid."\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo $text['message-delete']."\n";
|
||||
echo "</div>\n";
|
||||
|
||||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -1,477 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2010
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('fifo_add') || permission_exists('fifo_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
//set the action as an add or an update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$dialplan_detail_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
$dialplan_uuid = check_str($_REQUEST["id2"]);
|
||||
}
|
||||
if (isset($_REQUEST["id2"])) {
|
||||
$dialplan_uuid = check_str($_REQUEST["id2"]);
|
||||
}
|
||||
|
||||
//get http values and set them as php variables
|
||||
if (count($_POST)>0) {
|
||||
if (isset($_REQUEST["dialplan_uuid"])) {
|
||||
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
|
||||
}
|
||||
$dialplan_detail_tag = check_str($_POST["dialplan_detail_tag"]);
|
||||
$dialplan_detail_order = check_str($_POST["dialplan_detail_order"]);
|
||||
$dialplan_detail_type = check_str($_POST["dialplan_detail_type"]);
|
||||
$dialplan_detail_data = check_str($_POST["dialplan_detail_data"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$dialplan_detail_uuid = check_str($_POST["dialplan_detail_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']."domain_uuid<br>\n"; }
|
||||
if (strlen($dialplan_detail_tag) == 0) { $msg .= $text['message-required'].$text['label-tag']."<br>\n"; }
|
||||
if (strlen($dialplan_detail_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('fifo_add')) {
|
||||
$dialplan_detail_uuid = uuid();
|
||||
$sql = "insert into v_dialplan_details ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "dialplan_detail_uuid, ";
|
||||
$sql .= "dialplan_detail_tag, ";
|
||||
$sql .= "dialplan_detail_order, ";
|
||||
$sql .= "dialplan_detail_type, ";
|
||||
$sql .= "dialplan_detail_data ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$dialplan_uuid', ";
|
||||
$sql .= "'$dialplan_detail_uuid', ";
|
||||
$sql .= "'$dialplan_detail_tag', ";
|
||||
$sql .= "'$dialplan_detail_order', ";
|
||||
$sql .= "'$dialplan_detail_type', ";
|
||||
$sql .= "'$dialplan_detail_data' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
//delete the dialplan context from memcache
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
if ($fp) {
|
||||
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
}
|
||||
|
||||
require_once "resources/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=fifo_edit.php?id=".$dialplan_uuid."\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo $text['message-add']."\n";
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update" && permission_exists('fifo_edit')) {
|
||||
$sql = "update v_dialplan_details set ";
|
||||
$sql .= "domain_uuid = '$domain_uuid', ";
|
||||
$sql .= "dialplan_uuid = '$dialplan_uuid', ";
|
||||
$sql .= "dialplan_detail_tag = '$dialplan_detail_tag', ";
|
||||
$sql .= "dialplan_detail_order = '$dialplan_detail_order', ";
|
||||
$sql .= "dialplan_detail_type = '$dialplan_detail_type', ";
|
||||
$sql .= "dialplan_detail_data = '$dialplan_detail_data' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and dialplan_detail_uuid = '$dialplan_detail_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
//delete the dialplan context from memcache
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
if ($fp) {
|
||||
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
}
|
||||
|
||||
require_once "resources/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=fifo_edit.php?id=".$dialplan_uuid."\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo $text['message-update']."\n";
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$dialplan_detail_uuid = $_GET["id"];
|
||||
$sql = "select * from v_dialplan_details ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and dialplan_detail_uuid = '$dialplan_detail_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$dialplan_uuid = $row["dialplan_uuid"];
|
||||
$dialplan_detail_tag = $row["dialplan_detail_tag"];
|
||||
$dialplan_detail_order = $row["dialplan_detail_order"];
|
||||
$dialplan_detail_type = $row["dialplan_detail_type"];
|
||||
$dialplan_detail_data = $row["dialplan_detail_data"];
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "resources/header.php";
|
||||
if ($action == "add") {
|
||||
$page["title"] = $text['title-queue_detail_add'];
|
||||
}
|
||||
if ($action == "update") {
|
||||
$page["title"] = $text['title-queue_detail_edit'];
|
||||
}
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
//echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
echo "<td align='left' width='30%' nowrap><b>".$text['header-queue_detail_add']."</b></td>\n";
|
||||
}
|
||||
if ($action == "update") {
|
||||
echo "<td align='left' width='30%' nowrap><b>".$text['header-queue_detail_edit']."</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='fifo_edit.php?id=".$dialplan_uuid."'\" value='".$text['button-back']."'></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function public_include_details_tag_onchange() {
|
||||
var dialplan_detail_tag = document.getElementById("form_tag").value;
|
||||
if (dialplan_detail_tag == "condition") {
|
||||
document.getElementById("label_field_type").innerHTML = "<?=$text['label-field']?>";
|
||||
document.getElementById("label_field_data").innerHTML = "<?=$text['label-expression']?>";
|
||||
}
|
||||
else if (dialplan_detail_tag == "action") {
|
||||
document.getElementById("label_field_type").innerHTML = "<?=$text['label-application']?>";
|
||||
document.getElementById("label_field_data").innerHTML = "<?=$text['label-data']?>";
|
||||
}
|
||||
else if (dialplan_detail_tag == "anti-action") {
|
||||
document.getElementById("label_field_type").innerHTML = "<?=$text['label-application']?>";
|
||||
document.getElementById("label_field_data").innerHTML = "<?=$text['label-data']?>";
|
||||
}
|
||||
else if (dialplan_detail_tag == "param") {
|
||||
document.getElementById("label_field_type").innerHTML = "<?=$text['label-name']?>";
|
||||
document.getElementById("label_field_data").innerHTML = "<?=$text['label-value']?>";
|
||||
}
|
||||
if (dialplan_detail_tag == "") {
|
||||
document.getElementById("label_field_type").innerHTML = "<?=$text['label-type']?>";
|
||||
document.getElementById("label_field_data").innerHTML = "<?=$text['label-data']?>";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-tag'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name='dialplan_detail_tag' class='formfld' id='form_tag' onchange='public_include_details_tag_onchange();'>\n";
|
||||
echo " <option></option>\n";
|
||||
switch (htmlspecialchars($dialplan_detail_tag)) {
|
||||
case "condition":
|
||||
echo " <option value='condition' selected='yes'>".$text['option-condition']."</option>\n";
|
||||
echo " <option value='action'>".$text['option-action']."</option>\n";
|
||||
echo " <option value='anti-action'>".$text['option-anti-action']."</option>\n";
|
||||
//echo " <option value='param'>".$text['option-parameter']."</option>\n";
|
||||
break;
|
||||
case "action":
|
||||
echo " <option value='condition'>".$text['option-condition']."</option>\n";
|
||||
echo " <option value='action' selected='yes'>".$text['option-action']."</option>\n";
|
||||
echo " <option value='anti-action'>".$text['option-anti-action']."</option>\n";
|
||||
//echo " <option value='param'>".$text['option-parameter']."</option>\n";
|
||||
break;
|
||||
case "anti-action":
|
||||
echo " <option value='condition'>".$text['option-condition']."</option>\n";
|
||||
echo " <option value='action'>".$text['option-action']."</option>\n";
|
||||
echo " <option value='anti-action' selected='yes'>".$text['option-anti-action']."</option>\n";
|
||||
//echo " <option value='param'>".$text['option-parameter']."</option>\n";
|
||||
break;
|
||||
case "param":
|
||||
echo " <option value='condition'>".$text['option-condition']."</option>\n";
|
||||
echo " <option value='action'>".$text['option-action']."</option>\n";
|
||||
echo " <option value='anti-action'>".$text['option-anti-action']."</option>\n";
|
||||
//echo " <option value='param' selected='yes'>".$text['option-parameter']."</option>\n";
|
||||
break;
|
||||
default:
|
||||
echo " <option value='condition'>".$text['option-condition']."</option>\n";
|
||||
echo " <option value='action'>".$text['option-action']."</option>\n";
|
||||
echo " <option value='anti-action'>".$text['option-anti-action']."</option>\n";
|
||||
//echo " <option value='param'>".$text['option-parameter']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
|
||||
//condition
|
||||
//field expression
|
||||
//action
|
||||
//application
|
||||
//data
|
||||
//antiaction
|
||||
//application
|
||||
//data
|
||||
//param
|
||||
//name
|
||||
//value
|
||||
//echo " <input class='formfld' type='text' name='dialplan_detail_tag' maxlength='255' value=\"$dialplan_detail_tag\">\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-order'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name='dialplan_detail_order' class='formfld'>\n";
|
||||
//echo " <option></option>\n";
|
||||
if (strlen(htmlspecialchars($dialplan_detail_order))> 0) {
|
||||
echo " <option selected='yes' value='".htmlspecialchars($dialplan_detail_order)."'>".htmlspecialchars($dialplan_detail_order)."</option>\n";
|
||||
}
|
||||
$i=0;
|
||||
while($i<=999) {
|
||||
if (strlen($i) == 1) {
|
||||
echo " <option value='00$i'>00$i</option>\n";
|
||||
}
|
||||
if (strlen($i) == 2) {
|
||||
echo " <option value='0$i'>0$i</option>\n";
|
||||
}
|
||||
if (strlen($i) == 3) {
|
||||
echo " <option value='$i'>$i</option>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
echo " </select>\n";
|
||||
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap id='label_field_type'>\n";
|
||||
echo " ".$text['label-type'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='dialplan_detail_type' maxlength='255' value=\"$dialplan_detail_type\">\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap id='label_field_data'>\n";
|
||||
echo " ".$text['label-data'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='dialplan_detail_data' maxlength='255' value=\"$dialplan_detail_data\">\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='dialplan_detail_uuid' value='$dialplan_detail_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
//echo "</div>\n";
|
||||
echo "</form>";
|
||||
|
||||
echo " <table width='90%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'>\n";
|
||||
|
||||
if ($v_path_show) {
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
echo "<b>".$text['header-additional_information']."</b>\n";
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
|
||||
}
|
||||
?>
|
||||
<b>Conditions</b>
|
||||
<br />
|
||||
<br />
|
||||
Conditions are pattern matching tags that help decide if the current call should be processed in this extension or not. When matching conditions against the current call you have several <b>fields</b> that you can compare against.
|
||||
<ul>
|
||||
<li><b>context</b></li>
|
||||
<li><b>rdnis</b> Redirected Number, the directory number to which the call was last presented.</li>
|
||||
<li><b>destination_number</b> Called Number, the number this call is trying to reach (within a given context)</li>
|
||||
<li><b>dialplan</b> Name of the dialplan module that are used, the name is provided by each dialplan module. Example: XML</li>
|
||||
<li><b>caller_id_name</b> Name of the caller (provided by the User Agent that has called us).</li>
|
||||
<li><b>caller_id_number</b> Directory Number of the party who called (callee) -- can be masked (hidden)</li>
|
||||
<li><b>ani</b> Automatic Number Identification, the number of the calling party (callee) -- cannot be masked</li>
|
||||
<li><b>ani2</b> The type of device placing the call [1]</li>
|
||||
<li><b>uuid</b> Unique identifier of the current call? (looks like a GUID)</li>
|
||||
<li><b>source</b> Name of the module that received the call (e.g. PortAudio)</li>
|
||||
<li><b>chan_name</b> Name of the current channel (Example: PortAudio/1234). Give us examples when this one can be used.</li>
|
||||
<li><b>network_addr</b> IP address of the signalling source for a VoIP call.</li>
|
||||
</ul>
|
||||
In addition to the above you can also do variables using the syntax ${variable} or api functions using the syntax %{api} {args}
|
||||
<br />
|
||||
<br />
|
||||
Variables may be used in either the field or the expression, as follows
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<b>Action and Anti-Actions</b>
|
||||
<br />
|
||||
<br />
|
||||
Actions are executed when the <b>condition matches</b>. Anti-Actions are executed when the <b>condition does NOT match</b>.
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
The following is a partial list of <b>applications</b>.
|
||||
<ul>
|
||||
<li><b>answer</b> answer the call</li>
|
||||
<li><b>bridge</b> bridge the call</li>
|
||||
<li><b>cond</b></li>
|
||||
<li><b>db</b> is a a runtime database either sqlite by default or odbc</li>
|
||||
<li><b>global_set</b> allows setting of global vars similar to the ones found in vars.xml</li>
|
||||
<li><b>group</b> allows grouping of several extensions for things like ring groups</li>
|
||||
<li><b>expr</b></li>
|
||||
<li><b>hangup</b> hangs up the call</li>
|
||||
<li><b>info</b> sends call info to the console</li>
|
||||
<li><b>javascript</b> run javascript .js files</li>
|
||||
<li><b>playback</b></li>
|
||||
<li><b>reject</b> reject the call</li>
|
||||
<li><b>respond</b></li>
|
||||
<li><b>ring_ready</b></li>
|
||||
<li><b>set</b> set a variable</li>
|
||||
<li><b>set_user</b></li>
|
||||
<li><b>sleep</b></li>
|
||||
<li><b>sofia_contact</b></li>
|
||||
<li><b>transfer</b> transfer the call to another extension or number</li>
|
||||
<li><b>voicemail</b> send the call to voicemail</li>
|
||||
</ul>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<!--
|
||||
<b>Param</b>
|
||||
Example parameters by name and value
|
||||
<br />
|
||||
<ul>
|
||||
<li><b>codec-ms</b> 20</li>
|
||||
<li><b>codec-prefs</b> PCMU@20i</li>
|
||||
<li><b>debug</b> 1</li>
|
||||
<li><b>dialplan</b> XML</li>
|
||||
<li><b>dtmf-duration</b> 100</li>
|
||||
<li><b>rfc2833-pt</b>" 101</li>
|
||||
<li><b>sip-port</b> 5060</li>
|
||||
<li><b>use-rtp-timer</b> true</li>
|
||||
</ul>
|
||||
<br />
|
||||
<br />
|
||||
-->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<?php
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
@@ -1,517 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
require_once "resources/paging.php";
|
||||
if (permission_exists('fifo_add') || permission_exists('fifo_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
require_once "app_languages.php";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
//set the action to an add or an update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$dialplan_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get http values and set them as variables
|
||||
if (count($_POST)>0) {
|
||||
//$domain_uuid = check_str($_POST["domain_uuid"]);
|
||||
$dialplan_name = check_str($_POST["dialplan_name"]);
|
||||
$dialplan_order = check_str($_POST["dialplan_order"]);
|
||||
$dialplan_continue = check_str($_POST["dialplan_continue"]);
|
||||
$dialplan_context = check_str($_POST["dialplan_context"]);
|
||||
$dialplan_enabled = check_str($_POST["dialplan_enabled"]);
|
||||
$dialplan_description = check_str($_POST["dialplan_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']."domain_uuid<br>\n"; }
|
||||
if (strlen($dialplan_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
|
||||
if (strlen($dialplan_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
|
||||
if (strlen($dialplan_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//set the default dialplan_continue to false
|
||||
if (strlen($dialplan_continue) == 0) { $dialplan_continue = 'false'; }
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('fifo_add')) {
|
||||
$dialplan_context = $_SESSION['context'];
|
||||
$dialplan_uuid = uuid();
|
||||
$sql = "insert into v_dialplans ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "app_uuid, ";
|
||||
$sql .= "dialplan_name, ";
|
||||
$sql .= "dialplan_order, ";
|
||||
$sql .= "dialplan_continue, ";
|
||||
$sql .= "dialplan_context, ";
|
||||
$sql .= "dialplan_enabled, ";
|
||||
$sql .= "dialplan_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$dialplan_uuid', ";
|
||||
$sql .= "'16589224-c876-aeb3-f59f-523a1c0801f7', ";
|
||||
$sql .= "'$dialplan_name', ";
|
||||
$sql .= "'$dialplan_order', ";
|
||||
$sql .= "'$dialplan_continue', ";
|
||||
$sql .= "'$dialplan_context', ";
|
||||
$sql .= "'$dialplan_enabled', ";
|
||||
$sql .= "'$dialplan_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
//delete the dialplan context from memcache
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
if ($fp) {
|
||||
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
}
|
||||
|
||||
require_once "resources/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=fifo.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo $text['message-add']."\n";
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update" && permission_exists('fifo_edit')) {
|
||||
$sql = "update v_dialplans set ";
|
||||
$sql .= "domain_uuid = '$domain_uuid', ";
|
||||
$sql .= "dialplan_name = '$dialplan_name', ";
|
||||
$sql .= "dialplan_order = '$dialplan_order', ";
|
||||
$sql .= "dialplan_continue = '$dialplan_continue', ";
|
||||
$sql .= "dialplan_context = '$dialplan_context', ";
|
||||
$sql .= "dialplan_enabled = '$dialplan_enabled', ";
|
||||
$sql .= "dialplan_description = '$dialplan_description' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
//delete the dialplan context from memcache
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
if ($fp) {
|
||||
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
}
|
||||
|
||||
require_once "resources/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=fifo.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo $text['message-update']."\n";
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$dialplan_uuid = $_GET["id"];
|
||||
$sql = "";
|
||||
$sql .= "select * from v_dialplans ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$dialplan_name = $row["dialplan_name"];
|
||||
$dialplan_order = $row["dialplan_order"];
|
||||
$dialplan_continue = $row["dialplan_continue"];
|
||||
$dialplan_context = $row["dialplan_context"];
|
||||
$dialplan_enabled = $row["dialplan_enabled"];
|
||||
$dialplan_description = $row["dialplan_description"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "resources/header.php";
|
||||
$page["title"] = $text['title-queue_edit'];
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
|
||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' width='30%'><p><span class=\"vexpl\"><strong>".$text['header-queue_edit']."</strong></td>\n";
|
||||
echo " <td width='70%' align='right'><input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='fifo.php'\" value='".$text['button-back']."'></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>\n";
|
||||
echo " ".$text['description-queue_edit']."\n";
|
||||
echo " </span></p>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>";
|
||||
echo "<br />\n";
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-name'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='dialplan_name' maxlength='255' value=\"$dialplan_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-order'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name='dialplan_order' class='formfld'>\n";
|
||||
//echo " <option></option>\n";
|
||||
if (strlen(htmlspecialchars($dialplan_order))> 0) {
|
||||
echo " <option selected='yes' value='".htmlspecialchars($dialplan_order)."'>".htmlspecialchars($dialplan_order)."</option>\n";
|
||||
}
|
||||
$i=0;
|
||||
while($i<=999) {
|
||||
if (strlen($i) == 1) {
|
||||
echo " <option value='00$i'>00$i</option>\n";
|
||||
}
|
||||
if (strlen($i) == 2) {
|
||||
echo " <option value='0$i'>0$i</option>\n";
|
||||
}
|
||||
if (strlen($i) == 3) {
|
||||
echo " <option value='$i'>$i</option>\n";
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
echo " </select>\n";
|
||||
//echo " <input class='formfld' type='text' name='dialplan_order' maxlength='255' value='$dialplan_order'>\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-continue'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='dialplan_continue'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($dialplan_continue == "true") {
|
||||
echo " <option value='true' SELECTED >".$text['option-true']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>".$text['option-true']."</option>\n";
|
||||
}
|
||||
if ($dialplan_continue == "false") {
|
||||
echo " <option value='false' SELECTED >".$text['option-false']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>".$text['option-false']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-continue']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-enabled'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='dialplan_enabled'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($dialplan_enabled == "true") {
|
||||
echo " <option value='true' SELECTED >".$text['option-true']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>".$text['option-true']."</option>\n";
|
||||
}
|
||||
if ($dialplan_enabled == "false") {
|
||||
echo " <option value='false' SELECTED >".$text['option-false']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>".$text['option-false']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-description'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <textarea class='formfld' name='dialplan_description' rows='4'>$dialplan_description</textarea>\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//v_dialplan_details
|
||||
if ($action == "update" && permission_exists('fifo_edit')) {
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'><p><span class=\"vexpl\"><strong>".$text['header-conditions_and_actions']."</strong></span><br>\n";
|
||||
echo " ".$text['description-conditions_and_actions']."\n";
|
||||
echo " </span></p></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>";
|
||||
echo "<br />\n";
|
||||
|
||||
$sql = "";
|
||||
$sql .= " select * from v_dialplan_details ";
|
||||
$sql .= " where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= " and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$sql .= " and dialplan_detail_tag = 'condition' ";
|
||||
$sql .= " order by dialplan_detail_order asc";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<th align='center'>".$text['label-tag']."</th>\n";
|
||||
echo "<th align='center'>".$text['label-type']."</th>\n";
|
||||
echo "<th align='center'>".$text['label-data']."</th>\n";
|
||||
echo "<th align='center'>".$text['label-order']."</th>\n";
|
||||
echo "<td align='right' width='42'>\n";
|
||||
if (permission_exists('fifo_add')) {
|
||||
echo " <a href='fifo_detail_edit.php?id2=".$dialplan_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row[dialplan_detail_tag]."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row[dialplan_detail_type]."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row[dialplan_detail_data]."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row[dialplan_detail_order]."</td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
if (permission_exists('fifo_edit')) {
|
||||
echo " <a href='fifo_detail_edit.php?id=".$row[dialplan_detail_uuid]."&id2=".$dialplan_uuid."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('fifo_delete')) {
|
||||
echo " <a href='fifo_detail_delete.php?id=".$row[dialplan_detail_uuid]."&id2=".$dialplan_uuid."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
//v_dialplan_details dialplan_detail_tag: action
|
||||
$sql = "";
|
||||
$sql .= " select * from v_dialplan_details ";
|
||||
$sql .= " where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= " and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$sql .= " and dialplan_detail_tag = 'action' ";
|
||||
$sql .= " order by dialplan_detail_order asc";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row[dialplan_detail_tag]."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row[dialplan_detail_type]."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row[dialplan_detail_data]."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row[dialplan_detail_order]."</td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
if (permission_exists('fifo_edit')) {
|
||||
echo " <a href='fifo_detail_edit.php?id=".$row[dialplan_detail_uuid]."&id2=".$dialplan_uuid."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('fifo_delete')) {
|
||||
echo " <a href='fifo_detail_delete.php?id=".$row[dialplan_detail_uuid]."&id2=".$dialplan_uuid."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
//v_dialplan_details dialplan_detail_tag: anti-action
|
||||
$sql = "";
|
||||
$sql .= " select * from v_dialplan_details ";
|
||||
$sql .= " where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= " and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$sql .= " and dialplan_detail_tag = 'anti-action' ";
|
||||
$sql .= " order by dialplan_detail_order asc";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
if ($result_count == 0) {
|
||||
//no results
|
||||
}
|
||||
else { //received results
|
||||
foreach($result as $row) {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row[dialplan_detail_tag]."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row[dialplan_detail_type]."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row[dialplan_detail_data]."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row[dialplan_detail_order]."</td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
if (permission_exists('fifo_edit')) {
|
||||
echo " <a href='fifo_detail_edit.php?id=".$row[dialplan_detail_uuid]."&id2=".$dialplan_uuid."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('fifo_delete')) {
|
||||
echo " <a href='fifo_detail_delete.php?id=".$row[dialplan_detail_uuid]."&id2=".$dialplan_uuid."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='5'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
if (permission_exists('fifo_add')) {
|
||||
echo " <a href='fifo_details_edit.php?id2=".$dialplan_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
} //end if update
|
||||
|
||||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
Reference in New Issue
Block a user