2012-09-14 22:50:34 +02:00
|
|
|
<?php
|
2012-09-15 01:22:46 +02:00
|
|
|
/*
|
|
|
|
|
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>
|
2016-06-11 17:49:22 +02:00
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2016
|
2012-09-15 01:22:46 +02:00
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
2016-06-11 23:23:49 +02:00
|
|
|
Lewis Hallam <lewishallam80@gmail.com>
|
2012-09-15 01:22:46 +02:00
|
|
|
*/
|
2016-08-13 22:18:03 +02:00
|
|
|
|
|
|
|
|
//includes
|
|
|
|
|
require_once "root.php";
|
|
|
|
|
require_once "resources/require.php";
|
|
|
|
|
require_once "resources/check_auth.php";
|
|
|
|
|
|
|
|
|
|
//check permissions
|
|
|
|
|
if (permission_exists('call_flow_add') || permission_exists('call_flow_edit')) {
|
|
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
2012-09-14 22:50:34 +02:00
|
|
|
|
2013-05-14 17:09:15 +02:00
|
|
|
//add multi-lingual support
|
2015-01-18 11:33:34 +01:00
|
|
|
$language = new text;
|
|
|
|
|
$text = $language->get();
|
2013-05-14 17:09:15 +02:00
|
|
|
|
2012-09-14 22:50:34 +02:00
|
|
|
//action add or update
|
|
|
|
|
if (isset($_REQUEST["id"])) {
|
|
|
|
|
$action = "update";
|
|
|
|
|
$call_flow_uuid = check_str($_REQUEST["id"]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$action = "add";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//get http post variables and set them to php variables
|
2014-05-24 16:15:18 +02:00
|
|
|
if (count($_POST) > 0) {
|
2012-09-14 23:57:22 +02:00
|
|
|
//set the variables from the http values
|
2012-09-15 00:45:26 +02:00
|
|
|
$call_flow_name = check_str($_POST["call_flow_name"]);
|
2012-09-14 23:57:22 +02:00
|
|
|
$call_flow_extension = check_str($_POST["call_flow_extension"]);
|
|
|
|
|
$call_flow_feature_code = check_str($_POST["call_flow_feature_code"]);
|
2012-09-15 01:22:46 +02:00
|
|
|
$call_flow_context = check_str($_POST["call_flow_context"]);
|
2012-09-14 23:57:22 +02:00
|
|
|
$call_flow_status = check_str($_POST["call_flow_status"]);
|
|
|
|
|
$call_flow_pin_number = check_str($_POST["call_flow_pin_number"]);
|
2012-09-20 09:16:08 +02:00
|
|
|
$call_flow_label = check_str($_POST["call_flow_label"]);
|
2016-06-11 17:06:12 +02:00
|
|
|
$call_flow_sound = check_str($_POST["call_flow_sound"]);
|
2012-09-14 23:57:22 +02:00
|
|
|
$call_flow_destination = check_str($_POST["call_flow_destination"]);
|
2016-06-11 17:06:12 +02:00
|
|
|
$call_flow_alternate_label = check_str($_POST["call_flow_alternate_label"]);
|
2016-06-11 17:49:22 +02:00
|
|
|
$call_flow_alternate_sound = check_str($_POST["call_flow_alternate_sound"]);
|
2012-09-14 23:57:22 +02:00
|
|
|
$call_flow_alternate_destination = check_str($_POST["call_flow_alternate_destination"]);
|
|
|
|
|
$call_flow_description = check_str($_POST["call_flow_description"]);
|
2012-09-17 20:38:11 +02:00
|
|
|
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
|
2012-09-14 23:57:22 +02:00
|
|
|
|
|
|
|
|
//seperate the action and the param
|
|
|
|
|
$destination_array = explode(":", $call_flow_destination);
|
|
|
|
|
$call_flow_app = array_shift($destination_array);
|
|
|
|
|
$call_flow_data = join(':', $destination_array);
|
|
|
|
|
|
2016-06-11 17:06:12 +02:00
|
|
|
//seperate the action and the param call_flow_alternate_app
|
2012-09-14 23:57:22 +02:00
|
|
|
$alternate_destination_array = explode(":", $call_flow_alternate_destination);
|
2016-06-11 17:06:12 +02:00
|
|
|
$call_flow_alternate_app = array_shift($alternate_destination_array);
|
|
|
|
|
$call_flow_alternate_data = join(':', $alternate_destination_array);
|
2012-09-17 20:38:11 +02:00
|
|
|
|
|
|
|
|
//set the context for users that are not in the superadmin group
|
|
|
|
|
if (!if_group("superadmin")) {
|
2015-03-22 04:33:37 +01:00
|
|
|
$call_flow_context = $_SESSION['domain_name'];
|
2012-09-17 20:38:11 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-14 22:50:34 +02:00
|
|
|
}
|
|
|
|
|
|
2014-05-24 16:15:18 +02:00
|
|
|
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
2012-09-14 22:50:34 +02:00
|
|
|
|
|
|
|
|
$msg = '';
|
|
|
|
|
if ($action == "update") {
|
|
|
|
|
$call_flow_uuid = check_str($_POST["call_flow_uuid"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//check for all required data
|
2013-05-14 17:09:15 +02:00
|
|
|
if (strlen($call_flow_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
|
|
|
|
|
if (strlen($call_flow_extension) == 0) { $msg .= $text['message-required'].$text['label-extension']."<br>\n"; }
|
|
|
|
|
//if (strlen($call_flow_feature_code) == 0) { $msg .= $text['message-required'].$text['label-feature_code']."<br>\n"; }
|
|
|
|
|
if (strlen($call_flow_context) == 0) { $msg .= $text['message-required'].$text['label-context']."<br>\n"; }
|
|
|
|
|
//if (strlen($call_flow_status) == 0) { $msg .= $text['message-required'].$text['label-status']."<br>\n"; }
|
|
|
|
|
//if (strlen($call_flow_pin_number) == 0) { $msg .= $text['message-required'].$text['label-pin_number']."<br>\n"; }
|
|
|
|
|
//if (strlen($call_flow_status) == 0) { $msg .= $text['message-required'].$text['label-status']."<br>\n"; }
|
|
|
|
|
//if (strlen($call_flow_label) == 0) { $msg .= $text['message-required'].$text['label-destination_label']."<br>\n"; }
|
|
|
|
|
//if (strlen($call_flow_app) == 0) { $msg .= $text['message-required'].$text['label-destination']."<br>\n"; }
|
|
|
|
|
//if (strlen($call_flow_data) == 0) { $msg .= $text['message-required'].$text['label-destination']."<br>\n"; }
|
2016-06-11 17:06:12 +02:00
|
|
|
//if (strlen($call_flow_alternate_label) == 0) { $msg .= $text['message-required'].$text['label-alternate_label']."<br>\n"; }
|
|
|
|
|
//if (strlen($call_flow_alternate_app) == 0) { $msg .= $text['message-required'].$text['label-alternate_destination']."<br>\n"; }
|
|
|
|
|
//if (strlen($call_flow_alternate_data) == 0) { $msg .= $text['message-required'].$text['label-alternate_destination']."<br>\n"; }
|
2013-05-14 17:09:15 +02:00
|
|
|
//if (strlen($call_flow_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
|
2012-09-14 22:50:34 +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-09-14 22:50:34 +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-09-14 22:50:34 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//add or update the database
|
|
|
|
|
if ($_POST["persistformvar"] != "true") {
|
|
|
|
|
if ($action == "add" && permission_exists('call_flow_add')) {
|
2012-09-15 00:45:26 +02:00
|
|
|
//prepare the uuids
|
|
|
|
|
$call_flow_uuid = uuid();
|
|
|
|
|
$dialplan_uuid = uuid();
|
|
|
|
|
//add the call flow
|
|
|
|
|
$sql = "insert into v_call_flows ";
|
|
|
|
|
$sql .= "(";
|
|
|
|
|
$sql .= "domain_uuid, ";
|
|
|
|
|
$sql .= "call_flow_uuid, ";
|
|
|
|
|
$sql .= "dialplan_uuid, ";
|
|
|
|
|
$sql .= "call_flow_name, ";
|
|
|
|
|
$sql .= "call_flow_extension, ";
|
|
|
|
|
$sql .= "call_flow_feature_code, ";
|
2012-09-15 01:22:46 +02:00
|
|
|
$sql .= "call_flow_context, ";
|
2012-09-15 00:45:26 +02:00
|
|
|
$sql .= "call_flow_status, ";
|
|
|
|
|
$sql .= "call_flow_pin_number, ";
|
2012-09-20 09:16:08 +02:00
|
|
|
$sql .= "call_flow_label, ";
|
2016-06-11 17:29:56 +02:00
|
|
|
$sql .= "call_flow_sound, ";
|
2012-09-20 09:16:08 +02:00
|
|
|
$sql .= "call_flow_app, ";
|
2012-09-15 00:45:26 +02:00
|
|
|
$sql .= "call_flow_data, ";
|
2016-06-11 17:06:12 +02:00
|
|
|
$sql .= "call_flow_alternate_label, ";
|
2016-06-11 17:29:56 +02:00
|
|
|
$sql .= "call_flow_alternate_sound, ";
|
2016-06-11 17:06:12 +02:00
|
|
|
$sql .= "call_flow_alternate_app, ";
|
|
|
|
|
$sql .= "call_flow_alternate_data, ";
|
2016-06-11 17:29:56 +02:00
|
|
|
$sql .= "call_flow_description ";
|
2012-09-15 00:45:26 +02:00
|
|
|
$sql .= ")";
|
|
|
|
|
$sql .= "values ";
|
|
|
|
|
$sql .= "(";
|
|
|
|
|
$sql .= "'$domain_uuid', ";
|
|
|
|
|
$sql .= "'".$call_flow_uuid."', ";
|
|
|
|
|
$sql .= "'".$dialplan_uuid."', ";
|
|
|
|
|
$sql .= "'$call_flow_name', ";
|
|
|
|
|
$sql .= "'$call_flow_extension', ";
|
|
|
|
|
$sql .= "'$call_flow_feature_code', ";
|
2012-09-15 01:22:46 +02:00
|
|
|
$sql .= "'$call_flow_context', ";
|
2012-09-15 00:45:26 +02:00
|
|
|
$sql .= "'$call_flow_status', ";
|
|
|
|
|
$sql .= "'$call_flow_pin_number', ";
|
2012-09-20 09:16:08 +02:00
|
|
|
$sql .= "'$call_flow_label', ";
|
2016-06-11 17:29:56 +02:00
|
|
|
$sql .= "'$call_flow_sound', ";
|
2012-09-20 09:16:08 +02:00
|
|
|
$sql .= "'$call_flow_app', ";
|
2012-09-15 00:45:26 +02:00
|
|
|
$sql .= "'$call_flow_data', ";
|
2016-06-11 17:06:12 +02:00
|
|
|
$sql .= "'$call_flow_alternate_label', ";
|
2016-06-11 17:49:22 +02:00
|
|
|
$sql .= "'$call_flow_alternate_sound', ";
|
2016-06-11 17:06:12 +02:00
|
|
|
$sql .= "'$call_flow_alternate_app', ";
|
|
|
|
|
$sql .= "'$call_flow_alternate_data', ";
|
2016-06-11 17:29:56 +02:00
|
|
|
$sql .= "'$call_flow_description' ";
|
2012-09-15 00:45:26 +02:00
|
|
|
$sql .= ")";
|
|
|
|
|
$db->exec(check_sql($sql));
|
|
|
|
|
unset($sql);
|
2012-09-14 22:50:34 +02:00
|
|
|
} //if ($action == "add")
|
|
|
|
|
|
|
|
|
|
if ($action == "update" && permission_exists('call_flow_edit')) {
|
2012-09-15 00:45:26 +02:00
|
|
|
//prepare the uuids
|
|
|
|
|
if (strlen($dialplan_uuid) == 0) {
|
|
|
|
|
$dialplan_uuid = uuid();
|
|
|
|
|
}
|
|
|
|
|
//add the call flow
|
|
|
|
|
$sql = "update v_call_flows set ";
|
|
|
|
|
$sql .= "dialplan_uuid = '$dialplan_uuid', ";
|
|
|
|
|
$sql .= "call_flow_name = '$call_flow_name', ";
|
|
|
|
|
$sql .= "call_flow_extension = '$call_flow_extension', ";
|
|
|
|
|
$sql .= "call_flow_feature_code = '$call_flow_feature_code', ";
|
2012-09-15 01:22:46 +02:00
|
|
|
$sql .= "call_flow_context = '$call_flow_context', ";
|
2012-09-15 00:45:26 +02:00
|
|
|
$sql .= "call_flow_status = '$call_flow_status', ";
|
|
|
|
|
$sql .= "call_flow_pin_number = '$call_flow_pin_number', ";
|
2012-09-20 09:16:08 +02:00
|
|
|
$sql .= "call_flow_label = '$call_flow_label', ";
|
2016-06-11 17:29:56 +02:00
|
|
|
$sql .= "call_flow_sound = '$call_flow_sound', ";
|
2012-09-15 00:45:26 +02:00
|
|
|
$sql .= "call_flow_app = '$call_flow_app', ";
|
|
|
|
|
$sql .= "call_flow_data = '$call_flow_data', ";
|
2016-06-11 17:06:12 +02:00
|
|
|
$sql .= "call_flow_alternate_label = '$call_flow_alternate_label', ";
|
2016-06-11 17:29:56 +02:00
|
|
|
$sql .= "call_flow_alternate_sound = '$call_flow_alternate_sound', ";
|
2016-06-11 17:06:12 +02:00
|
|
|
$sql .= "call_flow_alternate_app = '$call_flow_alternate_app', ";
|
|
|
|
|
$sql .= "call_flow_alternate_data = '$call_flow_alternate_data', ";
|
2016-06-11 17:29:56 +02:00
|
|
|
$sql .= "call_flow_description = '$call_flow_description' ";
|
2012-09-15 00:45:26 +02:00
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
|
|
|
|
$sql .= "and call_flow_uuid = '$call_flow_uuid'";
|
|
|
|
|
$db->exec(check_sql($sql));
|
|
|
|
|
unset($sql);
|
2012-09-14 22:50:34 +02:00
|
|
|
} //if ($action == "update")
|
2012-09-15 00:45:26 +02:00
|
|
|
|
|
|
|
|
if ($action == "add" || $action == "update") {
|
2012-09-17 20:38:11 +02:00
|
|
|
|
2012-09-20 11:05:12 +02:00
|
|
|
//delete the dialplan
|
2012-09-20 10:58:04 +02:00
|
|
|
$sql = "delete from v_dialplans ";
|
2012-09-15 00:45:26 +02:00
|
|
|
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
|
|
|
|
$sql .= "and dialplan_uuid = '".$dialplan_uuid."' ";
|
2012-09-20 10:58:04 +02:00
|
|
|
$db->query(check_sql($sql));
|
|
|
|
|
|
2012-09-20 11:05:12 +02:00
|
|
|
//delete the dialplan details
|
|
|
|
|
$sql = "delete from v_dialplan_details ";
|
|
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
|
|
|
|
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
|
|
|
|
$db->query($sql);
|
|
|
|
|
unset($sql);
|
|
|
|
|
|
2012-09-20 10:58:04 +02:00
|
|
|
//add the dialplan entry
|
|
|
|
|
$dialplan_name = $call_flow_name;
|
|
|
|
|
$dialplan_order ='333';
|
|
|
|
|
$dialplan_context = $call_flow_context;
|
|
|
|
|
$dialplan_enabled = 'true';
|
|
|
|
|
$dialplan_description = $call_flow_description;
|
|
|
|
|
$app_uuid = 'b1b70f85-6b42-429b-8c5a-60c8b02b7d14';
|
|
|
|
|
dialplan_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_name, $dialplan_order, $dialplan_context, $dialplan_enabled, $dialplan_description, $app_uuid);
|
|
|
|
|
|
|
|
|
|
//<condition destination_number="300" break="on-true"/>
|
|
|
|
|
$dialplan = new dialplan;
|
|
|
|
|
$dialplan->domain_uuid = $domain_uuid;
|
|
|
|
|
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
|
|
|
$dialplan->dialplan_detail_tag = 'condition'; //condition, action, antiaction
|
|
|
|
|
$dialplan->dialplan_detail_type = 'destination_number';
|
2016-06-24 18:32:19 +02:00
|
|
|
$dialplan->dialplan_detail_data = '^'.str_replace('+', '\+', str_replace('*', '\*', $call_flow_feature_code)).'$';
|
2012-09-20 10:58:04 +02:00
|
|
|
$dialplan->dialplan_detail_break = 'on-true';
|
|
|
|
|
//$dialplan->dialplan_detail_inline = '';
|
|
|
|
|
$dialplan->dialplan_detail_group = '1';
|
|
|
|
|
$dialplan->dialplan_detail_order = '000';
|
|
|
|
|
$dialplan->dialplan_detail_add();
|
|
|
|
|
unset($dialplan);
|
|
|
|
|
|
|
|
|
|
//<action application="set" data="call_flow_uuid="/>
|
|
|
|
|
$dialplan = new dialplan;
|
|
|
|
|
$dialplan->domain_uuid = $domain_uuid;
|
|
|
|
|
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
|
|
|
$dialplan->dialplan_detail_tag = 'action'; //condition, action, antiaction
|
|
|
|
|
$dialplan->dialplan_detail_type = 'set';
|
|
|
|
|
$dialplan->dialplan_detail_data = 'call_flow_uuid='.$call_flow_uuid;
|
|
|
|
|
//$dialplan->dialplan_detail_break = '';
|
|
|
|
|
//$dialplan->dialplan_detail_inline = '';
|
|
|
|
|
$dialplan->dialplan_detail_group = '1';
|
|
|
|
|
$dialplan->dialplan_detail_order = '010';
|
|
|
|
|
$dialplan->dialplan_detail_add();
|
|
|
|
|
unset($dialplan);
|
|
|
|
|
|
|
|
|
|
//<action application="set" data="feature_code=true"/>
|
|
|
|
|
$dialplan = new dialplan;
|
|
|
|
|
$dialplan->domain_uuid = $domain_uuid;
|
|
|
|
|
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
|
|
|
$dialplan->dialplan_detail_tag = 'action'; //condition, action, antiaction
|
|
|
|
|
$dialplan->dialplan_detail_type = 'set';
|
|
|
|
|
$dialplan->dialplan_detail_data = 'feature_code=true';
|
|
|
|
|
//$dialplan->dialplan_detail_break = '';
|
|
|
|
|
//$dialplan->dialplan_detail_inline = '';
|
|
|
|
|
$dialplan->dialplan_detail_group = '1';
|
|
|
|
|
$dialplan->dialplan_detail_order = '020';
|
|
|
|
|
$dialplan->dialplan_detail_add();
|
|
|
|
|
unset($dialplan);
|
|
|
|
|
|
|
|
|
|
//<action application="lua" data="call_flow.lua"/>
|
|
|
|
|
$dialplan = new dialplan;
|
|
|
|
|
$dialplan->domain_uuid = $domain_uuid;
|
|
|
|
|
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
|
|
|
$dialplan->dialplan_detail_tag = 'action'; //condition, action, antiaction
|
|
|
|
|
$dialplan->dialplan_detail_type = 'lua';
|
|
|
|
|
$dialplan->dialplan_detail_data = 'call_flow.lua';
|
|
|
|
|
//$dialplan->dialplan_detail_break = '';
|
|
|
|
|
//$dialplan->dialplan_detail_inline = '';
|
|
|
|
|
$dialplan->dialplan_detail_group = '1';
|
|
|
|
|
$dialplan->dialplan_detail_order = '030';
|
|
|
|
|
$dialplan->dialplan_detail_add();
|
|
|
|
|
unset($dialplan);
|
|
|
|
|
|
|
|
|
|
//dialplan group 2
|
|
|
|
|
//<condition destination_number="301"/>
|
|
|
|
|
$dialplan = new dialplan;
|
|
|
|
|
$dialplan->domain_uuid = $domain_uuid;
|
|
|
|
|
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
|
|
|
$dialplan->dialplan_detail_tag = 'condition'; //condition, action, antiaction
|
|
|
|
|
$dialplan->dialplan_detail_type = 'destination_number';
|
2016-06-24 18:32:19 +02:00
|
|
|
$dialplan->dialplan_detail_data = '^'.str_replace('+', '\+', str_replace('*', '\*', $call_flow_extension)).'$';
|
2012-09-20 10:58:04 +02:00
|
|
|
//$dialplan->dialplan_detail_break = '';
|
|
|
|
|
//$dialplan->dialplan_detail_inline = '';
|
|
|
|
|
$dialplan->dialplan_detail_group = '2';
|
|
|
|
|
$dialplan->dialplan_detail_order = '000';
|
|
|
|
|
$dialplan->dialplan_detail_add();
|
|
|
|
|
unset($dialplan);
|
|
|
|
|
|
|
|
|
|
//<action application="set" data="call_flow_uuid="/>
|
|
|
|
|
$dialplan = new dialplan;
|
|
|
|
|
$dialplan->domain_uuid = $domain_uuid;
|
|
|
|
|
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
|
|
|
$dialplan->dialplan_detail_tag = 'action'; //condition, action, antiaction
|
|
|
|
|
$dialplan->dialplan_detail_type = 'set';
|
|
|
|
|
$dialplan->dialplan_detail_data = 'call_flow_uuid='.$call_flow_uuid;
|
|
|
|
|
//$dialplan->dialplan_detail_break = '';
|
|
|
|
|
//$dialplan->dialplan_detail_inline = '';
|
|
|
|
|
$dialplan->dialplan_detail_group = '2';
|
|
|
|
|
$dialplan->dialplan_detail_order = '010';
|
|
|
|
|
$dialplan->dialplan_detail_add();
|
|
|
|
|
unset($dialplan);
|
|
|
|
|
|
|
|
|
|
//<action application="set" data="ringback=${us-ring}"/>
|
|
|
|
|
//$dialplan = new dialplan;
|
|
|
|
|
//$dialplan->domain_uuid = $domain_uuid;
|
|
|
|
|
//$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
|
|
|
//$dialplan->dialplan_detail_tag = 'action'; //condition, action, antiaction
|
|
|
|
|
//$dialplan->dialplan_detail_type = 'set';
|
|
|
|
|
//$dialplan->dialplan_detail_data = 'ringback=${us-ring}';
|
|
|
|
|
//$dialplan->dialplan_detail_break = '';
|
|
|
|
|
//$dialplan->dialplan_detail_inline = '';
|
|
|
|
|
//$dialplan->dialplan_detail_group = '2';
|
|
|
|
|
//$dialplan->dialplan_detail_order = '020';
|
|
|
|
|
//$dialplan->dialplan_detail_add();
|
|
|
|
|
//unset($dialplan);
|
|
|
|
|
|
|
|
|
|
//<action application="lua" data="call_flow.lua"/>
|
|
|
|
|
$dialplan = new dialplan;
|
|
|
|
|
$dialplan->domain_uuid = $domain_uuid;
|
|
|
|
|
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
|
|
|
$dialplan->dialplan_detail_tag = 'action'; //condition, action, antiaction
|
|
|
|
|
$dialplan->dialplan_detail_type = 'lua';
|
|
|
|
|
//$dialplan->dialplan_detail_data = $call_flow_extension . ' LUA call_flow.lua';
|
|
|
|
|
$dialplan->dialplan_detail_data = 'call_flow.lua';
|
|
|
|
|
//$dialplan->dialplan_detail_break = '';
|
|
|
|
|
//$dialplan->dialplan_detail_inline = '';
|
|
|
|
|
$dialplan->dialplan_detail_group = '2';
|
|
|
|
|
$dialplan->dialplan_detail_order = '030';
|
|
|
|
|
$dialplan->dialplan_detail_add();
|
|
|
|
|
unset($dialplan);
|
|
|
|
|
|
|
|
|
|
//save the xml
|
|
|
|
|
save_dialplan_xml();
|
|
|
|
|
|
|
|
|
|
//apply settings reminder
|
|
|
|
|
$_SESSION["reload_xml"] = true;
|
2012-09-17 20:38:11 +02:00
|
|
|
|
2015-01-16 01:21:02 +01:00
|
|
|
//clear the cache
|
|
|
|
|
$cache = new cache;
|
2015-08-24 08:34:33 +02:00
|
|
|
$cache->delete("dialplan:".$call_flow_context);
|
2013-01-16 01:26:48 +01:00
|
|
|
|
2014-05-24 16:15:18 +02:00
|
|
|
//set the message
|
|
|
|
|
if ($action == "add") {
|
|
|
|
|
$_SESSION["message"] = $text['message-add'];
|
|
|
|
|
}
|
|
|
|
|
if ($action == "update") {
|
|
|
|
|
$_SESSION["message"] = $text['message-update'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//redirect the browser
|
|
|
|
|
header("Location: call_flows.php");
|
|
|
|
|
return;
|
2012-09-15 00:45:26 +02:00
|
|
|
}
|
2013-05-14 17:09:15 +02:00
|
|
|
} //if ($_POST["persistformvar"] != "true")
|
2014-05-24 16:15:18 +02:00
|
|
|
} //(count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0)
|
2012-09-14 22:50:34 +02:00
|
|
|
|
2015-08-07 21:10:24 +02:00
|
|
|
//initialize the destinations object
|
|
|
|
|
$destination = new destinations;
|
|
|
|
|
|
2012-09-14 22:50:34 +02:00
|
|
|
//pre-populate the form
|
2014-05-24 16:15:18 +02:00
|
|
|
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
|
2012-09-14 22:50:34 +02:00
|
|
|
$call_flow_uuid = check_str($_GET["id"]);
|
|
|
|
|
$sql = "select * from v_call_flows ";
|
|
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
|
|
|
|
$sql .= "and call_flow_uuid = '$call_flow_uuid' ";
|
|
|
|
|
$prep_statement = $db->prepare(check_sql($sql));
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
$result = $prep_statement->fetchAll();
|
|
|
|
|
foreach ($result as &$row) {
|
2012-09-14 23:57:22 +02:00
|
|
|
//set the php variables
|
2012-09-15 00:45:26 +02:00
|
|
|
$call_flow_name = $row["call_flow_name"];
|
2012-09-14 23:57:22 +02:00
|
|
|
$call_flow_extension = $row["call_flow_extension"];
|
|
|
|
|
$call_flow_feature_code = $row["call_flow_feature_code"];
|
2012-09-15 01:22:46 +02:00
|
|
|
$call_flow_context = $row["call_flow_context"];
|
2012-09-14 23:57:22 +02:00
|
|
|
$call_flow_status = $row["call_flow_status"];
|
2012-09-20 09:16:08 +02:00
|
|
|
$call_flow_label = $row["call_flow_label"];
|
2016-06-11 17:29:56 +02:00
|
|
|
$call_flow_sound = $row["call_flow_sound"];
|
2012-09-14 23:57:22 +02:00
|
|
|
$call_flow_app = $row["call_flow_app"];
|
|
|
|
|
$call_flow_pin_number = $row["call_flow_pin_number"];
|
|
|
|
|
$call_flow_data = $row["call_flow_data"];
|
2016-06-11 17:06:12 +02:00
|
|
|
$call_flow_alternate_label = $row["call_flow_alternate_label"];
|
2016-06-11 17:49:22 +02:00
|
|
|
$call_flow_alternate_sound = $row["call_flow_alternate_sound"];
|
2016-06-11 17:06:12 +02:00
|
|
|
$call_flow_alternate_app = $row["call_flow_alternate_app"];
|
|
|
|
|
$call_flow_alternate_data = $row["call_flow_alternate_data"];
|
2012-09-14 23:57:22 +02:00
|
|
|
$call_flow_description = $row["call_flow_description"];
|
2012-09-17 20:38:11 +02:00
|
|
|
$dialplan_uuid = $row["dialplan_uuid"];
|
2012-09-14 23:57:22 +02:00
|
|
|
|
|
|
|
|
//if superadmin show both the app and data
|
|
|
|
|
if (if_group("superadmin")) {
|
|
|
|
|
$destination_label = $call_flow_app.':'.$call_flow_data;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$destination_label = $call_flow_data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//if superadmin show both the app and data
|
|
|
|
|
if (if_group("superadmin")) {
|
2016-06-11 17:06:12 +02:00
|
|
|
$alternate_destination_label = $call_flow_alternate_app.':'.$call_flow_alternate_data;
|
2012-09-14 23:57:22 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2016-06-11 17:06:12 +02:00
|
|
|
$alternate_destination_label = $call_flow_alternate_data;
|
2012-09-14 23:57:22 +02:00
|
|
|
}
|
2012-09-14 22:50:34 +02:00
|
|
|
}
|
|
|
|
|
unset ($prep_statement);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-15 01:22:46 +02:00
|
|
|
//set the context for users that are not in the superadmin group
|
|
|
|
|
if (strlen($call_flow_context) == 0) {
|
2015-03-22 04:33:37 +01:00
|
|
|
$call_flow_context = $_SESSION['domain_name'];
|
2012-09-15 01:22:46 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-14 22:50:34 +02:00
|
|
|
//show the header
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/header.php";
|
2013-05-14 17:09:15 +02:00
|
|
|
if ($action == "update") {
|
2014-07-10 02:32:50 +02:00
|
|
|
$document['title'] = $text['title-call_flow-edit'];
|
2013-05-14 17:09:15 +02:00
|
|
|
}
|
|
|
|
|
if ($action == "add") {
|
2014-07-10 02:32:50 +02:00
|
|
|
$document['title'] = $text['title-call_flow-add'];
|
2013-05-14 17:09:15 +02:00
|
|
|
}
|
2012-09-14 22:50:34 +02:00
|
|
|
|
2016-06-11 15:33:16 +02:00
|
|
|
//get the recordings
|
|
|
|
|
$sql = "select recording_name, recording_filename from v_recordings ";
|
|
|
|
|
$sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' ";
|
|
|
|
|
$sql .= "order by recording_name asc ";
|
|
|
|
|
$prep_statement = $db->prepare(check_sql($sql));
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
$recordings = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
|
|
|
|
|
|
if (if_group("superadmin")) {
|
|
|
|
|
echo "<script>\n";
|
|
|
|
|
echo "var Objs;\n";
|
|
|
|
|
echo "\n";
|
|
|
|
|
echo "function changeToInput(obj){\n";
|
|
|
|
|
echo " tb=document.createElement('INPUT');\n";
|
|
|
|
|
echo " tb.type='text';\n";
|
|
|
|
|
echo " tb.name=obj.name;\n";
|
|
|
|
|
echo " tb.setAttribute('class', 'formfld');\n";
|
2016-08-05 01:48:59 +02:00
|
|
|
//echo " tb.setAttribute('style', 'width: 380px;');\n";
|
2016-06-11 15:33:16 +02:00
|
|
|
echo " tb.value=obj.options[obj.selectedIndex].value;\n";
|
|
|
|
|
echo " tbb=document.createElement('INPUT');\n";
|
|
|
|
|
echo " tbb.setAttribute('class', 'btn');\n";
|
|
|
|
|
echo " tbb.setAttribute('style', 'margin-left: 4px;');\n";
|
|
|
|
|
echo " tbb.type='button';\n";
|
|
|
|
|
echo " tbb.value=$('<div />').html('◁').text();\n";
|
|
|
|
|
echo " tbb.objs=[obj,tb,tbb];\n";
|
|
|
|
|
echo " tbb.onclick=function(){ Replace(this.objs); }\n";
|
|
|
|
|
echo " obj.parentNode.insertBefore(tb,obj);\n";
|
|
|
|
|
echo " obj.parentNode.insertBefore(tbb,obj);\n";
|
|
|
|
|
echo " obj.parentNode.removeChild(obj);\n";
|
|
|
|
|
echo "}\n";
|
|
|
|
|
echo "\n";
|
|
|
|
|
echo "function Replace(obj){\n";
|
|
|
|
|
echo " obj[2].parentNode.insertBefore(obj[0],obj[2]);\n";
|
|
|
|
|
echo " obj[0].parentNode.removeChild(obj[1]);\n";
|
|
|
|
|
echo " obj[0].parentNode.removeChild(obj[2]);\n";
|
|
|
|
|
echo "}\n";
|
|
|
|
|
echo "</script>\n";
|
|
|
|
|
echo "\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function sound_select_list($var, $name, $description_name, $load_sound=false) {
|
|
|
|
|
global $text, $recordings, $db;
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
|
|
|
|
echo " ".$text['label-' . $description_name]."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
|
2016-08-05 01:48:59 +02:00
|
|
|
echo "<select name='$name' class='formfld' ".((if_group("superadmin")) ? "onchange='changeToInput(this);'" : null).">\n";
|
2016-06-11 15:33:16 +02:00
|
|
|
echo " <option value=''></option>\n";
|
|
|
|
|
//misc optgroup
|
|
|
|
|
if (if_group("superadmin")) {
|
2016-06-11 23:23:49 +02:00
|
|
|
echo "<optgroup label=".$text['miscellaneous'].">\n";
|
2016-06-11 15:33:16 +02:00
|
|
|
echo " <option value='say:'>say:</option>\n";
|
|
|
|
|
echo " <option value='tone_stream:'>tone_stream:</option>\n";
|
|
|
|
|
echo "</optgroup>\n";
|
|
|
|
|
}
|
|
|
|
|
//recordings
|
|
|
|
|
$tmp_selected = false;
|
|
|
|
|
if (count($recordings) > 0) {
|
2016-06-11 23:23:49 +02:00
|
|
|
echo "<optgroup label=".$text['recordings'].">\n";
|
2016-06-11 15:33:16 +02:00
|
|
|
foreach ($recordings as &$row) {
|
|
|
|
|
$recording_name = $row["recording_name"];
|
|
|
|
|
$recording_filename = $row["recording_filename"];
|
|
|
|
|
if ($var == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($var) > 0) {
|
|
|
|
|
$tmp_selected = true;
|
|
|
|
|
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename."' selected='selected'>".$recording_name."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else if ($var == $recording_filename && strlen($var) > 0) {
|
|
|
|
|
$tmp_selected = true;
|
|
|
|
|
echo " <option value='".$recording_filename."' selected='selected'>".$recording_name."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='".$recording_filename."'>".$recording_name."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
echo "</optgroup>\n";
|
|
|
|
|
}
|
|
|
|
|
//phrases
|
|
|
|
|
$sql = "select * from v_phrases where domain_uuid = '".$domain_uuid."' ";
|
|
|
|
|
$prep_statement = $db->prepare(check_sql($sql));
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
if (count($result) > 0) {
|
|
|
|
|
echo "<optgroup label='Phrases'>\n";
|
|
|
|
|
foreach ($result as &$row) {
|
|
|
|
|
if ($var == "phrase:".$row["phrase_uuid"]) {
|
|
|
|
|
$tmp_selected = true;
|
|
|
|
|
echo " <option value='phrase:".$row["phrase_uuid"]."' selected='selected'>".$row["phrase_name"]."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='phrase:".$row["phrase_uuid"]."'>".$row["phrase_name"]."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
unset ($prep_statement);
|
|
|
|
|
echo "</optgroup>\n";
|
|
|
|
|
}
|
|
|
|
|
//sounds
|
2016-06-11 17:49:22 +02:00
|
|
|
if ($load_sound) {
|
2016-08-13 22:10:57 +02:00
|
|
|
$file = new file;
|
|
|
|
|
$sound_files = $file->sounds();
|
|
|
|
|
if (is_array($sound_files)) {
|
2016-06-11 23:23:49 +02:00
|
|
|
echo "<optgroup label=".$text["sounds"].">\n";
|
2016-08-13 22:10:57 +02:00
|
|
|
foreach ($sound_files as $value) {
|
2016-06-11 15:33:16 +02:00
|
|
|
if (strlen($value) > 0) {
|
|
|
|
|
if (substr($var, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") {
|
|
|
|
|
$var = substr($var, 71);
|
|
|
|
|
}
|
2016-08-13 22:18:03 +02:00
|
|
|
if ($var == $value) {
|
2016-06-11 15:33:16 +02:00
|
|
|
$tmp_selected = true;
|
2016-08-13 22:10:57 +02:00
|
|
|
echo " <option value='$value' selected='selected'>$value</option>\n";
|
2016-06-11 15:33:16 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2016-08-13 22:10:57 +02:00
|
|
|
echo " <option value='$value'>$value</option>\n";
|
2016-06-11 15:33:16 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
echo "</optgroup>\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//select
|
|
|
|
|
if (if_group("superadmin")) {
|
|
|
|
|
if (!$tmp_selected && strlen($var) > 0) {
|
|
|
|
|
echo "<optgroup label='Selected'>\n";
|
|
|
|
|
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$var)) {
|
|
|
|
|
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$var."' selected='selected'>".$var."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else if (substr($var, -3) == "wav" || substr($var, -3) == "mp3") {
|
|
|
|
|
echo " <option value='".$var."' selected='selected'>".$var."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='".$var."' selected='selected'>".$var."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
echo "</optgroup>\n";
|
|
|
|
|
}
|
|
|
|
|
unset($tmp_selected);
|
|
|
|
|
}
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo " <br />\n";
|
|
|
|
|
echo $text['description-' . $description_name]."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-14 22:50:34 +02:00
|
|
|
//show the content
|
|
|
|
|
echo "<form method='post' name='frm' action=''>\n";
|
2015-02-15 08:59:02 +01:00
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "<tr>\n";
|
2013-05-14 17:09:15 +02:00
|
|
|
echo "<td align='left' width='30%' nowrap='nowrap'><b>";
|
|
|
|
|
if ($action == "update") {
|
|
|
|
|
echo $text['header-call_flow-edit'];
|
|
|
|
|
}
|
|
|
|
|
if ($action == "add") {
|
|
|
|
|
echo $text['header-call_flow-add'];
|
|
|
|
|
}
|
|
|
|
|
echo "</b></td>\n";
|
2014-04-27 01:37:41 +02:00
|
|
|
echo "<td width='70%' align='right'>";
|
|
|
|
|
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='call_flows.php'\" value='".$text['button-back']."'>";
|
|
|
|
|
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
|
|
|
|
echo "</td>\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
2012-09-14 23:57:22 +02:00
|
|
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
2015-02-15 07:50:00 +01:00
|
|
|
echo " ".$text['label-name']."\n";
|
2012-09-15 00:45:26 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <input class='formfld' type='text' name='call_flow_name' maxlength='255' value=\"$call_flow_name\">\n";
|
|
|
|
|
echo "<br />\n";
|
2013-05-14 17:09:15 +02:00
|
|
|
echo $text['description-name']."\n";
|
2012-09-15 00:45:26 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
2015-02-15 07:50:00 +01:00
|
|
|
echo " ".$text['label-extension']."\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <input class='formfld' type='text' name='call_flow_extension' maxlength='255' value=\"$call_flow_extension\">\n";
|
|
|
|
|
echo "<br />\n";
|
2013-05-14 17:09:15 +02:00
|
|
|
echo $text['description-extension']."\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
2015-02-15 07:50:00 +01:00
|
|
|
echo " ".$text['label-feature_code']."\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <input class='formfld' type='text' name='call_flow_feature_code' maxlength='255' value=\"$call_flow_feature_code\">\n";
|
|
|
|
|
echo "<br />\n";
|
2013-05-14 17:09:15 +02:00
|
|
|
echo $text['description-feature_code']."\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2012-09-15 01:22:46 +02:00
|
|
|
echo "<tr>\n";
|
2012-09-17 20:38:11 +02:00
|
|
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
2015-02-15 07:50:00 +01:00
|
|
|
echo " ".$text['label-context']."\n";
|
2012-09-15 01:22:46 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <input class='formfld' type='text' name='call_flow_context' maxlength='255' value=\"$call_flow_context\">\n";
|
|
|
|
|
echo "<br />\n";
|
2013-05-14 17:09:15 +02:00
|
|
|
echo $text['description-context']."\n";
|
2012-09-15 01:22:46 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
2015-02-15 07:50:00 +01:00
|
|
|
echo " ".$text['label-status']."\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <select class='formfld' name='call_flow_status'>\n";
|
|
|
|
|
echo " <option value=''></option>\n";
|
2012-09-20 11:34:48 +02:00
|
|
|
if ($call_flow_status == "true") {
|
|
|
|
|
if (strlen($call_flow_label) > 0) {
|
|
|
|
|
echo " <option value='true' selected='selected'>$call_flow_label</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
2013-05-14 17:09:15 +02:00
|
|
|
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
2012-09-20 11:34:48 +02:00
|
|
|
}
|
2012-09-14 22:50:34 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2012-09-20 11:34:48 +02:00
|
|
|
if (strlen($call_flow_label) > 0) {
|
|
|
|
|
echo " <option value='true'>$call_flow_label</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
2013-05-14 17:09:15 +02:00
|
|
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
2012-09-20 11:34:48 +02:00
|
|
|
}
|
2012-09-14 22:50:34 +02:00
|
|
|
}
|
2012-09-20 11:34:48 +02:00
|
|
|
if ($call_flow_status == "false") {
|
2016-06-11 17:06:12 +02:00
|
|
|
if (strlen($call_flow_alternate_label) > 0) {
|
|
|
|
|
echo " <option value='false' selected='selected'>$call_flow_alternate_label</option>\n";
|
2012-09-20 11:34:48 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2013-05-14 17:09:15 +02:00
|
|
|
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
2012-09-20 11:34:48 +02:00
|
|
|
}
|
2012-09-14 22:50:34 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2016-06-11 17:06:12 +02:00
|
|
|
if (strlen($call_flow_alternate_label) > 0) {
|
|
|
|
|
echo " <option value='false'>$call_flow_alternate_label</option>\n";
|
2012-09-20 11:34:48 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2013-05-14 17:09:15 +02:00
|
|
|
echo " <option value='false'>".$text['label-false']."</option>\n";
|
2012-09-20 11:34:48 +02:00
|
|
|
}
|
2012-09-14 22:50:34 +02:00
|
|
|
}
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo "<br />\n";
|
2013-05-14 17:09:15 +02:00
|
|
|
echo $text['description-status']."\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
2015-02-15 07:50:00 +01:00
|
|
|
echo " ".$text['label-pin_number']."\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <input class='formfld' type='text' name='call_flow_pin_number' maxlength='255' value=\"$call_flow_pin_number\">\n";
|
|
|
|
|
echo "<br />\n";
|
2013-05-14 17:09:15 +02:00
|
|
|
echo $text['description-pin_number']."\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2012-09-20 09:16:08 +02:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
2015-02-15 07:50:00 +01:00
|
|
|
echo " ".$text['label-destination_label']."\n";
|
2012-09-20 09:16:08 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <input class='formfld' type='text' name='call_flow_label' maxlength='255' value=\"$call_flow_label\">\n";
|
|
|
|
|
echo "<br />\n";
|
2013-05-14 17:09:15 +02:00
|
|
|
echo $text['description-destination_label']."\n";
|
2012-09-20 09:16:08 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2016-06-11 17:29:56 +02:00
|
|
|
sound_select_list($call_flow_sound, 'call_flow_sound', 'sound', true);
|
2016-06-11 15:33:16 +02:00
|
|
|
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "<tr>\n";
|
2012-09-14 23:57:22 +02:00
|
|
|
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
2015-02-15 07:50:00 +01:00
|
|
|
echo " ".$text['label-destination']."\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2012-09-14 23:57:22 +02:00
|
|
|
$select_value = '';
|
|
|
|
|
//set the selected value
|
|
|
|
|
if (strlen($call_flow_app.$call_flow_data) > 0) {
|
|
|
|
|
$select_value = $call_flow_app.':'.$call_flow_data;
|
|
|
|
|
}
|
|
|
|
|
//show the destination list
|
2015-08-07 21:10:24 +02:00
|
|
|
echo $destination->select('dialplan', 'call_flow_destination', $select_value);
|
2012-09-14 23:57:22 +02:00
|
|
|
unset($select_value);
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "<br />\n";
|
2013-05-14 17:09:15 +02:00
|
|
|
echo $text['description-destination']."\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2012-09-20 09:16:08 +02:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
2015-02-15 07:50:00 +01:00
|
|
|
echo " ".$text['label-alternate_label']."\n";
|
2012-09-20 09:16:08 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2016-06-11 17:06:12 +02:00
|
|
|
echo " <input class='formfld' type='text' name='call_flow_alternate_label' maxlength='255' value=\"$call_flow_alternate_label\">\n";
|
2012-09-20 09:16:08 +02:00
|
|
|
echo "<br />\n";
|
2013-05-14 17:09:15 +02:00
|
|
|
echo $text['description-alternate_label']."\n";
|
2012-09-20 09:16:08 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2016-06-11 17:29:56 +02:00
|
|
|
sound_select_list($call_flow_alternate_sound, 'call_flow_alternate_sound', 'alternate_sound', true);
|
2016-06-11 15:33:16 +02:00
|
|
|
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "<tr>\n";
|
2012-09-14 23:57:22 +02:00
|
|
|
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
2015-02-15 07:50:00 +01:00
|
|
|
echo " ".$text['label-alternate_destination']."\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2012-09-14 23:57:22 +02:00
|
|
|
$select_value = '';
|
2016-06-11 17:06:12 +02:00
|
|
|
if (strlen($call_flow_alternate_app.$call_flow_alternate_data) > 0) {
|
|
|
|
|
$select_value = $call_flow_alternate_app.':'.$call_flow_alternate_data;
|
2012-09-14 23:57:22 +02:00
|
|
|
}
|
2015-08-07 21:10:24 +02:00
|
|
|
echo $destination->select('dialplan', 'call_flow_alternate_destination', $select_value);
|
2012-09-14 23:57:22 +02:00
|
|
|
unset($select_value);
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "<br />\n";
|
2013-05-14 17:09:15 +02:00
|
|
|
echo $text['description-alternate_destination']."\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
2015-02-15 07:50:00 +01:00
|
|
|
echo " ".$text['label-description']."\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <input class='formfld' type='text' name='call_flow_description' maxlength='255' value=\"$call_flow_description\">\n";
|
|
|
|
|
echo "<br />\n";
|
2013-05-14 17:09:15 +02:00
|
|
|
echo $text['description-description']."\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
2012-09-14 23:57:22 +02:00
|
|
|
|
2012-09-14 22:50:34 +02:00
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td colspan='2' align='right'>\n";
|
|
|
|
|
if ($action == "update") {
|
2015-02-15 08:59:02 +01:00
|
|
|
echo " <input type='hidden' name='call_flow_uuid' value='$call_flow_uuid'>\n";
|
|
|
|
|
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
}
|
2015-02-15 10:20:19 +01:00
|
|
|
echo " <br>";
|
2015-02-15 08:59:02 +01:00
|
|
|
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>";
|
|
|
|
|
echo "</table>";
|
2015-02-15 08:59:02 +01:00
|
|
|
echo "<br><br>";
|
2012-09-14 22:50:34 +02:00
|
|
|
echo "</form>";
|
|
|
|
|
|
|
|
|
|
//include the footer
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2016-06-11 17:06:12 +02:00
|
|
|
?>
|