Update call_flow_edit.php

This commit is contained in:
FusionPBX 2016-10-04 03:28:31 -06:00 committed by GitHub
parent 03cebda07d
commit 12d45dc5f9
1 changed files with 226 additions and 352 deletions

View File

@ -28,9 +28,9 @@
//includes //includes
require_once "root.php"; require_once "root.php";
require_once "resources/require.php"; require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions //check permissions
require_once "resources/check_auth.php";
if (permission_exists('call_flow_add') || permission_exists('call_flow_edit')) { if (permission_exists('call_flow_add') || permission_exists('call_flow_edit')) {
//access granted //access granted
} }
@ -53,8 +53,10 @@
} }
//get http post variables and set them to php variables //get http post variables and set them to php variables
if (count($_POST) > 0) { if (is_array($_POST)) {
//set the variables from the http values //set the variables from the http values
$call_flow_uuid = check_str($_POST["call_flow_uuid"]);
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
$call_flow_name = check_str($_POST["call_flow_name"]); $call_flow_name = check_str($_POST["call_flow_name"]);
$call_flow_extension = check_str($_POST["call_flow_extension"]); $call_flow_extension = check_str($_POST["call_flow_extension"]);
$call_flow_feature_code = check_str($_POST["call_flow_feature_code"]); $call_flow_feature_code = check_str($_POST["call_flow_feature_code"]);
@ -64,11 +66,18 @@
$call_flow_label = check_str($_POST["call_flow_label"]); $call_flow_label = check_str($_POST["call_flow_label"]);
$call_flow_sound = check_str($_POST["call_flow_sound"]); $call_flow_sound = check_str($_POST["call_flow_sound"]);
$call_flow_destination = check_str($_POST["call_flow_destination"]); $call_flow_destination = check_str($_POST["call_flow_destination"]);
//$call_flow_app = check_str($_POST["call_flow_app"]);
//$call_flow_data = check_str($_POST["call_flow_data"]);
$call_flow_alternate_label = check_str($_POST["call_flow_alternate_label"]); $call_flow_alternate_label = check_str($_POST["call_flow_alternate_label"]);
$call_flow_alternate_sound = check_str($_POST["call_flow_alternate_sound"]); $call_flow_alternate_sound = check_str($_POST["call_flow_alternate_sound"]);
$call_flow_alternate_destination = check_str($_POST["call_flow_alternate_destination"]); $call_flow_alternate_destination = check_str($_POST["call_flow_alternate_destination"]);
//$call_flow_alternate_app = check_str($_POST["call_flow_alternate_app"]);
//$call_flow_alternate_data = check_str($_POST["call_flow_alternate_data"]);
$call_flow_description = check_str($_POST["call_flow_description"]); $call_flow_description = check_str($_POST["call_flow_description"]);
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
//unset the values
unset($_POST["call_flow_destination"]);
unset($_POST["call_flow_alternate_destination"]);
//seperate the action and the param //seperate the action and the param
$destination_array = explode(":", $call_flow_destination); $destination_array = explode(":", $call_flow_destination);
@ -80,35 +89,47 @@
$call_flow_alternate_app = array_shift($alternate_destination_array); $call_flow_alternate_app = array_shift($alternate_destination_array);
$call_flow_alternate_data = join(':', $alternate_destination_array); $call_flow_alternate_data = join(':', $alternate_destination_array);
//set the context for users that are not in the superadmin group //set the context for users that are not in the superadmin group
if (!if_group("superadmin")) { if (!if_group("superadmin")) {
$call_flow_context = $_SESSION['domain_name']; $call_flow_context = $_SESSION['domain_name'];
} }
} }
//process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = ''; //get the uuid from the POST
if ($action == "update") { if ($action == "update") {
$call_flow_uuid = check_str($_POST["call_flow_uuid"]); $call_flow_uuid = check_str($_POST["call_flow_uuid"]);
} }
//set the call flow application and data
$_POST["call_flow_app"] = $call_flow_app;
$_POST["call_flow_data"] = $call_flow_data;
$_POST["call_flow_alternate_app"] = $call_flow_alternate_app;
$_POST["call_flow_alternate_data"] = $call_flow_alternate_data;
//check for all required data //check for all required data
if (strlen($call_flow_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; } $msg = '';
if (strlen($call_flow_extension) == 0) { $msg .= $text['message-required'].$text['label-extension']."<br>\n"; } //if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
//if (strlen($call_flow_feature_code) == 0) { $msg .= $text['message-required'].$text['label-feature_code']."<br>\n"; } //if (strlen($call_flow_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_uuid']."<br>\n"; }
if (strlen($call_flow_context) == 0) { $msg .= $text['message-required'].$text['label-context']."<br>\n"; } //if (strlen($dialplan_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-dialplan_uuid']."<br>\n"; }
//if (strlen($call_flow_status) == 0) { $msg .= $text['message-required'].$text['label-status']."<br>\n"; } //if (strlen($call_flow_name) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_name']."<br>\n"; }
//if (strlen($call_flow_pin_number) == 0) { $msg .= $text['message-required'].$text['label-pin_number']."<br>\n"; } if (strlen($call_flow_extension) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_extension']."<br>\n"; }
//if (strlen($call_flow_status) == 0) { $msg .= $text['message-required'].$text['label-status']."<br>\n"; } if (strlen($call_flow_feature_code) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_feature_code']."<br>\n"; }
//if (strlen($call_flow_label) == 0) { $msg .= $text['message-required'].$text['label-destination_label']."<br>\n"; } if (strlen($call_flow_context) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_context']."<br>\n"; }
//if (strlen($call_flow_app) == 0) { $msg .= $text['message-required'].$text['label-destination']."<br>\n"; } //if (strlen($call_flow_status) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_status']."<br>\n"; }
//if (strlen($call_flow_data) == 0) { $msg .= $text['message-required'].$text['label-destination']."<br>\n"; } //if (strlen($call_flow_pin_number) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_pin_number']."<br>\n"; }
//if (strlen($call_flow_alternate_label) == 0) { $msg .= $text['message-required'].$text['label-alternate_label']."<br>\n"; } //if (strlen($call_flow_label) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_label']."<br>\n"; }
//if (strlen($call_flow_alternate_app) == 0) { $msg .= $text['message-required'].$text['label-alternate_destination']."<br>\n"; } //if (strlen($call_flow_sound) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_sound']."<br>\n"; }
//if (strlen($call_flow_alternate_data) == 0) { $msg .= $text['message-required'].$text['label-alternate_destination']."<br>\n"; } if (strlen($call_flow_app) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_app']."<br>\n"; }
//if (strlen($call_flow_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; } if (strlen($call_flow_data) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_data']."<br>\n"; }
//if (strlen($call_flow_alternate_label) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_alternate_label']."<br>\n"; }
//if (strlen($call_flow_alternate_sound) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_alternate_sound']."<br>\n"; }
//if (strlen($call_flow_alternate_app) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_alternate_app']."<br>\n"; }
//if (strlen($call_flow_alternate_data) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_alternate_data']."<br>\n"; }
if (strlen($call_flow_description) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
@ -122,225 +143,67 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
return; return;
} }
//add or update the database //set the domain_uuid
if ($_POST["persistformvar"] != "true") { $_POST["domain_uuid"] = $_SESSION["domain_uuid"];
if ($action == "add" && permission_exists('call_flow_add')) {
//prepare the uuids //add the call_flow_uuid
if (strlen($_POST["call_flow_uuid"]) == 0) {
$call_flow_uuid = uuid(); $call_flow_uuid = uuid();
$dialplan_uuid = uuid(); $_POST["call_flow_uuid"] = $call_flow_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, ";
$sql .= "call_flow_context, ";
$sql .= "call_flow_status, ";
$sql .= "call_flow_pin_number, ";
$sql .= "call_flow_label, ";
$sql .= "call_flow_sound, ";
$sql .= "call_flow_app, ";
$sql .= "call_flow_data, ";
$sql .= "call_flow_alternate_label, ";
$sql .= "call_flow_alternate_sound, ";
$sql .= "call_flow_alternate_app, ";
$sql .= "call_flow_alternate_data, ";
$sql .= "call_flow_description ";
$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', ";
$sql .= "'$call_flow_context', ";
$sql .= "'$call_flow_status', ";
$sql .= "'$call_flow_pin_number', ";
$sql .= "'$call_flow_label', ";
$sql .= "'$call_flow_sound', ";
$sql .= "'$call_flow_app', ";
$sql .= "'$call_flow_data', ";
$sql .= "'$call_flow_alternate_label', ";
$sql .= "'$call_flow_alternate_sound', ";
$sql .= "'$call_flow_alternate_app', ";
$sql .= "'$call_flow_alternate_data', ";
$sql .= "'$call_flow_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
} //if ($action == "add")
if ($action == "update" && permission_exists('call_flow_edit')) {
//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', ";
$sql .= "call_flow_context = '$call_flow_context', ";
$sql .= "call_flow_status = '$call_flow_status', ";
$sql .= "call_flow_pin_number = '$call_flow_pin_number', ";
$sql .= "call_flow_label = '$call_flow_label', ";
$sql .= "call_flow_sound = '$call_flow_sound', ";
$sql .= "call_flow_app = '$call_flow_app', ";
$sql .= "call_flow_data = '$call_flow_data', ";
$sql .= "call_flow_alternate_label = '$call_flow_alternate_label', ";
$sql .= "call_flow_alternate_sound = '$call_flow_alternate_sound', ";
$sql .= "call_flow_alternate_app = '$call_flow_alternate_app', ";
$sql .= "call_flow_alternate_data = '$call_flow_alternate_data', ";
$sql .= "call_flow_description = '$call_flow_description' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_flow_uuid = '$call_flow_uuid'";
$db->exec(check_sql($sql));
unset($sql);
} //if ($action == "update")
if ($action == "add" || $action == "update") { //add the dialplan_uuid
if (!isset($_POST["dialplan_uuid"])) {
$dialplan_uuid = uuid();
$_POST["dialplan_uuid"] = $dialplan_uuid;
}
//delete the dialplan //build the xml dialplan
$sql = "delete from v_dialplans "; $dialplan_xml = "<extension name=\"".$conference_center_name."\" continue=\"\" uuid=\"".$dialplan_uuid."\">\n";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $dialplan_xml .= " <condition field=\"destination_number\" expression=\"^".$call_flow_feature_code."$\" break=\"on-true\">\n";
$sql .= "and dialplan_uuid = '".$dialplan_uuid."' "; $dialplan_xml .= " <action application=\"set\" data=\"feature_code=true\"/>\n";
$db->query(check_sql($sql)); $dialplan_xml .= " <action application=\"set\" data=\"call_flow_uuid=".$call_flow_uuid."\"/>\n";
$dialplan_xml .= " <action application=\"lua\" data=\"call_flow.lua\"/>\n";
$dialplan_xml .= " </condition>\n";
$dialplan_xml .= " <condition field=\"destination_number\" expression=\"^".$call_flow_extension."$\">\n";
$dialplan_xml .= " <action application=\"set\" data=\"call_flow_uuid=".$call_flow_uuid."\"/>\n";
$dialplan_xml .= " <action application=\"lua\" data=\"call_flow.lua\"/>\n";
$dialplan_xml .= " </condition>\n";
$dialplan_xml .= "</extension>\n";
//delete the dialplan details //build the dialplan array
$sql = "delete from v_dialplan_details "; $dialplan["domain_uuid"] = $_SESSION['domain_uuid'];
$sql .= "where domain_uuid = '$domain_uuid' "; $dialplan["dialplan_uuid"] = $dialplan_uuid;
$sql .= "and dialplan_uuid = '$dialplan_uuid' "; $dialplan["dialplan_name"] = $call_flow_name;
$db->query($sql); $dialplan["dialplan_number"] = $call_flow_extension;
unset($sql); $dialplan["dialplan_context"] = $_SESSION['context'];
$dialplan["dialplan_continue"] = "false";
$dialplan["dialplan_xml"] = $dialplan_xml;
$dialplan["dialplan_order"] = "333";
$dialplan["dialplan_enabled"] = "true";
$dialplan["dialplan_description"] = $call_flow_description;
$dialplan["app_uuid"] = "b1b70f85-6b42-429b-8c5a-60c8b02b7d14";
//add the dialplan entry //prepare the array
$dialplan_name = $call_flow_name; $array['call_flows'][] = $_POST;
$dialplan_order ='333'; $array['dialplans'][] = $dialplan;
$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"/> //save to the data
$dialplan = new dialplan; $orm = new orm;
$dialplan->domain_uuid = $domain_uuid; //$orm->name('call_flows');
$dialplan->dialplan_uuid = $dialplan_uuid; $orm->app_name = 'call_flows';
$dialplan->dialplan_detail_tag = 'condition'; //condition, action, antiaction $orm->app_uuid = 'b1b70f85-6b42-429b-8c5a-60c8b02b7d14';
$dialplan->dialplan_detail_type = 'destination_number'; if (strlen($call_flow_uuid) > 0) {
$dialplan->dialplan_detail_data = '^'.str_replace('+', '\+', str_replace('*', '\*', $call_flow_feature_code)).'$'; $orm->uuid($call_flow_uuid);
$dialplan->dialplan_detail_break = 'on-true'; }
//$dialplan->dialplan_detail_inline = ''; $orm->save($array);
$dialplan->dialplan_detail_group = '1'; $message = $orm->message;
$dialplan->dialplan_detail_order = '000';
$dialplan->dialplan_detail_add();
unset($dialplan);
//<action application="set" data="call_flow_uuid="/> //debug info
$dialplan = new dialplan; //echo "<pre>";
$dialplan->domain_uuid = $domain_uuid; //print_r($message);
$dialplan->dialplan_uuid = $dialplan_uuid; //echo "</pre>";
$dialplan->dialplan_detail_tag = 'action'; //condition, action, antiaction //exit;
$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';
$dialplan->dialplan_detail_data = '^'.str_replace('+', '\+', str_replace('*', '\*', $call_flow_extension)).'$';
//$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 the xml
save_dialplan_xml(); save_dialplan_xml();
@ -352,51 +215,50 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$cache = new cache; $cache = new cache;
$cache->delete("dialplan:".$call_flow_context); $cache->delete("dialplan:".$call_flow_context);
//set the message //redirect the user
if (isset($action)) {
if ($action == "add") { if ($action == "add") {
$_SESSION["message"] = $text['message-add']; $_SESSION["message"] = $text['message-add'];
} }
if ($action == "update") { if ($action == "update") {
$_SESSION["message"] = $text['message-update']; $_SESSION["message"] = $text['message-update'];
} }
//redirect the browser
header("Location: call_flows.php"); header("Location: call_flows.php");
return; return;
} }
} //if ($_POST["persistformvar"] != "true") } //(is_array($_POST) && strlen($_POST["persistformvar"]) == 0)
} //(count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0)
//initialize the destinations object //initialize the destinations object
$destination = new destinations; $destination = new destinations;
//pre-populate the form //pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { if (is_array($_GET) && $_POST["persistformvar"] != "true") {
$call_flow_uuid = check_str($_GET["id"]); $call_flow_uuid = check_str($_GET["id"]);
$sql = "select * from v_call_flows "; $sql = "select * from v_call_flows ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' ";
$sql .= "and call_flow_uuid = '$call_flow_uuid' "; $sql .= "and call_flow_uuid = '$call_flow_uuid' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) { foreach ($result as &$row) {
//set the php variables //set the php variables
$call_flow_uuid = $row["call_flow_uuid"];
$dialplan_uuid = $row["dialplan_uuid"];
$call_flow_name = $row["call_flow_name"]; $call_flow_name = $row["call_flow_name"];
$call_flow_extension = $row["call_flow_extension"]; $call_flow_extension = $row["call_flow_extension"];
$call_flow_feature_code = $row["call_flow_feature_code"]; $call_flow_feature_code = $row["call_flow_feature_code"];
$call_flow_context = $row["call_flow_context"]; $call_flow_context = $row["call_flow_context"];
$call_flow_status = $row["call_flow_status"]; $call_flow_status = $row["call_flow_status"];
$call_flow_pin_number = $row["call_flow_pin_number"];
$call_flow_label = $row["call_flow_label"]; $call_flow_label = $row["call_flow_label"];
$call_flow_sound = $row["call_flow_sound"]; $call_flow_sound = $row["call_flow_sound"];
$call_flow_app = $row["call_flow_app"]; $call_flow_app = $row["call_flow_app"];
$call_flow_pin_number = $row["call_flow_pin_number"];
$call_flow_data = $row["call_flow_data"]; $call_flow_data = $row["call_flow_data"];
$call_flow_alternate_label = $row["call_flow_alternate_label"]; $call_flow_alternate_label = $row["call_flow_alternate_label"];
$call_flow_alternate_sound = $row["call_flow_alternate_sound"]; $call_flow_alternate_sound = $row["call_flow_alternate_sound"];
$call_flow_alternate_app = $row["call_flow_alternate_app"]; $call_flow_alternate_app = $row["call_flow_alternate_app"];
$call_flow_alternate_data = $row["call_flow_alternate_data"]; $call_flow_alternate_data = $row["call_flow_alternate_data"];
$call_flow_description = $row["call_flow_description"]; $call_flow_description = $row["call_flow_description"];
$dialplan_uuid = $row["dialplan_uuid"];
//if superadmin show both the app and data //if superadmin show both the app and data
if (if_group("superadmin")) { if (if_group("superadmin")) {
@ -422,15 +284,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$call_flow_context = $_SESSION['domain_name']; $call_flow_context = $_SESSION['domain_name'];
} }
//show the header
require_once "resources/header.php";
if ($action == "update") {
$document['title'] = $text['title-call_flow-edit'];
}
if ($action == "add") {
$document['title'] = $text['title-call_flow-add'];
}
//get the recordings //get the recordings
$sql = "select recording_name, recording_filename from v_recordings "; $sql = "select recording_name, recording_filename from v_recordings ";
$sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' "; $sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' ";
@ -576,71 +429,67 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n"; echo "</tr>\n";
} }
//show the header
require_once "resources/header.php";
//show the content //show the content
echo "<form method='post' name='frm' action=''>\n"; echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n"; echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap'><b>"; echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-call_flow']."</b><br><br></td>\n";
if ($action == "update") { echo "<td width='70%' align='right' valign='top'>\n";
echo $text['header-call_flow-edit'];
}
if ($action == "add") {
echo $text['header-call_flow-add'];
}
echo "</b></td>\n";
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='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 " <input type='submit' class='btn' value='".$text['button-save']."'>";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n"; echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-name']."\n"; echo " ".$text['label-call_flow_name']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\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 " <input class='formfld' type='text' name='call_flow_name' maxlength='255' value=\"$call_flow_name\">\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-name']."\n"; echo $text['description-call_flow_name']."\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n"; echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-extension']."\n"; echo " ".$text['label-call_flow_extension']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\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 " <input class='formfld' type='text' name='call_flow_extension' maxlength='255' value=\"$call_flow_extension\">\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-extension']."\n"; echo $text['description-call_flow_extension']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-feature_code']."\n";
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";
echo $text['description-feature_code']."\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n"; echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-context']."\n"; echo " ".$text['label-call_flow_feature_code']."\n";
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";
echo $text['description-call_flow_feature_code']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-call_flow_context']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\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 " <input class='formfld' type='text' name='call_flow_context' maxlength='255' value=\"$call_flow_context\">\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-context']."\n"; echo $text['description-call_flow_context']."\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n"; echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-status']."\n"; echo " ".$text['label-call_flow_status']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='call_flow_status'>\n"; echo " <select class='formfld' name='call_flow_status'>\n";
@ -679,37 +528,50 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
} }
echo " </select>\n"; echo " </select>\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-status']."\n"; echo $text['description-call_flow_status']."\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n"; echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-pin_number']."\n"; echo " ".$text['label-call_flow_pin_number']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\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 " <input class='formfld' type='text' name='call_flow_pin_number' maxlength='255' value=\"$call_flow_pin_number\">\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-pin_number']."\n"; echo $text['description-call_flow_pin_number']."\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n"; echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-destination_label']."\n"; echo " ".$text['label-call_flow_label']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\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 " <input class='formfld' type='text' name='call_flow_label' maxlength='255' value=\"$call_flow_label\">\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-destination_label']."\n"; echo $text['description-call_flow_label']."\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
sound_select_list($call_flow_sound, 'call_flow_sound', 'sound', true); sound_select_list($call_flow_sound, 'call_flow_sound', 'call_flow_sound', true);
/*
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-call_flow_sound']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_flow_sound' maxlength='255' value=\"$call_flow_sound\">\n";
echo "<br />\n";
echo $text['description-call_flow_sound']."\n";
echo "</td>\n";
echo "</tr>\n";
*/
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n"; echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-destination']."\n"; echo " ".$text['label-call_flow_destination']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
$select_value = ''; $select_value = '';
@ -721,26 +583,39 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo $destination->select('dialplan', 'call_flow_destination', $select_value); echo $destination->select('dialplan', 'call_flow_destination', $select_value);
unset($select_value); unset($select_value);
echo "<br />\n"; echo "<br />\n";
echo $text['description-destination']."\n"; echo $text['description-call_flow_destination']."\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n"; echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-alternate_label']."\n"; echo " ".$text['label-call_flow_alternate_label']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_flow_alternate_label' maxlength='255' value=\"$call_flow_alternate_label\">\n"; echo " <input class='formfld' type='text' name='call_flow_alternate_label' maxlength='255' value=\"$call_flow_alternate_label\">\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-alternate_label']."\n"; echo $text['description-call_flow_alternate_label']."\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
sound_select_list($call_flow_alternate_sound, 'call_flow_alternate_sound', 'alternate_sound', true); sound_select_list($call_flow_alternate_sound, 'call_flow_alternate_sound', 'call_flow_alternate_sound', true);
/*
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-call_flow_alternate_sound']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_flow_alternate_sound' maxlength='255' value=\"$call_flow_alternate_sound\">\n";
echo "<br />\n";
echo $text['description-call_flow_alternate_sound']."\n";
echo "</td>\n";
echo "</tr>\n";
*/
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n"; echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-alternate_destination']."\n"; echo " ".$text['label-call_flow_alternate_destination']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
$select_value = ''; $select_value = '';
@ -750,35 +625,34 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo $destination->select('dialplan', 'call_flow_alternate_destination', $select_value); echo $destination->select('dialplan', 'call_flow_alternate_destination', $select_value);
unset($select_value); unset($select_value);
echo "<br />\n"; echo "<br />\n";
echo $text['description-alternate_destination']."\n"; echo $text['description-call_flow_alternate_destination']."\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n"; echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-description']."\n"; echo " ".$text['label-call_flow_description']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\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 " <input class='formfld' type='text' name='call_flow_description' maxlength='255' value=\"$call_flow_description\">\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-description']."\n"; echo $text['description-call_flow_description']."\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo " <tr>\n"; echo " <tr>\n";
echo " <td colspan='2' align='right'>\n"; echo " <td colspan='2' align='right'>\n";
if ($action == "update") { if ($action == "update") {
echo " <input type='hidden' name='call_flow_uuid' value='$call_flow_uuid'>\n"; echo " <input type='hidden' name='call_flow_uuid' value='$call_flow_uuid'>\n";
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n"; echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
} }
echo " <br>"; echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n"; echo " </td>\n";
echo " </tr>"; echo " </tr>";
echo "</table>"; echo "</table>";
echo "<br><br>";
echo "</form>"; echo "</form>";
echo "<br /><br />";
//include the footer //include the footer
require_once "resources/footer.php"; require_once "resources/footer.php";
?> ?>