2012-06-04 16:58:40 +02:00
|
|
|
<?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>
|
2014-04-03 23:00:13 +02:00
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2014
|
2012-06-04 16:58:40 +02:00
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
2014-12-21 07:27:18 +01:00
|
|
|
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
2012-06-04 16:58:40 +02:00
|
|
|
*/
|
|
|
|
|
include "root.php";
|
2013-07-06 08:03:27 +02:00
|
|
|
require_once "resources/require.php";
|
2013-07-06 07:50:55 +02:00
|
|
|
require_once "resources/check_auth.php";
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/paging.php";
|
2014-01-21 05:33:54 +01:00
|
|
|
require_once "resources/classes/orm.php";
|
2013-05-29 06:34:28 +02:00
|
|
|
if (permission_exists('dialplan_add')
|
|
|
|
|
|| permission_exists('dialplan_edit')
|
|
|
|
|
|| permission_exists('inbound_route_add')
|
2012-06-04 16:58:40 +02:00
|
|
|
|| permission_exists('inbound_route_edit')
|
2013-05-29 06:34:28 +02:00
|
|
|
|| permission_exists('outbound_route_add')
|
2012-06-04 16:58:40 +02:00
|
|
|
|| permission_exists('outbound_route_edit')
|
2013-09-11 21:31:40 +02:00
|
|
|
|| permission_exists('fifo_edit')
|
|
|
|
|
|| permission_exists('fifo_add')
|
2013-09-21 23:45:35 +02:00
|
|
|
|| permission_exists('time_condition_add')
|
|
|
|
|
|| permission_exists('time_condition_edit')) {
|
2012-06-04 16:58:40 +02:00
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-29 06:34:28 +02:00
|
|
|
//add multi-lingual support
|
|
|
|
|
require_once "app_languages.php";
|
|
|
|
|
foreach($text as $key => $value) {
|
|
|
|
|
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
//set the action as an add or an update
|
|
|
|
|
if (isset($_REQUEST["id"])) {
|
|
|
|
|
$action = "update";
|
|
|
|
|
$dialplan_uuid = check_str($_REQUEST["id"]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$action = "add";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//get the app uuid
|
|
|
|
|
$app_uuid = check_str($_REQUEST["app_uuid"]);
|
|
|
|
|
|
|
|
|
|
//get the http post values and set them as php variables
|
2014-01-11 00:58:42 +01:00
|
|
|
if (count($_POST) > 0) {
|
2012-06-04 16:58:40 +02:00
|
|
|
$dialplan_name = check_str($_POST["dialplan_name"]);
|
|
|
|
|
$dialplan_number = check_str($_POST["dialplan_number"]);
|
|
|
|
|
$dialplan_order = check_str($_POST["dialplan_order"]);
|
|
|
|
|
$dialplan_continue = check_str($_POST["dialplan_continue"]);
|
2014-01-11 00:58:42 +01:00
|
|
|
$dialplan_details = $_POST["dialplan_details"];
|
2012-06-04 16:58:40 +02:00
|
|
|
if (strlen($dialplan_continue) == 0) { $dialplan_continue = "false"; }
|
|
|
|
|
$dialplan_context = check_str($_POST["dialplan_context"]);
|
|
|
|
|
$dialplan_enabled = check_str($_POST["dialplan_enabled"]);
|
|
|
|
|
$dialplan_description = check_str($_POST["dialplan_description"]);
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-11 00:58:42 +01:00
|
|
|
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
$msg = '';
|
|
|
|
|
if ($action == "update") {
|
|
|
|
|
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//check for all required data
|
2013-05-29 06:34:28 +02:00
|
|
|
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_continue) == 0) { $msg .= $text['message-required'].$text['label-continue']."<br>\n"; }
|
|
|
|
|
if (strlen($dialplan_context) == 0) { $msg .= $text['message-required'].$text['label-context']."<br>\n"; }
|
|
|
|
|
if (strlen($dialplan_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
|
|
|
|
|
//if (strlen($dialplan_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
|
2012-06-04 16:58:40 +02:00
|
|
|
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/header.php";
|
2013-07-06 08:21:12 +02:00
|
|
|
require_once "resources/persist_form_var.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<div align='center'>\n";
|
|
|
|
|
echo "<table><tr><td>\n";
|
|
|
|
|
echo $msg."<br />";
|
|
|
|
|
echo "</td></tr></table>\n";
|
|
|
|
|
persistformvar($_POST);
|
|
|
|
|
echo "</div>\n";
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-01 11:01:40 +02:00
|
|
|
//remove the invalid characters from the dialplan name
|
2014-04-03 23:00:13 +02:00
|
|
|
$dialplan_name = $_POST["dialplan_name"];
|
2014-04-01 11:01:40 +02:00
|
|
|
$dialplan_name = str_replace(" ", "_", $dialplan_name);
|
|
|
|
|
$dialplan_name = str_replace("/", "", $dialplan_name);
|
|
|
|
|
|
|
|
|
|
//build the array
|
2014-04-01 11:24:01 +02:00
|
|
|
if (strlen($row["dialplan_uuid"]) > 0) {
|
2014-04-03 23:00:13 +02:00
|
|
|
$array['dialplan_uuid'] = $_POST["dialplan_uuid"];
|
2014-04-01 11:24:01 +02:00
|
|
|
}
|
2014-05-24 05:15:51 +02:00
|
|
|
if (isset($_POST["domain_uuid"])) {
|
|
|
|
|
$array['domain_uuid'] = $_POST['domain_uuid'];
|
|
|
|
|
}
|
2014-05-22 06:20:28 +02:00
|
|
|
else {
|
|
|
|
|
$array['domain_uuid'] = $_SESSION['domain_uuid'];
|
|
|
|
|
}
|
2014-04-01 11:01:40 +02:00
|
|
|
$array['dialplan_name'] = $dialplan_name;
|
2014-04-03 23:00:13 +02:00
|
|
|
$array['dialplan_number'] = $_POST["dialplan_number"];
|
|
|
|
|
$array['dialplan_context'] = $_POST["dialplan_context"];
|
|
|
|
|
$array['dialplan_continue'] = $_POST["dialplan_continue"];
|
|
|
|
|
$array['dialplan_order'] = $_POST["dialplan_order"];
|
|
|
|
|
$array['dialplan_enabled'] = $_POST["dialplan_enabled"];
|
|
|
|
|
$array['dialplan_description'] = $_POST["dialplan_description"];
|
2014-01-19 14:09:17 +01:00
|
|
|
$x = 0;
|
|
|
|
|
foreach ($_POST["dialplan_details"] as $row) {
|
2014-04-01 11:01:40 +02:00
|
|
|
if (strlen($row["dialplan_detail_tag"]) > 0) {
|
2014-04-01 11:24:01 +02:00
|
|
|
if (strlen($row["dialplan_detail_uuid"]) > 0) {
|
2014-04-03 23:00:13 +02:00
|
|
|
$array['dialplan_details'][$x]['dialplan_detail_uuid'] = $row["dialplan_detail_uuid"];
|
2014-04-01 11:24:01 +02:00
|
|
|
}
|
2014-05-22 06:20:28 +02:00
|
|
|
else {
|
|
|
|
|
$array['dialplan_details'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
|
|
|
|
}
|
2014-04-03 23:00:13 +02:00
|
|
|
$array['dialplan_details'][$x]['dialplan_detail_tag'] = $row["dialplan_detail_tag"];
|
|
|
|
|
$array['dialplan_details'][$x]['dialplan_detail_type'] = $row["dialplan_detail_type"];
|
|
|
|
|
$array['dialplan_details'][$x]['dialplan_detail_data'] = $row["dialplan_detail_data"];
|
|
|
|
|
$array['dialplan_details'][$x]['dialplan_detail_break'] = $row["dialplan_detail_break"];
|
|
|
|
|
$array['dialplan_details'][$x]['dialplan_detail_inline'] = $row["dialplan_detail_inline"];
|
|
|
|
|
$array['dialplan_details'][$x]['dialplan_detail_group'] = $row["dialplan_detail_group"];
|
|
|
|
|
$array['dialplan_details'][$x]['dialplan_detail_order'] = $row["dialplan_detail_order"];
|
2014-04-01 11:01:40 +02:00
|
|
|
}
|
|
|
|
|
$x++;
|
2014-01-19 14:09:17 +01:00
|
|
|
}
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//add or update the database
|
|
|
|
|
if ($_POST["persistformvar"] != "true") {
|
2014-01-19 14:09:17 +01:00
|
|
|
$orm = new orm;
|
|
|
|
|
$orm->name('dialplans');
|
|
|
|
|
$orm->uuid($dialplan_uuid);
|
2014-04-01 11:01:40 +02:00
|
|
|
$orm->save($array);
|
2014-01-19 14:09:17 +01:00
|
|
|
//$message = $orm->message;
|
|
|
|
|
}
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2014-01-19 14:09:17 +01:00
|
|
|
//delete the cache
|
|
|
|
|
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
|
|
|
|
if ($fp) {
|
|
|
|
|
$switch_cmd = "memcache delete dialplan:".$dialplan_context;
|
|
|
|
|
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
|
|
|
|
}
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2014-01-19 14:09:17 +01:00
|
|
|
//synchronize the xml config
|
|
|
|
|
save_dialplan_xml();
|
2014-01-11 00:58:42 +01:00
|
|
|
|
2014-01-19 14:09:17 +01:00
|
|
|
//set the message
|
|
|
|
|
if ($action == "add") {
|
|
|
|
|
$_SESSION['message'] = $text['message-add'];
|
|
|
|
|
}
|
2014-03-15 22:35:53 +01:00
|
|
|
else if ($action == "update") {
|
2014-01-19 14:09:17 +01:00
|
|
|
$_SESSION['message'] = $text['message-update'];
|
|
|
|
|
}
|
2014-07-31 11:21:16 +02:00
|
|
|
header("Location: ?id=".$dialplan_uuid.(($app_uuid != '') ? "&app_uuid=".$app_uuid : null));
|
2014-03-15 22:35:53 +01:00
|
|
|
exit;
|
2014-01-11 00:58:42 +01:00
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
|
|
|
|
|
|
|
|
|
//pre-populate the form
|
2014-05-22 08:44:35 +02:00
|
|
|
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
|
2012-06-04 16:58:40 +02:00
|
|
|
$dialplan_uuid = $_GET["id"];
|
2014-02-06 11:13:57 +01:00
|
|
|
$orm = new orm;
|
|
|
|
|
$orm->name('dialplans');
|
|
|
|
|
$orm->uuid($dialplan_uuid);
|
|
|
|
|
$result = $orm->find()->get();
|
|
|
|
|
//$message = $orm->message;
|
2012-06-04 16:58:40 +02:00
|
|
|
foreach ($result as &$row) {
|
2014-05-22 08:44:35 +02:00
|
|
|
$domain_uuid = $row["domain_uuid"];
|
2014-07-31 11:21:16 +02:00
|
|
|
//$app_uuid = $row["app_uuid"];
|
2012-06-04 16:58:40 +02:00
|
|
|
$dialplan_name = $row["dialplan_name"];
|
|
|
|
|
$dialplan_number = $row["dialplan_number"];
|
|
|
|
|
$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"];
|
|
|
|
|
}
|
|
|
|
|
unset ($prep_statement);
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-11 00:58:42 +01:00
|
|
|
//get the dialplan details in an array
|
|
|
|
|
$sql = "select * from v_dialplan_details ";
|
2014-01-19 14:09:17 +01:00
|
|
|
$sql .= "where dialplan_uuid = '$dialplan_uuid' ";
|
2014-01-11 00:58:42 +01:00
|
|
|
$sql .= "order by dialplan_detail_group asc, 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);
|
|
|
|
|
|
|
|
|
|
//create a new array that is sorted into groups and put the tags in order conditions, actions, anti-actions
|
|
|
|
|
$x = 0;
|
|
|
|
|
$details = '';
|
|
|
|
|
//conditions
|
|
|
|
|
foreach($result as $row) {
|
|
|
|
|
if ($row['dialplan_detail_tag'] == "condition") {
|
|
|
|
|
$group = $row['dialplan_detail_group'];
|
|
|
|
|
foreach ($row as $key => $val) {
|
|
|
|
|
$details[$group][$x][$key] = $val;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$x++;
|
|
|
|
|
}
|
|
|
|
|
//regex
|
|
|
|
|
foreach($result as $row) {
|
|
|
|
|
if ($row['dialplan_detail_tag'] == "regex") {
|
|
|
|
|
$group = $row['dialplan_detail_group'];
|
|
|
|
|
foreach ($row as $key => $val) {
|
|
|
|
|
$details[$group][$x][$key] = $val;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$x++;
|
|
|
|
|
}
|
|
|
|
|
//actions
|
|
|
|
|
foreach($result as $row) {
|
|
|
|
|
if ($row['dialplan_detail_tag'] == "action") {
|
|
|
|
|
$group = $row['dialplan_detail_group'];
|
|
|
|
|
foreach ($row as $key => $val) {
|
|
|
|
|
$details[$group][$x][$key] = $val;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$x++;
|
|
|
|
|
}
|
|
|
|
|
//anti-actions
|
|
|
|
|
foreach($result as $row) {
|
|
|
|
|
if ($row['dialplan_detail_tag'] == "anti-action") {
|
|
|
|
|
$group = $row['dialplan_detail_group'];
|
|
|
|
|
foreach ($row as $key => $val) {
|
|
|
|
|
$details[$group][$x][$key] = $val;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$x++;
|
|
|
|
|
}
|
|
|
|
|
unset($result);
|
|
|
|
|
//blank row
|
|
|
|
|
foreach($details as $group => $row) {
|
|
|
|
|
//set the array key for the empty row
|
|
|
|
|
$x = "999";
|
|
|
|
|
//get the highest dialplan_detail_order
|
|
|
|
|
foreach ($row as $key => $field) {
|
|
|
|
|
$dialplan_detail_order = 0;
|
|
|
|
|
if ($dialplan_detail_order < $field['dialplan_detail_order']) {
|
|
|
|
|
$dialplan_detail_order = $field['dialplan_detail_order'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//increment the highest order by 5
|
2014-01-19 14:09:17 +01:00
|
|
|
$dialplan_detail_order = $dialplan_detail_order + 10;
|
2014-01-11 00:58:42 +01:00
|
|
|
//set the rest of the empty array
|
|
|
|
|
//$details[$group][$x]['domain_uuid'] = '';
|
|
|
|
|
//$details[$group][$x]['dialplan_uuid'] = '';
|
|
|
|
|
$details[$group][$x]['dialplan_detail_tag'] = '';
|
|
|
|
|
$details[$group][$x]['dialplan_detail_type'] = '';
|
|
|
|
|
$details[$group][$x]['dialplan_detail_data'] = '';
|
|
|
|
|
$details[$group][$x]['dialplan_detail_break'] = '';
|
|
|
|
|
$details[$group][$x]['dialplan_detail_inline'] = '';
|
|
|
|
|
$details[$group][$x]['dialplan_detail_group'] = $group;
|
|
|
|
|
$details[$group][$x]['dialplan_detail_order'] = $dialplan_detail_order;
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
//show the header
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/header.php";
|
2014-07-10 02:32:50 +02:00
|
|
|
$document['title'] = $text['title-dialplan_edit'];
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2014-01-11 00:58:42 +01:00
|
|
|
//javascript to change select to input and back again
|
|
|
|
|
?><script language="javascript">
|
|
|
|
|
var objs;
|
|
|
|
|
|
|
|
|
|
function change_to_input(obj){
|
|
|
|
|
tb=document.createElement('INPUT');
|
|
|
|
|
tb.type='text';
|
|
|
|
|
tb.name=obj.name;
|
|
|
|
|
tb.className='formfld';
|
|
|
|
|
//tb.setAttribute('id', 'ivr_menu_option_param');
|
2014-01-12 02:01:28 +01:00
|
|
|
tb.setAttribute('style', 'width:175px;');
|
2014-01-11 00:58:42 +01:00
|
|
|
tb.value=obj.options[obj.selectedIndex].value;
|
|
|
|
|
tbb=document.createElement('INPUT');
|
|
|
|
|
tbb.setAttribute('class', 'btn');
|
2014-08-03 08:12:10 +02:00
|
|
|
tbb.setAttribute('style', 'margin-left: 4px;');
|
2014-01-11 00:58:42 +01:00
|
|
|
tbb.type='button';
|
2014-08-03 09:02:12 +02:00
|
|
|
tbb.value=$("<div />").html('◁').text();
|
2014-01-11 00:58:42 +01:00
|
|
|
tbb.objs=[obj,tb,tbb];
|
|
|
|
|
tbb.onclick=function(){ replace_param(this.objs); }
|
|
|
|
|
obj.parentNode.insertBefore(tb,obj);
|
|
|
|
|
obj.parentNode.insertBefore(tbb,obj);
|
|
|
|
|
obj.parentNode.removeChild(obj);
|
|
|
|
|
replace_param(this.objs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function replace_param(obj){
|
|
|
|
|
obj[2].parentNode.insertBefore(obj[0],obj[2]);
|
|
|
|
|
obj[0].parentNode.removeChild(obj[1]);
|
|
|
|
|
obj[0].parentNode.removeChild(obj[2]);
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<?php
|
|
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
//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";
|
2014-01-11 23:55:54 +01:00
|
|
|
echo " <br>";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
echo "<form method='post' name='frm' action=''>\n";
|
2014-07-31 11:21:16 +02:00
|
|
|
echo "<input type='hidden' name='app_uuid' value='".$app_uuid."'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
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%'>\n";
|
2013-09-18 23:48:15 +02:00
|
|
|
echo" <span class=\"title\">".$text['title-dialplan_edit']."</span><br />\n";
|
2014-01-11 06:52:26 +01:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td width='70%' align='right'>\n";
|
2014-07-31 11:21:16 +02:00
|
|
|
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='dialplans.php".((strlen($app_uuid) > 0) ? "?app_uuid=".$app_uuid : null)."';\" value='".$text['button-back']."'>\n";
|
2014-04-27 00:50:52 +02:00
|
|
|
echo " <input type='button' class='btn' name='' alt='".$text['button-copy']."' onclick=\"if (confirm('".$text['confirm-copy']."')){window.location='dialplan_copy.php?id=".$dialplan_uuid."';}\" value='".$text['button-copy']."'>\n";
|
|
|
|
|
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
|
2014-01-11 06:52:26 +01:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td align='left' colspan='2'>\n";
|
|
|
|
|
echo " ".$text['description-dialplan-edit']."\n";
|
|
|
|
|
echo " \n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</table>";
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
|
2014-03-17 19:56:33 +01:00
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<tr>\n";
|
2014-03-17 19:56:33 +01:00
|
|
|
echo "<td width='50%' style='vertical-align: top;'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2014-03-17 19:56:33 +01:00
|
|
|
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap' width='30%'>\n";
|
|
|
|
|
echo " ".$text['label-name']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' width='70%' align='left'>\n";
|
2014-12-21 07:27:18 +01:00
|
|
|
echo " <input class='formfld' type='text' name='dialplan_name' maxlength='255' placeholder='' value=\"".htmlspecialchars($dialplan_name)."\" required='required'>\n";
|
2014-03-17 19:56:33 +01:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2014-03-17 19:56:33 +01:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-number']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <input class='formfld' type='text' name='dialplan_number' maxlength='255' placeholder='' value=\"".htmlspecialchars($dialplan_number)."\">\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap' width='30%'>\n";
|
|
|
|
|
echo " ".$text['label-context']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left' width='70%'>\n";
|
|
|
|
|
echo " <input class='formfld' type='text' name='dialplan_context' maxlength='255' placeholder='' value=\"$dialplan_context\">\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2014-03-17 19:56:33 +01:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='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";
|
|
|
|
|
if ($dialplan_continue == "true") {
|
|
|
|
|
echo " <option value='true' selected='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='selected'>".$text['option-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='false'>".$text['option-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
|
|
|
|
|
echo "</td>";
|
|
|
|
|
echo "<td width='50%' style='vertical-align: top;'>\n";
|
|
|
|
|
|
|
|
|
|
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap' width='30%'>\n";
|
|
|
|
|
echo " ".$text['label-order']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left' width='70%'>\n";
|
|
|
|
|
echo " <select name='dialplan_order' class='formfld'>\n";
|
|
|
|
|
$i=0;
|
|
|
|
|
while($i<=999) {
|
2014-04-27 11:19:03 +02:00
|
|
|
$selected = ($i == $dialplan_order) ? "selected" : null;
|
2014-03-17 19:56:33 +01:00
|
|
|
if (strlen($i) == 1) {
|
2014-04-27 11:19:03 +02:00
|
|
|
echo " <option value='00$i' ".$selected.">00$i</option>\n";
|
2014-03-17 19:56:33 +01:00
|
|
|
}
|
|
|
|
|
if (strlen($i) == 2) {
|
2014-04-27 11:19:03 +02:00
|
|
|
echo " <option value='0$i' ".$selected.">0$i</option>\n";
|
2014-03-17 19:56:33 +01:00
|
|
|
}
|
|
|
|
|
if (strlen($i) == 3) {
|
2014-04-27 11:19:03 +02:00
|
|
|
echo " <option value='$i' ".$selected.">$i</option>\n";
|
2014-03-17 19:56:33 +01:00
|
|
|
}
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo " <br />\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2014-05-22 06:20:28 +02:00
|
|
|
if (permission_exists('dialplan_domain')) {
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-domain'].":\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <select class='formfld' name='domain_uuid'>\n";
|
|
|
|
|
if (strlen($domain_uuid) == 0) {
|
|
|
|
|
echo " <option value='' selected='selected'>".$text['select-global']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value=''>".$text['select-global']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
foreach ($_SESSION['domains'] as $row) {
|
|
|
|
|
if ($row['domain_uuid'] == $domain_uuid) {
|
|
|
|
|
echo " <option value='".$row['domain_uuid']."' selected='selected'>".$row['domain_name']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='".$row['domain_uuid']."'>".$row['domain_name']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-domain_name']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-17 19:56:33 +01:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='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";
|
|
|
|
|
if ($dialplan_enabled == "true") {
|
|
|
|
|
echo " <option value='true' selected='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='selected'>".$text['option-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='false'>".$text['option-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap' width='30%'>\n";
|
|
|
|
|
echo " ".$text['label-description']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left' width='70%'>\n";
|
|
|
|
|
echo " <textarea class='formfld' style='width: 250px; height: 68px;' name='dialplan_description'>".htmlspecialchars($dialplan_description)."</textarea>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
|
|
|
|
|
echo "</td>";
|
|
|
|
|
echo "</tr>";
|
|
|
|
|
echo "</table>";
|
2014-01-11 00:58:42 +01:00
|
|
|
|
|
|
|
|
//dialplan details
|
|
|
|
|
if ($action == "update") {
|
2014-03-15 22:35:53 +01:00
|
|
|
|
|
|
|
|
echo "<table width='100%' border='0' cellpadding='3' cellspacing='0'>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td valign='top' align='left' nowrap='nowrap' colspan='2' style='padding: 20px 0px;'>\n";
|
2014-01-11 00:58:42 +01:00
|
|
|
|
|
|
|
|
//define the alternating row styles
|
|
|
|
|
$c = 0;
|
|
|
|
|
$row_style["0"] = "row_style0";
|
|
|
|
|
$row_style["1"] = "row_style1";
|
|
|
|
|
|
2014-01-11 23:55:54 +01:00
|
|
|
?>
|
|
|
|
|
<!--javascript to change select to input and back again-->
|
|
|
|
|
<script language="javascript">
|
|
|
|
|
|
2014-03-15 22:35:53 +01:00
|
|
|
function label_to_form(label_id, form_id) {
|
2014-01-11 23:55:54 +01:00
|
|
|
if (document.getElementById(label_id) != null) {
|
|
|
|
|
label = document.getElementById(label_id);
|
|
|
|
|
label.parentNode.removeChild(label);
|
|
|
|
|
}
|
2014-03-15 22:35:53 +01:00
|
|
|
document.getElementById(form_id).style.display='';
|
2014-01-11 23:55:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
<?php
|
|
|
|
|
|
2014-01-11 00:58:42 +01:00
|
|
|
//display the results
|
|
|
|
|
if ($result_count > 0) {
|
2014-03-15 22:35:53 +01:00
|
|
|
|
|
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='3' style='margin: -3px;'>\n";
|
|
|
|
|
|
2014-01-11 00:58:42 +01:00
|
|
|
$x = 0;
|
|
|
|
|
foreach($details as $group) {
|
2014-03-15 22:35:53 +01:00
|
|
|
|
|
|
|
|
if ($x != 0) {
|
|
|
|
|
echo "<tr><td colspan='7'><br></td></tr>";
|
2014-01-11 00:58:42 +01:00
|
|
|
}
|
|
|
|
|
|
2014-03-15 22:35:53 +01:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncellcolreq'>".$text['label-tag']."</td>\n";
|
|
|
|
|
echo "<td class='vncellcolreq'>".$text['label-type']."</td>\n";
|
2014-03-17 19:56:33 +01:00
|
|
|
echo "<td class='vncellcol' width='70%'>".$text['label-data']."</td>\n";
|
2014-03-15 22:35:53 +01:00
|
|
|
echo "<td class='vncellcol'>".$text['label-break']."</td>\n";
|
|
|
|
|
echo "<td class='vncellcol' style='text-align: center;'>".$text['label-inline']."</td>\n";
|
2014-03-17 19:56:33 +01:00
|
|
|
echo "<td class='vncellcolreq' style='text-align: center;'>".$text['label-group']."</td>\n";
|
2014-03-15 22:35:53 +01:00
|
|
|
echo "<td class='vncellcolreq' style='text-align: center;'>".$text['label-order']."</td>\n";
|
|
|
|
|
echo "<td> </td>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
|
|
|
|
|
foreach($group as $index => $row) {
|
2014-01-11 00:58:42 +01:00
|
|
|
|
|
|
|
|
//get the values from the database and set as variables
|
|
|
|
|
$dialplan_detail_uuid = $row['dialplan_detail_uuid'];
|
|
|
|
|
$dialplan_detail_tag = $row['dialplan_detail_tag'];
|
|
|
|
|
$dialplan_detail_type = $row['dialplan_detail_type'];
|
|
|
|
|
$dialplan_detail_data = $row['dialplan_detail_data'];
|
|
|
|
|
$dialplan_detail_break = $row['dialplan_detail_break'];
|
|
|
|
|
$dialplan_detail_inline = $row['dialplan_detail_inline'];
|
|
|
|
|
$dialplan_detail_group = $row['dialplan_detail_group'];
|
|
|
|
|
$dialplan_detail_order = $row['dialplan_detail_order'];
|
|
|
|
|
|
|
|
|
|
//view
|
|
|
|
|
/*
|
|
|
|
|
echo "<tr >\n";
|
|
|
|
|
echo " <td valign='top' class='vtable'> ".$row['dialplan_detail_tag']."</td>\n";
|
|
|
|
|
echo " <td valign='top' class='vtable'> ".$row['dialplan_detail_type']."</td>\n";
|
|
|
|
|
echo " <td valign='top' class='vtable'> ".wordwrap($row['dialplan_detail_data'],180,"<br>",1)."</td>\n";
|
|
|
|
|
echo " <td valign='top' class='vtable'> ".$row['dialplan_detail_break']."</td>\n";
|
|
|
|
|
echo " <td valign='top' class='vtable'> ".$row['dialplan_detail_inline']."</td>\n";
|
|
|
|
|
echo " <td valign='top' class='vtable'> ".$row['dialplan_detail_group']."</td>\n";
|
|
|
|
|
echo " <td valign='top' class='vtable'> ".$row['dialplan_detail_order']."</td>\n";
|
|
|
|
|
echo " <td valign='top' align='right' nowrap='nowrap'>\n";
|
|
|
|
|
echo " <a href='dialplan_detail_edit.php?id=".$row['dialplan_detail_uuid']."&dialplan_uuid=".$dialplan_uuid."&app_uuid=".$app_uuid."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
|
|
|
|
|
echo " <a href='dialplan_detail_delete.php?id=".$row['dialplan_detail_uuid']."&dialplan_uuid=".$dialplan_uuid."&app_uuid=".$app_uuid."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//begin the row
|
|
|
|
|
echo "<tr>\n";
|
2014-01-11 23:55:54 +01:00
|
|
|
//determine whether to hide the element
|
|
|
|
|
if (strlen($dialplan_detail_tag) == 0) {
|
|
|
|
|
$element['hidden'] = false;
|
2014-04-16 03:06:11 +02:00
|
|
|
$element['visibility'] = "";
|
2014-01-11 23:55:54 +01:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$element['hidden'] = true;
|
2014-03-15 22:35:53 +01:00
|
|
|
$element['visibility'] = "display: none;";
|
2014-01-11 23:55:54 +01:00
|
|
|
}
|
2014-01-11 00:58:42 +01:00
|
|
|
//add the primary key uuid
|
2014-01-19 14:09:17 +01:00
|
|
|
if (strlen($dialplan_detail_uuid) > 0) {
|
|
|
|
|
echo " <input name='dialplan_details[".$x."][dialplan_detail_uuid]' type='hidden' value=\"".$dialplan_detail_uuid."\">\n";
|
|
|
|
|
}
|
2014-01-11 00:58:42 +01:00
|
|
|
//tag
|
|
|
|
|
$selected = "selected=\"selected\" ";
|
2014-03-15 22:35:53 +01:00
|
|
|
echo "<td class='vtablerow' onclick=\"label_to_form('label_dialplan_detail_tag_".$x."','dialplan_detail_tag_".$x."');\" nowrap='nowrap'>\n";
|
2014-01-11 23:55:54 +01:00
|
|
|
if ($element['hidden']) {
|
|
|
|
|
echo " <label id=\"label_dialplan_detail_tag_".$x."\">".$dialplan_detail_tag."</label>\n";
|
|
|
|
|
}
|
2014-03-15 22:35:53 +01:00
|
|
|
echo " <select id='dialplan_detail_tag_".$x."' name='dialplan_details[".$x."][dialplan_detail_tag]' class='formfld' style='width: 97px; ".$element['visibility']."'>\n";
|
2014-01-11 00:58:42 +01:00
|
|
|
echo " <option></option>\n";
|
2014-03-15 22:35:53 +01:00
|
|
|
echo " <option value='condition' ".($dialplan_detail_tag == "condition" ? $selected : null).">".$text['option-condition']."</option>\n";
|
|
|
|
|
echo " <option value='regex' ".($dialplan_detail_tag == "regex" ? $selected : null).">".$text['option-regex']."</option>\n";
|
|
|
|
|
echo " <option value='action' ".($dialplan_detail_tag == "action" ? $selected : null).">".$text['option-action']."</option>\n";
|
|
|
|
|
echo " <option value='anti-action' ".($dialplan_detail_tag == "anti-action" ? $selected : null).">".$text['option-anti-action']."</option>\n";
|
2014-01-11 00:58:42 +01:00
|
|
|
echo " </select>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
//type
|
2014-03-15 22:35:53 +01:00
|
|
|
echo "<td class='vtablerow' onclick=\"label_to_form('label_dialplan_detail_type_".$x."','dialplan_detail_type_".$x."');\" nowrap='nowrap'>\n";
|
2014-01-11 23:55:54 +01:00
|
|
|
if ($element['hidden']) {
|
|
|
|
|
echo " <label id=\"label_dialplan_detail_type_".$x."\">".$dialplan_detail_type."</label>\n";
|
|
|
|
|
}
|
2014-03-15 22:35:53 +01:00
|
|
|
echo " <select id='dialplan_detail_type_".$x."' name='dialplan_details[".$x."][dialplan_detail_type]' class='formfld' style='width: auto; ".$element['visibility']."' onchange='change_to_input(this);'>\n";
|
2014-01-11 00:58:42 +01:00
|
|
|
if (strlen($dialplan_detail_type) > 0) {
|
|
|
|
|
echo " <optgroup label='selected'>\n";
|
|
|
|
|
echo " <option value='".htmlspecialchars($dialplan_detail_type)."'>".htmlspecialchars($dialplan_detail_type)."</option>\n";
|
|
|
|
|
echo " </optgroup>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value=''></option>\n";
|
|
|
|
|
}
|
|
|
|
|
//if (strlen($dialplan_detail_tag) == 0 || $dialplan_detail_tag == "condition" || $dialplan_detail_tag == "regex") {
|
|
|
|
|
echo " <optgroup label='".$text['optgroup-condition_or_regex']."'>\n";
|
|
|
|
|
echo " <option value='context'>".$text['option-context']."</option>\n";
|
|
|
|
|
echo " <option value='username'>".$text['option-username']."</option>\n";
|
|
|
|
|
echo " <option value='rdnis'>".$text['option-rdnis']."</option>\n";
|
|
|
|
|
echo " <option value='destination_number'>".$text['option-destination_number']."</option>\n";
|
|
|
|
|
echo " <option value='dialplan'>".$text['option-dialplan']."</option>\n";
|
|
|
|
|
echo " <option value='caller_id_name'>".$text['option-caller_id_name']."</option>\n";
|
|
|
|
|
echo " <option value='caller_id_number'>".$text['option-caller_id_number']."</option>\n";
|
|
|
|
|
echo " <option value='ani'>".$text['option-ani']."</option>\n";
|
|
|
|
|
echo " <option value='ani2'>".$text['option-ani2']."</option>\n";
|
|
|
|
|
echo " <option value='uuid'>".$text['option-uuid']."</option>\n";
|
|
|
|
|
echo " <option value='source'>".$text['option-source']."</option>\n";
|
|
|
|
|
echo " <option value='chan_name'>".$text['option-chan_name']."</option>\n";
|
|
|
|
|
echo " <option value='network_addr'>".$text['option-network_addr']."</option>\n";
|
|
|
|
|
echo " <option value='\${number_alias}'>\${number_alias}</option>\n";
|
|
|
|
|
echo " <option value='\${sip_from_uri}'>\${sip_from_uri}</option>\n";
|
|
|
|
|
echo " <option value='\${sip_from_user}'>\${sip_from_user}</option>\n";
|
|
|
|
|
echo " <option value='\${sip_from_host}'>\${sip_from_host}</option>\n";
|
|
|
|
|
echo " <option value='\${sip_contact_uri}'>\${sip_contact_uri}</option>\n";
|
|
|
|
|
echo " <option value='\${sip_contact_user}'>\${sip_contact_user}</option>\n";
|
|
|
|
|
echo " <option value='\${sip_contact_host}'>\${sip_contact_host}</option>\n";
|
|
|
|
|
echo " <option value='\${sip_to_uri}'>\${sip_to_uri}</option>\n";
|
|
|
|
|
echo " <option value='\${sip_to_user}'>\${sip_to_user}</option>\n";
|
|
|
|
|
echo " <option value='\${sip_to_host}'>\${sip_to_host}</option>\n";
|
|
|
|
|
echo " </optgroup>\n";
|
|
|
|
|
//}
|
|
|
|
|
//if (strlen($dialplan_detail_tag) == 0 || $dialplan_detail_tag == "action" || $dialplan_detail_tag == "anti-action") {
|
|
|
|
|
echo " <optgroup label='".$text['optgroup-applications']."'>\n";
|
|
|
|
|
//get the list of applications
|
|
|
|
|
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
|
|
|
|
$result = event_socket_request($fp, 'api show application');
|
|
|
|
|
$tmp = explode("\n\n", $result);
|
|
|
|
|
$tmp = explode("\n", $tmp[0]);
|
|
|
|
|
foreach ($tmp as $row) {
|
|
|
|
|
if (strlen($row) > 0) {
|
|
|
|
|
$application = explode(",", $row);
|
|
|
|
|
if ($application[0] != "name" && stristr($application[0], "[") != true) {
|
|
|
|
|
echo " <option value='".$application[0]."'>".$application[0]."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
echo " </optgroup>\n";
|
|
|
|
|
//}
|
|
|
|
|
echo " </select>\n";
|
2014-08-03 09:02:12 +02:00
|
|
|
//echo " <input type='button' id='btn_select_to_input_dialplan_detail_type' class='btn' style='visibility:hidden;' name='' alt='".$text['button-back']."' onclick='change_to_input(document.getElementById(\"dialplan_detail_type\"));this.style.visibility = \"hidden\";' value='◁'>\n";
|
2014-01-11 00:58:42 +01:00
|
|
|
echo "</td>\n";
|
|
|
|
|
//data
|
2014-03-15 22:35:53 +01:00
|
|
|
echo "<td class='vtablerow' onclick=\"label_to_form('label_dialplan_detail_data_".$x."','dialplan_detail_data_".$x."');\" style='width: 100%;' nowrap='nowrap'>\n";
|
2014-01-11 23:55:54 +01:00
|
|
|
if ($element['hidden']) {
|
2014-06-29 08:39:40 +02:00
|
|
|
if ($dialplan_detail_type == 'bridge') {
|
|
|
|
|
// parse out gateway uuid
|
|
|
|
|
$bridge_statement = explode('/', $dialplan_detail_data);
|
|
|
|
|
if ($bridge_statement[0] == 'sofia' && $bridge_statement[1] == 'gateway') {
|
|
|
|
|
$gateway_uuid = $bridge_statement[2];
|
|
|
|
|
}
|
|
|
|
|
// retrieve gateway name from db
|
|
|
|
|
$sql = "select gateway from v_gateways where gateway_uuid = '".$gateway_uuid."' ";
|
|
|
|
|
$prep_statement = $db->prepare(check_sql($sql));
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
if (count($result) > 0) { $gateway_name = $result[0]['gateway']; }
|
|
|
|
|
unset ($prep_statement, $sql);
|
|
|
|
|
}
|
|
|
|
|
$dialplan_detail_data_mod = ($gateway_name != '') ? str_replace($gateway_uuid, $gateway_name, $dialplan_detail_data) : $dialplan_detail_data;
|
2014-08-04 21:33:26 +02:00
|
|
|
echo " <label id=\"label_dialplan_detail_data_".$x."\">".ellipsis($dialplan_detail_data_mod, 75, false)."</label>\n";
|
2014-01-11 23:55:54 +01:00
|
|
|
}
|
2014-03-15 22:35:53 +01:00
|
|
|
echo " <input id='dialplan_detail_data_".$x."' name='dialplan_details[".$x."][dialplan_detail_data]' class='formfld' type='text' style='width: 100%; ".$element['visibility']."' placeholder='' value=\"".htmlspecialchars($dialplan_detail_data)."\">\n";
|
2014-01-11 00:58:42 +01:00
|
|
|
echo "</td>\n";
|
|
|
|
|
//break
|
2014-03-15 22:35:53 +01:00
|
|
|
echo "<td class='vtablerow' onclick=\"label_to_form('label_dialplan_detail_break_".$x."','dialplan_detail_break_".$x."');\" nowrap='nowrap'>\n";
|
2014-01-11 23:55:54 +01:00
|
|
|
if ($element['hidden']) {
|
|
|
|
|
echo " <label id=\"label_dialplan_detail_break_".$x."\">".$dialplan_detail_break."</label>\n";
|
|
|
|
|
}
|
2014-03-15 22:35:53 +01:00
|
|
|
echo " <select id='dialplan_detail_break_".$x."' name='dialplan_details[".$x."][dialplan_detail_break]' class='formfld' style='width: auto; ".$element['visibility']."'>\n";
|
2014-01-11 00:58:42 +01:00
|
|
|
echo " <option></option>\n";
|
2014-03-15 22:35:53 +01:00
|
|
|
echo " <option value='on-true' ".($dialplan_detail_break == "on-true" ? $selected : null).">".$text['option-on_true']."</option>\n";
|
|
|
|
|
echo " <option value='on-false' ".($dialplan_detail_break == "on-false" ? $selected : null).">".$text['option-on_false']."</option>\n";
|
|
|
|
|
echo " <option value='always' ".($dialplan_detail_break == "always" ? $selected : null).">".$text['option-always']."</option>\n";
|
|
|
|
|
echo " <option value='never' ".($dialplan_detail_break == "never" ? $selected : null).">".$text['option-never']."</option>\n";
|
2014-01-11 00:58:42 +01:00
|
|
|
echo " </select>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
//inline
|
2014-03-15 22:35:53 +01:00
|
|
|
echo "<td class='vtablerow' style='text-align: center;' onclick=\"label_to_form('label_dialplan_detail_inline_".$x."','dialplan_detail_inline_".$x."');\" nowrap='nowrap'>\n";
|
2014-01-11 23:55:54 +01:00
|
|
|
if ($element['hidden']) {
|
|
|
|
|
echo " <label id=\"label_dialplan_detail_inline_".$x."\">".$dialplan_detail_inline."</label>\n";
|
|
|
|
|
}
|
2014-03-15 22:35:53 +01:00
|
|
|
echo " <select id='dialplan_detail_inline_".$x."' name='dialplan_details[".$x."][dialplan_detail_inline]' class='formfld' style='width: auto; ".$element['visibility']."'>\n";
|
2014-01-11 00:58:42 +01:00
|
|
|
echo " <option></option>\n";
|
2014-03-15 22:35:53 +01:00
|
|
|
echo " <option value='true' ".($dialplan_detail_inline == "true" ? $selected : null).">".$text['option-true']."</option>\n";
|
|
|
|
|
echo " <option value='false' ".($dialplan_detail_inline == "false" ? $selected : null).">".$text['option-false']."</option>\n";
|
2014-01-11 00:58:42 +01:00
|
|
|
echo " </select>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
//group
|
2014-03-15 22:35:53 +01:00
|
|
|
echo "<td class='vtablerow' style='text-align: center;' onclick=\"label_to_form('label_dialplan_detail_group_".$x."','dialplan_detail_group_".$x."');\" nowrap='nowrap'>\n";
|
2014-01-11 23:55:54 +01:00
|
|
|
if ($element['hidden']) {
|
|
|
|
|
echo " <label id=\"label_dialplan_detail_group_".$x."\">".$dialplan_detail_group."</label>\n";
|
|
|
|
|
}
|
2014-12-21 07:27:18 +01:00
|
|
|
echo " <input id='dialplan_detail_group_".$x."' name='dialplan_details[".$x."][dialplan_detail_group]' class='formfld' type='number' min='0' step='1' style='width: 30px; text-align: center; ".$element['visibility']."' placeholder='' value=\"".htmlspecialchars($dialplan_detail_group)."\" onclick='this.select();'>\n";
|
2014-01-11 23:55:54 +01:00
|
|
|
/*
|
|
|
|
|
echo " <select id='dialplan_detail_group_".$x."' name='dialplan_details[".$x."][dialplan_detail_group]' class='formfld' style='".$element['width']." ".$element['visibility']."'>\n";
|
2014-01-11 00:58:42 +01:00
|
|
|
echo " <option value=''></option>\n";
|
|
|
|
|
if (strlen($dialplan_detail_group)> 0) {
|
|
|
|
|
echo " <option $selected value='".htmlspecialchars($dialplan_detail_group)."'>".htmlspecialchars($dialplan_detail_group)."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
$i=0;
|
|
|
|
|
while($i<=999) {
|
|
|
|
|
echo " <option value='$i'>$i</option>\n";
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
echo " </select>\n";
|
2014-01-11 23:55:54 +01:00
|
|
|
*/
|
2014-01-11 00:58:42 +01:00
|
|
|
echo "</td>\n";
|
|
|
|
|
//order
|
2014-03-15 22:35:53 +01:00
|
|
|
echo "<td class='vtablerow' style='text-align: center;' onclick=\"label_to_form('label_dialplan_detail_order_".$x."','dialplan_detail_order_".$x."');\" nowrap='nowrap'>\n";
|
2014-01-11 23:55:54 +01:00
|
|
|
if ($element['hidden']) {
|
|
|
|
|
echo " <label id=\"label_dialplan_detail_order_".$x."\">".$dialplan_detail_order."</label>\n";
|
|
|
|
|
}
|
2014-12-21 07:27:18 +01:00
|
|
|
echo " <input id='dialplan_detail_order_".$x."' name='dialplan_details[".$x."][dialplan_detail_order]' class='formfld' type='number' min='1' step='1' style='width: 32px; text-align: center; ".$element['visibility']."' placeholder='' value=\"".htmlspecialchars($dialplan_detail_order)."\" onclick='this.select();'>\n";
|
2014-01-11 23:55:54 +01:00
|
|
|
/*
|
|
|
|
|
echo " <select id='dialplan_detail_order_".$x."' name='dialplan_details[".$x."][dialplan_detail_order]' class='formfld' style='".$element['width']." ".$element['visibility']."'>\n";
|
2014-01-11 00:58:42 +01:00
|
|
|
if (strlen($dialplan_detail_order)> 0) {
|
|
|
|
|
echo " <option $selected 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";
|
2014-01-11 23:55:54 +01:00
|
|
|
*/
|
2014-01-11 00:58:42 +01:00
|
|
|
echo "</td>\n";
|
|
|
|
|
//tools
|
2014-06-22 06:34:19 +02:00
|
|
|
echo " <td class='list_control_icon'>\n";
|
2014-01-11 23:55:54 +01:00
|
|
|
if ($element['hidden']) {
|
|
|
|
|
//echo " <a href='dialplan_detail_edit.php?id=".$dialplan_detail_uuid."&dialplan_uuid=".$dialplan_uuid."&app_uuid=".$app_uuid."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
|
2014-07-31 11:21:16 +02:00
|
|
|
echo " <a href='dialplan_detail_delete.php?id=".$dialplan_detail_uuid."&dialplan_uuid=".$dialplan_uuid.(($app_uuid != '') ? "&app_uuid=".$app_uuid : null)."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
2014-01-11 23:55:54 +01:00
|
|
|
}
|
2014-01-11 00:58:42 +01:00
|
|
|
echo " </td>\n";
|
|
|
|
|
//end the row
|
|
|
|
|
echo "</tr>\n";
|
2014-03-15 22:35:53 +01:00
|
|
|
if ($index != 999) {
|
|
|
|
|
echo "<tr><td colspan='7'><img src='about:blank;' style='width: 100%; height: 1px; border-bottom: 1px solid #e5e9f0;'></td></tr>";
|
|
|
|
|
}
|
2014-01-11 00:58:42 +01:00
|
|
|
//increment the value
|
|
|
|
|
$x++;
|
|
|
|
|
}
|
|
|
|
|
if ($c==0) { $c=1; } else { $c=0; }
|
|
|
|
|
$x++;
|
|
|
|
|
} //end foreach
|
|
|
|
|
unset($sql, $result, $row_count);
|
|
|
|
|
|
2014-03-15 22:35:53 +01:00
|
|
|
echo "</table>";
|
2014-01-11 00:58:42 +01:00
|
|
|
|
2014-03-15 22:35:53 +01:00
|
|
|
} //end if results
|
2014-01-11 00:58:42 +01:00
|
|
|
|
2014-03-15 22:35:53 +01:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>";
|
2014-01-11 00:58:42 +01:00
|
|
|
|
2014-03-15 22:35:53 +01:00
|
|
|
} //end if update
|
2014-01-11 00:58:42 +01:00
|
|
|
|
2014-03-17 19:56:33 +01:00
|
|
|
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\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";
|
2014-01-11 23:55:54 +01:00
|
|
|
}
|
2014-03-17 19:56:33 +01:00
|
|
|
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>";
|
2014-07-27 17:52:34 +02:00
|
|
|
echo "</table>";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
echo "</form>";
|
|
|
|
|
|
|
|
|
|
echo " </td>";
|
|
|
|
|
echo " </tr>";
|
|
|
|
|
echo "</table>";
|
|
|
|
|
echo "</div>";
|
2014-07-23 22:47:00 +02:00
|
|
|
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
|
|
|
|
|
echo "<p>".$text['billing-warning']."</p>";
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
//show the footer
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2014-01-21 05:22:10 +01:00
|
|
|
?>
|