Add a missing file sip_profile_copy.php to the dev branch.
This commit is contained in:
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = "Dialplan Manager";
|
||||
$apps[$x]['uuid'] = '742714e5-8cdf-32fd-462c-cbe7e3d655db';
|
||||
$apps[$x]['category'] = 'Switch';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en'] = 'The dialplan is used to setup call destinations based on conditions and context. You can use the dialplan to send calls to gateways, auto attendants, external numbers, to scripts, or any destination.';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en'] = 'Dialplan';
|
||||
$apps[$x]['menu'][0]['uuid'] = 'b94e8bd9-9eb5-e427-9c26-ff7a6c21552a';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = '';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = '/app/dialplan/dialplans.php';
|
||||
$apps[$x]['menu'][0]['order'] = '15';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'admin';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['menu'][1]['title']['en'] = 'Dialplan Manager';
|
||||
$apps[$x]['menu'][1]['uuid'] = '52929fee-81d3-4d94-50b7-64842d9393c2';
|
||||
$apps[$x]['menu'][1]['parent_uuid'] = 'b94e8bd9-9eb5-e427-9c26-ff7a6c21552a';
|
||||
$apps[$x]['menu'][1]['category'] = 'internal';
|
||||
$apps[$x]['menu'][1]['path'] = '/app/dialplan/dialplans.php';
|
||||
$apps[$x]['menu'][1]['groups'][] = 'admin';
|
||||
$apps[$x]['menu'][1]['groups'][] = 'superadmin';
|
||||
|
||||
//permission details
|
||||
$apps[$x]['permissions'][0]['name'] = 'dialplan_view';
|
||||
$apps[$x]['permissions'][0]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][1]['name'] = 'dialplan_add';
|
||||
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][2]['name'] = 'dialplan_edit';
|
||||
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][3]['name'] = 'dialplan_delete';
|
||||
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][4]['name'] = 'dialplan_advanced_view';
|
||||
$apps[$x]['permissions'][4]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][5]['name'] = 'dialplan_advanced_edit';
|
||||
$apps[$x]['permissions'][5]['groups'][] = 'superadmin';
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_dialplans';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'app_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_context';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_number';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_continue';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_order';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_enabled';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_dialplan_details';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_dialplans';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'dialplan_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_tag';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_type';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_data';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_break';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_inline';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_group';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_order';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//only run the following code if the directory exists
|
||||
if (is_dir($_SESSION['switch']['dialplan']['dir'])) {
|
||||
//write the dialplan/default.xml if it does not exist
|
||||
//get the contents of the dialplan/default.xml
|
||||
$file_default_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/templates/conf/dialplan/default.xml';
|
||||
$file_default_contents = file_get_contents($file_default_path);
|
||||
|
||||
//prepare the file contents and the path
|
||||
//replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number
|
||||
$file_default_contents = str_replace("{v_domain}", $context, $file_default_contents);
|
||||
//set the file path
|
||||
$file_path = $_SESSION['switch']['conf']['dir'].'/dialplan/'.$context.'.xml';
|
||||
|
||||
//write the default dialplan
|
||||
if (!file_exists($file_path)) {
|
||||
$fh = fopen($file_path,'w') or die('Unable to write to '.$file_path.'. Make sure the path exists and permissons are set correctly.');
|
||||
fwrite($fh, $file_default_contents);
|
||||
fclose($fh);
|
||||
}
|
||||
|
||||
//get the $apps array from the installed apps from the core and mod directories
|
||||
$xml_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/dialplan/resources/xml/dialplan/*.xml");
|
||||
foreach ($xml_list as &$xml_file) {
|
||||
//get and parse the xml
|
||||
$xml_string = file_get_contents($xml_file);
|
||||
//get the order number prefix from the file name
|
||||
$name_array = explode('_', basename($xml_file));
|
||||
if (is_numeric($name_array[0])) {
|
||||
$dialplan_order = $name_array[0];
|
||||
}
|
||||
else {
|
||||
$dialplan_order = 0;
|
||||
}
|
||||
//dialplan class
|
||||
require_once "includes/classes/dialplan.php";
|
||||
$dialplan = new dialplan;
|
||||
$dialplan->domain_uuid = $domain_uuid;
|
||||
$dialplan->dialplan_order = $dialplan_order;
|
||||
$dialplan->dialplan_context = $context;
|
||||
if ($display_type == "text") {
|
||||
$dialplan->display_type = 'text';
|
||||
}
|
||||
$dialplan->xml = $xml_string;
|
||||
$dialplan->import();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,734 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('dialplan_add')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
|
||||
//POST to PHP variables
|
||||
if (count($_POST)>0) {
|
||||
$dialplan_name = check_str($_POST["dialplan_name"]);
|
||||
$dialplan_order = check_str($_POST["dialplan_order"]);
|
||||
$condition_field_1 = check_str($_POST["condition_field_1"]);
|
||||
$condition_expression_1 = check_str($_POST["condition_expression_1"]);
|
||||
$condition_field_2 = check_str($_POST["condition_field_2"]);
|
||||
$condition_expression_2 = check_str($_POST["condition_expression_2"]);
|
||||
|
||||
$action_1 = check_str($_POST["action_1"]);
|
||||
//$action_1 = "transfer:1001 XML default";
|
||||
$action_1_array = explode(":", $action_1);
|
||||
$action_application_1 = array_shift($action_1_array);
|
||||
$action_data_1 = join(':', $action_1_array);
|
||||
|
||||
$action_2 = check_str($_POST["action_2"]);
|
||||
//$action_2 = "transfer:1001 XML default";
|
||||
$action_2_array = explode(":", $action_2);
|
||||
$action_application_2 = array_shift($action_2_array);
|
||||
$action_data_2 = join(':', $action_2_array);
|
||||
|
||||
//$action_application_1 = check_str($_POST["action_application_1"]);
|
||||
//$action_data_1 = check_str($_POST["action_data_1"]);
|
||||
//$action_application_2 = check_str($_POST["action_application_2"]);
|
||||
//$action_data_2 = check_str($_POST["action_data_2"]);
|
||||
|
||||
$dialplan_enabled = check_str($_POST["dialplan_enabled"]);
|
||||
$dialplan_description = check_str($_POST["dialplan_description"]);
|
||||
if (strlen($dialplan_enabled) == 0) { $dialplan_enabled = "true"; } //set default to enabled
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//check for all required data
|
||||
if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
|
||||
if (strlen($dialplan_name) == 0) { $msg .= "Please provide: Extension Name<br>\n"; }
|
||||
if (strlen($condition_field_1) == 0) { $msg .= "Please provide: Condition Field<br>\n"; }
|
||||
if (strlen($condition_expression_1) == 0) { $msg .= "Please provide: Condition Expression<br>\n"; }
|
||||
if (strlen($action_application_1) == 0) { $msg .= "Please provide: Action Application<br>\n"; }
|
||||
//if (strlen($dialplan_enabled) == 0) { $msg .= "Please provide: Enabled True or False<br>\n"; }
|
||||
//if (strlen($dialplan_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//remove the invalid characters from the extension name
|
||||
$dialplan_name = str_replace(" ", "_", $dialplan_name);
|
||||
$dialplan_name = str_replace("/", "", $dialplan_name);
|
||||
|
||||
//start the atomic transaction
|
||||
$db->exec("BEGIN;"); //returns affected rows
|
||||
|
||||
//add the main dialplan include entry
|
||||
$dialplan_context = $_SESSION['context'];
|
||||
$dialplan_uuid = uuid();
|
||||
$sql = "insert into v_dialplans ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "app_uuid, ";
|
||||
$sql .= "dialplan_name, ";
|
||||
$sql .= "dialplan_order, ";
|
||||
$sql .= "dialplan_continue, ";
|
||||
$sql .= "dialplan_context, ";
|
||||
$sql .= "dialplan_enabled, ";
|
||||
$sql .= "dialplan_description ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$dialplan_uuid', ";
|
||||
$sql .= "'742714e5-8cdf-32fd-462c-cbe7e3d655db', ";
|
||||
$sql .= "'$dialplan_name', ";
|
||||
$sql .= "'$dialplan_order', ";
|
||||
$sql .= "'false', ";
|
||||
$sql .= "'".$_SESSION['context']."', ";
|
||||
$sql .= "'$dialplan_enabled', ";
|
||||
$sql .= "'$dialplan_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//add condition 1
|
||||
$dialplan_detail_uuid = uuid();
|
||||
$sql = "insert into v_dialplan_details ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "dialplan_detail_uuid, ";
|
||||
$sql .= "dialplan_detail_tag, ";
|
||||
$sql .= "dialplan_detail_type, ";
|
||||
$sql .= "dialplan_detail_data, ";
|
||||
$sql .= "dialplan_detail_order ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$dialplan_uuid', ";
|
||||
$sql .= "'$dialplan_detail_uuid', ";
|
||||
$sql .= "'condition', ";
|
||||
$sql .= "'$condition_field_1', ";
|
||||
$sql .= "'$condition_expression_1', ";
|
||||
$sql .= "'1' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//add condition 2
|
||||
if (strlen($condition_field_2) > 0) {
|
||||
$dialplan_detail_uuid = uuid();
|
||||
$sql = "insert into v_dialplan_details ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "dialplan_detail_uuid, ";
|
||||
$sql .= "dialplan_detail_tag, ";
|
||||
$sql .= "dialplan_detail_type, ";
|
||||
$sql .= "dialplan_detail_data, ";
|
||||
$sql .= "dialplan_detail_order ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$dialplan_uuid', ";
|
||||
$sql .= "'$dialplan_detail_uuid', ";
|
||||
$sql .= "'condition', ";
|
||||
$sql .= "'$condition_field_2', ";
|
||||
$sql .= "'$condition_expression_2', ";
|
||||
$sql .= "'2' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//add action 1
|
||||
$dialplan_detail_uuid = uuid();
|
||||
$sql = "insert into v_dialplan_details ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "dialplan_detail_uuid, ";
|
||||
$sql .= "dialplan_detail_tag, ";
|
||||
$sql .= "dialplan_detail_type, ";
|
||||
$sql .= "dialplan_detail_data, ";
|
||||
$sql .= "dialplan_detail_order ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$dialplan_uuid', ";
|
||||
$sql .= "'$dialplan_detail_uuid', ";
|
||||
$sql .= "'action', ";
|
||||
$sql .= "'$action_application_1', ";
|
||||
$sql .= "'$action_data_1', ";
|
||||
$sql .= "'3' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//add action 2
|
||||
if (strlen($action_application_2) > 0) {
|
||||
$dialplan_detail_uuid = uuid();
|
||||
$sql = "insert into v_dialplan_details ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "dialplan_detail_uuid, ";
|
||||
$sql .= "dialplan_detail_tag, ";
|
||||
$sql .= "dialplan_detail_type, ";
|
||||
$sql .= "dialplan_detail_data, ";
|
||||
$sql .= "dialplan_detail_order ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$dialplan_uuid', ";
|
||||
$sql .= "'$dialplan_detail_uuid', ";
|
||||
$sql .= "'action', ";
|
||||
$sql .= "'$action_application_2', ";
|
||||
$sql .= "'$action_data_2', ";
|
||||
$sql .= "'4' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//commit the atomic transaction
|
||||
$count = $db->exec("COMMIT;"); //returns affected rows
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Update Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //end if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
?><script type="text/javascript">
|
||||
<!--
|
||||
function type_onchange(dialplan_detail_type) {
|
||||
var field_value = document.getElementById(dialplan_detail_type).value;
|
||||
if (dialplan_detail_type == "condition_field_1") {
|
||||
if (field_value == "destination_number") {
|
||||
document.getElementById("desc_condition_expression_1").innerHTML = "expression: ^12081231234$";
|
||||
}
|
||||
else if (field_value == "zzz") {
|
||||
document.getElementById("desc_condition_expression_1").innerHTML = "";
|
||||
}
|
||||
else {
|
||||
document.getElementById("desc_condition_expression_1").innerHTML = "";
|
||||
}
|
||||
}
|
||||
if (dialplan_detail_type == "condition_field_2") {
|
||||
if (field_value == "destination_number") {
|
||||
document.getElementById("desc_condition_expression_2").innerHTML = "expression: ^12081231234$";
|
||||
}
|
||||
else if (field_value == "zzz") {
|
||||
document.getElementById("desc_condition_expression_2").innerHTML = "";
|
||||
}
|
||||
else {
|
||||
document.getElementById("desc_condition_expression_2").innerHTML = "";
|
||||
}
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
|
||||
<?php
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
|
||||
echo " <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'><span class=\"vexpl\"><span class=\"red\"><strong>Dialplan\n";
|
||||
echo " </strong></span></span>\n";
|
||||
echo " </td>\n";
|
||||
echo " <td align='right'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='dialplans.php'\" value='Back'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>\n";
|
||||
echo " <span class=\"vexpl\">\n";
|
||||
echo " The dialplan is used to setup call destinations based on conditions and context.\n";
|
||||
echo " You can use the dialplan to send calls to gateways, auto attendants, external numbers,\n";
|
||||
echo " to scripts, or any destination.\n";
|
||||
echo " </span>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>";
|
||||
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " Name:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' style='width: 60%;' type='text' name='dialplan_name' maxlength='255' value=\"$dialplan_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
//echo "<tr>\n";
|
||||
//echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
//echo " Continue:\n";
|
||||
//echo "</td>\n";
|
||||
//echo "<td class='vtable' align='left'>\n";
|
||||
//echo " <select class='formfld' name='dialplan_continue' style='width: 60%;'>\n";
|
||||
//echo " <option value=''></option>\n";
|
||||
//if ($dialplan_continue == "true") {
|
||||
// echo " <option value='true' SELECTED >true</option>\n";
|
||||
//}
|
||||
//else {
|
||||
// echo " <option value='true'>true</option>\n";
|
||||
//}
|
||||
//if ($dialplan_continue == "false") {
|
||||
// echo " <option value='false' SELECTED >false</option>\n";
|
||||
//}
|
||||
//else {
|
||||
// echo " <option value='false'>false</option>\n";
|
||||
//}
|
||||
//echo " </select>\n";
|
||||
//echo "<br />\n";
|
||||
//echo "Extension Continue in most cases this is false. default: false\n";
|
||||
//echo "</td>\n";
|
||||
//echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Condition 1:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
?>
|
||||
<script>
|
||||
var Objs;
|
||||
function changeToInput_condition_field_1(obj){
|
||||
tb=document.createElement('INPUT');
|
||||
tb.type='text';
|
||||
tb.name=obj.name;
|
||||
tb.className='formfld';
|
||||
tb.setAttribute('id', 'condition_field_1');
|
||||
tb.setAttribute('style', 'width: 85%;');
|
||||
tb.value=obj.options[obj.selectedIndex].value;
|
||||
document.getElementById('btn_select_to_input_condition_field_1').style.visibility = 'hidden';
|
||||
tbb=document.createElement('INPUT');
|
||||
tbb.setAttribute('class', 'btn');
|
||||
tbb.type='button';
|
||||
tbb.value='<';
|
||||
tbb.objs=[obj,tb,tbb];
|
||||
tbb.onclick=function(){ Replace_condition_field_1(this.objs); }
|
||||
obj.parentNode.insertBefore(tb,obj);
|
||||
obj.parentNode.insertBefore(tbb,obj);
|
||||
obj.parentNode.removeChild(obj);
|
||||
Replace_condition_field_1(this.objs);
|
||||
}
|
||||
|
||||
function Replace_condition_field_1(obj){
|
||||
obj[2].parentNode.insertBefore(obj[0],obj[2]);
|
||||
obj[0].parentNode.removeChild(obj[1]);
|
||||
obj[0].parentNode.removeChild(obj[2]);
|
||||
document.getElementById('btn_select_to_input_condition_field_1').style.visibility = 'visible';
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
echo " <table style='width: 60%;' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td style='width: 62px;'>Field:</td>\n";
|
||||
echo " <td style='width: 35%;' nowrap='nowrap'>\n";
|
||||
echo " <select class='formfld' name='condition_field_1' id='condition_field_1' onchange='changeToInput_condition_field_1(this);this.style.visibility = \"hidden\";' style='width:85%'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if (strlen($condition_field_1) > 0) {
|
||||
echo " <option value='$condition_field_1' selected='selected'>$condition_field_1</option>\n";
|
||||
}
|
||||
echo " <optgroup label='Field'>\n";
|
||||
echo " <option value='context'>context</option>\n";
|
||||
echo " <option value='username'>username</option>\n";
|
||||
echo " <option value='rdnis'>rdnis</option>\n";
|
||||
echo " <option value='destination_number'>destination_number</option>\n";
|
||||
echo " <option value='public'>public</option>\n";
|
||||
echo " <option value='caller_id_name'>caller_id_name</option>\n";
|
||||
echo " <option value='caller_id_number'>caller_id_number</option>\n";
|
||||
echo " <option value='ani'>ani</option>\n";
|
||||
echo " <option value='ani2'>ani2</option>\n";
|
||||
echo " <option value='uuid'>uuid</option>\n";
|
||||
echo " <option value='source'>source</option>\n";
|
||||
echo " <option value='chan_name'>chan_name</option>\n";
|
||||
echo " <option value='network_addr'>network_addr</option>\n";
|
||||
echo " </optgroup>\n";
|
||||
echo " <optgroup label='Time'>\n";
|
||||
echo " <option value='hour'>hour</option>\n";
|
||||
echo " <option value='minute'>minute</option>\n";
|
||||
echo " <option value='minute-of-day'>minute of day</option>\n";
|
||||
echo " <option value='mday'>day of month</option>\n";
|
||||
echo " <option value='mweek'>week of month</option>\n";
|
||||
echo " <option value='mon'>month</option>\n";
|
||||
echo " <option value='yday'>day of year</option>\n";
|
||||
echo " <option value='year'>year</option>\n";
|
||||
echo " <option value='wday'>day of week</option>\n";
|
||||
echo " <option value='week'>week</option>\n";
|
||||
echo " </optgroup>\n";
|
||||
echo " </select>\n";
|
||||
echo " <input type='button' id='btn_select_to_input_condition_field_1' class='btn' name='' alt='back' onclick='changeToInput_condition_field_1(document.getElementById(\"condition_field_1\"));this.style.visibility = \"hidden\";' value='<'>\n";
|
||||
echo " <br />\n";
|
||||
echo " </td>\n";
|
||||
echo " <td style='width: 73px;'> Expression:</td>\n";
|
||||
echo " <td>\n";
|
||||
echo " <input class='formfld' type='text' name='condition_expression_1' maxlength='255' style='width:100%' value=\"$condition_expression_1\">\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo " <div id='desc_condition_expression_1'></div>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Condition 2:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
|
||||
echo " <table style='width: 60%;' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' style='width: 62px;'>\n";
|
||||
echo " Field:\n";
|
||||
echo " </td>\n";
|
||||
echo " <td style='width: 35%;' align='left' nowrap='nowrap'>\n";
|
||||
?>
|
||||
<script>
|
||||
var Objs;
|
||||
function changeToInput_condition_field_2(obj){
|
||||
tb=document.createElement('INPUT');
|
||||
tb.type='text';
|
||||
tb.name=obj.name;
|
||||
tb.className='formfld';
|
||||
tb.setAttribute('id', 'condition_field_2');
|
||||
tb.setAttribute('style', 'width: 85%;');
|
||||
tb.value=obj.options[obj.selectedIndex].value;
|
||||
document.getElementById('btn_select_to_input_condition_field_2').style.visibility = 'hidden';
|
||||
tbb=document.createElement('INPUT');
|
||||
tbb.setAttribute('class', 'btn');
|
||||
tbb.type='button';
|
||||
tbb.value='<';
|
||||
tbb.objs=[obj,tb,tbb];
|
||||
tbb.onclick=function(){ Replace_condition_field_2(this.objs); }
|
||||
obj.parentNode.insertBefore(tb,obj);
|
||||
obj.parentNode.insertBefore(tbb,obj);
|
||||
obj.parentNode.removeChild(obj);
|
||||
Replace_condition_field_2(this.objs);
|
||||
}
|
||||
|
||||
function Replace_condition_field_2(obj){
|
||||
obj[2].parentNode.insertBefore(obj[0],obj[2]);
|
||||
obj[0].parentNode.removeChild(obj[1]);
|
||||
obj[0].parentNode.removeChild(obj[2]);
|
||||
document.getElementById('btn_select_to_input_condition_field_2').style.visibility = 'visible';
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
echo " <select class='formfld' name='condition_field_2' id='condition_field_2' onchange='changeToInput_condition_field_2(this);this.style.visibility = \"hidden\";' style='width:85%'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if (strlen($condition_field_2) > 0) {
|
||||
echo " <option value='$condition_field_2' selected>$condition_field_2</option>\n";
|
||||
}
|
||||
echo " <optgroup label='Field'>\n";
|
||||
echo " <option value='context'>context</option>\n";
|
||||
echo " <option value='username'>username</option>\n";
|
||||
echo " <option value='rdnis'>rdnis</option>\n";
|
||||
echo " <option value='destination_number'>destination_number</option>\n";
|
||||
echo " <option value='public'>public</option>\n";
|
||||
echo " <option value='caller_id_name'>caller_id_name</option>\n";
|
||||
echo " <option value='caller_id_number'>caller_id_number</option>\n";
|
||||
echo " <option value='ani'>ani</option>\n";
|
||||
echo " <option value='ani2'>ani2</option>\n";
|
||||
echo " <option value='uuid'>uuid</option>\n";
|
||||
echo " <option value='source'>source</option>\n";
|
||||
echo " <option value='chan_name'>chan_name</option>\n";
|
||||
echo " <option value='network_addr'>network_addr</option>\n";
|
||||
echo " </optgroup>\n";
|
||||
echo " <optgroup label='Time'>\n";
|
||||
echo " <option value='hour'>hour</option>\n";
|
||||
echo " <option value='minute'>minute</option>\n";
|
||||
echo " <option value='minute-of-day'>minute of day</option>\n";
|
||||
echo " <option value='mday'>day of month</option>\n";
|
||||
echo " <option value='mweek'>week of month</option>\n";
|
||||
echo " <option value='mon'>month</option>\n";
|
||||
echo " <option value='yday'>day of year</option>\n";
|
||||
echo " <option value='year'>year</option>\n";
|
||||
echo " <option value='wday'>day of week</option>\n";
|
||||
echo " <option value='week'>week</option>\n";
|
||||
echo " </optgroup>\n";
|
||||
echo " </select>\n";
|
||||
echo " <input type='button' id='btn_select_to_input_condition_field_2' class='btn' name='' alt='back' onclick='changeToInput_condition_field_2(document.getElementById(\"condition_field_2\"));this.style.visibility = \"hidden\";' value='<'>\n";
|
||||
echo " <br />\n";
|
||||
echo " </td>\n";
|
||||
echo " <td style='width: 73px;' align='left'>\n";
|
||||
echo " Expression:\n";
|
||||
echo " </td>\n";
|
||||
echo " <td>\n";
|
||||
echo " <input class='formfld' type='text' name='condition_expression_2' maxlength='255' style='width:100%' value=\"$condition_expression_2\">\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo " <div id='desc_condition_expression_2'></div>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " Action 1:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
|
||||
//switch_select_destination(select_type, select_label, select_name, select_value, select_style, action);
|
||||
switch_select_destination("dialplan", "", "action_1", $action_1, "width: 60%;", "");
|
||||
|
||||
/*
|
||||
echo " <table style='width: 60%;' border='0' >\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td style='width: 62px;'>Application: </td>\n";
|
||||
echo " <td style='width: 35%;'>\n";
|
||||
echo " <select class='formfld' style='width:100%' id='action_application_1' name='action_application_1' onchange='type_onchange(\"action_application_1\");'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if (strlen($action_application_1) > 0) {
|
||||
echo " <option value='$action_application_1' selected>$action_application_1</option>\n";
|
||||
}
|
||||
echo " <option value='answer'>answer</option>\n";
|
||||
echo " <option value='bridge'>bridge</option>\n";
|
||||
echo " <option value='cond'>cond</option>\n";
|
||||
echo " <option value='db'>db</option>\n";
|
||||
echo " <option value='global_set'>global_set</option>\n";
|
||||
echo " <option value='group'>group</option>\n";
|
||||
echo " <option value='expr'>expr</option>\n";
|
||||
echo " <option value='export'>export</option>\n";
|
||||
echo " <option value='hangup'>hangup</option>\n";
|
||||
echo " <option value='info'>info</option>\n";
|
||||
echo " <option value='javascript'>javascript</option>\n";
|
||||
echo " <option value='read'>read</option>\n";
|
||||
echo " <option value='reject'>reject</option>\n";
|
||||
echo " <option value='playback'>playback</option>\n";
|
||||
echo " <option value='reject'>reject</option>\n";
|
||||
echo " <option value='respond'>respond</option>\n";
|
||||
echo " <option value='ring_ready'>ring_ready</option>\n";
|
||||
echo " <option value='set'>set</option>\n";
|
||||
echo " <option value='set_user'>set_user</option>\n";
|
||||
echo " <option value='sleep'>sleep</option>\n";
|
||||
echo " <option value='sofia_contact'>sofia_contact</option>\n";
|
||||
echo " <option value='transfer'>transfer</option>\n";
|
||||
echo " <option value='voicemail'>voicemail</option>\n";
|
||||
echo " <option value='conference'>conference</option>\n";
|
||||
echo " <option value='conference_set_auto_outcall'>conference_set_auto_outcall</option>\n";
|
||||
echo " </select><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " <td style='width: 73px;'>\n";
|
||||
echo " Data: \n";
|
||||
echo " </td>\n";
|
||||
echo " <td>\n";
|
||||
echo " <input class='formfld' style='width: 100%;' type='text' name='action_data_1' maxlength='255' value=\"$action_data_1\">\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo " <div id='desc_action_data_1'></div>\n";
|
||||
*/
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Action 2:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
|
||||
//switch_select_destination(select_type, select_label, select_name, select_value, select_style, action);
|
||||
switch_select_destination("dialplan", "", "action_2", $action_2, "width: 60%;", "");
|
||||
|
||||
/*
|
||||
echo " <table style='width: 60%;' border='0' >\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td style='width: 62px;'>Application: </td>\n";
|
||||
echo " <td style='width: 35%;'>\n";
|
||||
echo " <select class='formfld' style='width:100%' id='action_application_2' name='action_application_2' onchange='type_onchange(\"action_application_2\");'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if (strlen($action_application_2) > 0) {
|
||||
echo " <option value='$action_application_2' selected>$action_application_2</option>\n";
|
||||
}
|
||||
echo " <option value='answer'>answer</option>\n";
|
||||
echo " <option value='bridge'>bridge</option>\n";
|
||||
echo " <option value='cond'>cond</option>\n";
|
||||
echo " <option value='db'>db</option>\n";
|
||||
echo " <option value='global_set'>global_set</option>\n";
|
||||
echo " <option value='group'>group</option>\n";
|
||||
echo " <option value='expr'>expr</option>\n";
|
||||
echo " <option value='export'>export</option>\n";
|
||||
echo " <option value='hangup'>hangup</option>\n";
|
||||
echo " <option value='info'>info</option>\n";
|
||||
echo " <option value='javascript'>javascript</option>\n";
|
||||
echo " <option value='read'>read</option>\n";
|
||||
echo " <option value='reject'>reject</option>\n";
|
||||
echo " <option value='playback'>playback</option>\n";
|
||||
echo " <option value='reject'>reject</option>\n";
|
||||
echo " <option value='respond'>respond</option>\n";
|
||||
echo " <option value='ring_ready'>ring_ready</option>\n";
|
||||
echo " <option value='set'>set</option>\n";
|
||||
echo " <option value='set_user'>set_user</option>\n";
|
||||
echo " <option value='sleep'>sleep</option>\n";
|
||||
echo " <option value='sofia_contact'>sofia_contact</option>\n";
|
||||
echo " <option value='transfer'>transfer</option>\n";
|
||||
echo " <option value='voicemail'>voicemail</option>\n";
|
||||
echo " <option value='conference'>conference</option>\n";
|
||||
echo " <option value='conference_set_auto_outcall'>conference_set_auto_outcall</option>\n";
|
||||
echo " </select><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " <td style='width: 73px;'>\n";
|
||||
echo " Data: \n";
|
||||
echo " </td>\n";
|
||||
echo " <td>\n";
|
||||
echo " <input class='formfld' style='width: 100%;' type='text' name='action_data_2' maxlength='255' value=\"$action_data_2\">\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo " <div id='desc_action_data_2'></div>\n";
|
||||
*/
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " Order:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name='dialplan_order' class='formfld' style='width: 60%;'>\n";
|
||||
//echo " <option></option>\n";
|
||||
if (strlen(htmlspecialchars($dialplan_order))> 0) {
|
||||
echo " <option selected='yes' value='".htmlspecialchars($dialplan_order)."'>".htmlspecialchars($dialplan_order)."</option>\n";
|
||||
}
|
||||
$i=0;
|
||||
while($i<=999) {
|
||||
if (strlen($i) == 1) { echo " <option value='00$i'>00$i</option>\n"; }
|
||||
if (strlen($i) == 2) { echo " <option value='0$i'>0$i</option>\n"; }
|
||||
if (strlen($i) == 3) { echo " <option value='$i'>$i</option>\n"; }
|
||||
$i++;
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " Enabled:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='dialplan_enabled' style='width: 60%;'>\n";
|
||||
//echo " <option value=''></option>\n";
|
||||
if ($dialplan_enabled == "true") {
|
||||
echo " <option value='true' SELECTED >true</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>true</option>\n";
|
||||
}
|
||||
if ($dialplan_enabled == "false") {
|
||||
echo " <option value='false' SELECTED >false</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>false</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Description:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td colspan='4' class='vtable' align='left'>\n";
|
||||
//echo " <textarea class='formfld' name='dialplan_description' rows='4'>$dialplan_description</textarea>\n";
|
||||
echo " <input class='formfld' style='width: 60%;' type='text' name='dialplan_description' maxlength='255' value=\"$dialplan_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan='5' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "</form>";
|
||||
|
||||
echo "</td>\n";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
|
||||
require_once "includes/footer.php";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('dialplan_advanced_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "includes/header.php";
|
||||
|
||||
if ($_GET['a'] == "default" && permission_exists('dialplan_advanced_edit')) {
|
||||
//create the dialplan/default.xml for single tenant or dialplan/domain.xml
|
||||
require_once "includes/classes/dialplan.php";
|
||||
$dialplan = new dialplan;
|
||||
$dialplan->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$dialplan->switch_dialplan_dir = $_SESSION['switch']['dialplan']['dir'];
|
||||
$dialplan->restore_advanced_xml();
|
||||
//print_r($dialplan->result);
|
||||
}
|
||||
|
||||
if ($_POST['a'] == "save" && permission_exists('dialplan_advanced_edit')) {
|
||||
$v_content = str_replace("\r","",$_POST['code']);
|
||||
if (file_exists($_SESSION['switch']['dialplan']['dir']."/".$_SESSION['domain_name'].".xml")) {
|
||||
$fd = fopen($_SESSION['switch']['dialplan']['dir']."/".$_SESSION['domain_name'].".xml", "w");
|
||||
}
|
||||
else {
|
||||
$fd = fopen($_SESSION['switch']['dialplan']['dir']."/default.xml", "w");
|
||||
}
|
||||
fwrite($fd, $v_content);
|
||||
fclose($fd);
|
||||
$savemsg = "Saved";
|
||||
}
|
||||
|
||||
if (file_exists($_SESSION['switch']['dialplan']['dir']."/".$_SESSION['domain_name'].".xml")) {
|
||||
$fd = fopen($_SESSION['switch']['dialplan']['dir']."/".$_SESSION['domain_name'].".xml", "r");
|
||||
$v_content = fread($fd, filesize($_SESSION['switch']['dialplan']['dir']."/".$_SESSION['domain_name'].".xml"));
|
||||
}
|
||||
else {
|
||||
$fd = fopen($_SESSION['switch']['dialplan']['dir']."/default.xml", "r");
|
||||
$v_content = fread($fd, filesize($_SESSION['switch']['dialplan']['dir']."/default.xml"));
|
||||
}
|
||||
fclose($fd);
|
||||
|
||||
?>
|
||||
|
||||
<script language="Javascript">
|
||||
function sf() { document.forms[0].savetopath.focus(); }
|
||||
</script>
|
||||
<script language="Javascript" type="text/javascript" src="<?php echo PROJECT_PATH; ?>/includes/edit_area/edit_area_full.js"></script>
|
||||
<script language="Javascript" type="text/javascript">
|
||||
// initialisation
|
||||
editAreaLoader.init({
|
||||
id: "code" // id of the textarea to transform
|
||||
,start_highlight: true
|
||||
,allow_toggle: false
|
||||
,language: "en"
|
||||
,syntax: "html"
|
||||
,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
|
||||
,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
|
||||
,show_line_colors: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<div align='center'>
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="" >
|
||||
<form action="dialplan_advanced.php" method="post" name="iform" id="iform">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td align='left' width='100%'><span class="vexpl"><span class="red"><strong>Default Dialplan<br>
|
||||
</strong></span>
|
||||
The default dialplan is used to setup call destinations based on conditions and context.
|
||||
You can use the dialplan to send calls to gateways, auto attendants, external numbers, to scripts, or any destination.
|
||||
<br />
|
||||
<br />
|
||||
</td>
|
||||
<td width='10%' align='right' valign='top'><input type='submit' class='btn' value='save' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='' valign='top' align='left' nowrap>
|
||||
<textarea style="width:100%" id="code" name="code" rows="31"><?php echo htmlentities($v_content); ?></textarea>
|
||||
<br />
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left'>
|
||||
<?php
|
||||
if ($v_path_show) {
|
||||
echo "<b>location:</b> ".$_SESSION['switch']['conf']['dir']."/dialplan/default.xml\n";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td align='right'>
|
||||
<input type='hidden' name='f' value='<?php echo $_GET['f']; ?>' />
|
||||
<input type='hidden' name='a' value='save' />
|
||||
<?php
|
||||
if (permission_exists('dialplan_advanced_edit')) {
|
||||
echo "<input type='button' class='btn' value='Restore Default' onclick=\"document.location.href='dialplan_advanced.php?a=default&f=default.xml';\" />";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2'>
|
||||
<br /><br /><br />
|
||||
<br /><br /><br />
|
||||
<br /><br /><br />
|
||||
<br /><br /><br />
|
||||
<br /><br /><br />
|
||||
<br /><br /><br />
|
||||
<br /><br /><br />
|
||||
<br /><br /><br />
|
||||
<br /><br /><br />
|
||||
<br /><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
require_once "includes/paging.php";
|
||||
if (permission_exists('dialplan_add')
|
||||
|| permission_exists('inbound_route_add')
|
||||
|| permission_exists('outbound_route_add')
|
||||
|| permission_exists('time_conditions_add')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//set the http get/post variable(s) to a php variable
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$dialplan_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
|
||||
//get the dialplan data
|
||||
$dialplan_uuid = $_GET["id"];
|
||||
$sql = "select * from v_dialplans ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$database_dialplan_uuid = $row["dialplan_uuid"];
|
||||
$app_uuid = $row["app_uuid"];
|
||||
$dialplan_name = $row["dialplan_name"];
|
||||
$dialplan_order = $row["dialplan_order"];
|
||||
$dialplan_continue = $row["dialplan_continue"];
|
||||
$dialplan_context = $row["dialplan_context"];
|
||||
$dialplan_enabled = $row["dialplan_enabled"];
|
||||
$dialplan_description = "copy: ".$row["dialplan_description"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
|
||||
//copy the dialplan
|
||||
$dialplan_uuid = uuid();
|
||||
$sql = "insert into v_dialplans ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "app_uuid, ";
|
||||
$sql .= "dialplan_name, ";
|
||||
$sql .= "dialplan_order, ";
|
||||
$sql .= "dialplan_continue, ";
|
||||
$sql .= "dialplan_context, ";
|
||||
$sql .= "dialplan_enabled, ";
|
||||
$sql .= "dialplan_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'$dialplan_uuid', ";
|
||||
$sql .= "'$app_uuid', ";
|
||||
$sql .= "'".$dialplan_name."-copy', ";
|
||||
$sql .= "'$dialplan_order', ";
|
||||
$sql .= "'$dialplan_continue', ";
|
||||
$sql .= "'$dialplan_context', ";
|
||||
$sql .= "'$dialplan_enabled', ";
|
||||
$sql .= "'$dialplan_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//get the the dialplan details
|
||||
$sql = "select * from v_dialplan_details ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_uuid = '$database_dialplan_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$dialplan_detail_tag = $row["dialplan_detail_tag"];
|
||||
$dialplan_detail_order = $row["dialplan_detail_order"];
|
||||
$dialplan_detail_type = $row["dialplan_detail_type"];
|
||||
$dialplan_detail_data = $row["dialplan_detail_data"];
|
||||
|
||||
//copy the dialplan details
|
||||
$dialplan_detail_uuid = uuid();
|
||||
$sql = "insert into v_dialplan_details ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "dialplan_detail_uuid, ";
|
||||
$sql .= "dialplan_detail_tag, ";
|
||||
$sql .= "dialplan_detail_order, ";
|
||||
$sql .= "dialplan_detail_type, ";
|
||||
$sql .= "dialplan_detail_data ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'".check_str($dialplan_uuid)."', ";
|
||||
$sql .= "'".check_str($dialplan_detail_uuid)."', ";
|
||||
$sql .= "'".check_str($dialplan_detail_tag)."', ";
|
||||
$sql .= "'".check_str($dialplan_detail_order)."', ";
|
||||
$sql .= "'".check_str($dialplan_detail_type)."', ";
|
||||
$sql .= "'".check_str($dialplan_detail_data)."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
unset ($prep_statement);
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
switch ($app_uuid) {
|
||||
case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4":
|
||||
//inbound routes
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=$app_uuid\">\n";
|
||||
break;
|
||||
case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3":
|
||||
//outbound routes
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=$app_uuid\">\n";
|
||||
break;
|
||||
case "4b821450-926b-175a-af93-a03c441818b1":
|
||||
//time conditions
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=$app_uuid\">\n";
|
||||
break;
|
||||
default:
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php\">\n";
|
||||
break;
|
||||
}
|
||||
echo "<div align='center'>\n";
|
||||
echo "Copy Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('dialplan_delete')
|
||||
|| permission_exists('inbound_route_delete')
|
||||
|| permission_exists('outbound_route_delete')
|
||||
|| permission_exists('time_conditions_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$dialplan_uuid = check_str($_GET["id"]);
|
||||
}
|
||||
|
||||
if (strlen($dialplan_uuid)>0) {
|
||||
//get the dialplan data
|
||||
$sql = "select * from v_dialplans ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$database_dialplan_uuid = $row["dialplan_uuid"];
|
||||
$dialplan_context = $row["dialplan_context"];
|
||||
$app_uuid = $row["app_uuid"];
|
||||
}
|
||||
unset ($prep_statement);
|
||||
|
||||
//start the atomic transaction
|
||||
$count = $db->exec("BEGIN;");
|
||||
|
||||
//delete child data
|
||||
$sql = "delete from v_dialplan_details ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//delete parent data
|
||||
$sql = "delete from v_dialplans ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//commit the atomic transaction
|
||||
$count = $db->exec("COMMIT;");
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
switch ($app_uuid) {
|
||||
case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4":
|
||||
//inbound routes
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=$app_uuid\">\n";
|
||||
break;
|
||||
case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3":
|
||||
//outbound routes
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=$app_uuid\">\n";
|
||||
break;
|
||||
case "4b821450-926b-175a-af93-a03c441818b1":
|
||||
//time conditions
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=$app_uuid\">\n";
|
||||
break;
|
||||
default:
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php\">\n";
|
||||
break;
|
||||
}
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
?>
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('dialplan_delete')
|
||||
|| permission_exists('inbound_route_delete')
|
||||
|| permission_exists('outbound_route_delete')
|
||||
|| permission_exists('time_conditions_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$id = $_GET["id"];
|
||||
$dialplan_uuid = check_str($_REQUEST["id2"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
|
||||
//delete child data
|
||||
$sql = "";
|
||||
$sql .= "delete from v_dialplan_details ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and dialplan_detail_uuid = '$id' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=dialplan_edit.php?id=".$dialplan_uuid."\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,561 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('dialplan_add')
|
||||
|| permission_exists('dialplan_edit')
|
||||
|| permission_exists('inbound_route_add')
|
||||
|| permission_exists('inbound_route_edit')
|
||||
|| permission_exists('outbound_route_add')
|
||||
|| permission_exists('outbound_route_edit')
|
||||
|| permission_exists('time_conditions_add')
|
||||
|| permission_exists('time_conditions_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//set the action as an add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$dialplan_detail_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
$dialplan_uuid = check_str($_REQUEST["id2"]);
|
||||
}
|
||||
if (isset($_REQUEST["id2"])) {
|
||||
$dialplan_uuid = check_str($_REQUEST["id2"]);
|
||||
}
|
||||
|
||||
//get the http values and set them as php variables
|
||||
if (count($_POST)>0) {
|
||||
if (isset($_REQUEST["dialplan_uuid"])) {
|
||||
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
|
||||
}
|
||||
$dialplan_detail_tag = check_str($_POST["dialplan_detail_tag"]);
|
||||
$dialplan_detail_order = check_str($_POST["dialplan_detail_order"]);
|
||||
$dialplan_detail_type = check_str($_POST["dialplan_detail_type"]);
|
||||
$dialplan_detail_data = check_str($_POST["dialplan_detail_data"]);
|
||||
$dialplan_detail_break = check_str($_POST["dialplan_detail_break"]);
|
||||
$dialplan_detail_inline = check_str($_POST["dialplan_detail_inline"]);
|
||||
$dialplan_detail_group = check_str($_POST["dialplan_detail_group"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$dialplan_detail_uuid = check_str($_POST["dialplan_detail_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
if (strlen($dialplan_detail_tag) == 0) { $msg .= "Please provide: Tag<br>\n"; }
|
||||
if (strlen($dialplan_detail_order) == 0) { $msg .= "Please provide: Order<br>\n"; }
|
||||
//if (strlen($dialplan_detail_type) == 0) { $msg .= "Please provide: Type<br>\n"; }
|
||||
//if (strlen($dialplan_detail_data) == 0) { $msg .= "Please provide: Data<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('dialplan_add')) {
|
||||
$dialplan_detail_uuid = uuid();
|
||||
$sql = "insert into v_dialplan_details ";
|
||||
$sql .= "(";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "dialplan_detail_uuid, ";
|
||||
$sql .= "dialplan_detail_tag, ";
|
||||
$sql .= "dialplan_detail_order, ";
|
||||
$sql .= "dialplan_detail_type, ";
|
||||
$sql .= "dialplan_detail_data, ";
|
||||
$sql .= "dialplan_detail_break, ";
|
||||
$sql .= "dialplan_detail_inline, ";
|
||||
$sql .= "dialplan_detail_group, ";
|
||||
$sql .= "domain_uuid ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$dialplan_uuid', ";
|
||||
$sql .= "'$dialplan_detail_uuid', ";
|
||||
$sql .= "'$dialplan_detail_tag', ";
|
||||
$sql .= "'$dialplan_detail_order', ";
|
||||
$sql .= "'$dialplan_detail_type', ";
|
||||
$sql .= "'$dialplan_detail_data', ";
|
||||
$sql .= "'$dialplan_detail_break', ";
|
||||
$sql .= "'$dialplan_detail_inline', ";
|
||||
if (strlen($dialplan_detail_group) == 0) {
|
||||
$sql .= "null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "'$dialplan_detail_group', ";
|
||||
}
|
||||
$sql .= "'".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=dialplan_edit.php?id=".$dialplan_uuid."\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update" && permission_exists('dialplan_edit')) {
|
||||
$sql = "update v_dialplan_details set ";
|
||||
$sql .= "dialplan_uuid = '$dialplan_uuid', ";
|
||||
$sql .= "dialplan_detail_tag = '$dialplan_detail_tag', ";
|
||||
$sql .= "dialplan_detail_order = '$dialplan_detail_order', ";
|
||||
$sql .= "dialplan_detail_type = '$dialplan_detail_type', ";
|
||||
$sql .= "dialplan_detail_data = '$dialplan_detail_data', ";
|
||||
$sql .= "dialplan_detail_break = '$dialplan_detail_break', ";
|
||||
$sql .= "dialplan_detail_inline = '$dialplan_detail_inline', ";
|
||||
if (strlen($dialplan_detail_group) == 0) {
|
||||
$sql .= "dialplan_detail_group = null ";
|
||||
}
|
||||
else {
|
||||
$sql .= "dialplan_detail_group = '$dialplan_detail_group' ";
|
||||
}
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_detail_uuid = '$dialplan_detail_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
require_once "includes/header.php";
|
||||
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=dialplan_edit.php?id=".$dialplan_uuid."\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Update Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true") {
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$dialplan_detail_uuid = $_GET["id"];
|
||||
$sql = "select * from v_dialplan_details ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and dialplan_detail_uuid = '$dialplan_detail_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$dialplan_uuid = $row["dialplan_uuid"];
|
||||
$dialplan_detail_tag = $row["dialplan_detail_tag"];
|
||||
$dialplan_detail_order = $row["dialplan_detail_order"];
|
||||
$dialplan_detail_type = $row["dialplan_detail_type"];
|
||||
$dialplan_detail_data = $row["dialplan_detail_data"];
|
||||
$dialplan_detail_break = $row["dialplan_detail_break"];
|
||||
$dialplan_detail_inline = $row["dialplan_detail_inline"];
|
||||
$dialplan_detail_group = $row["dialplan_detail_group"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' width='30%' nowrap><b>Dialplan Detail</b></td>\n";
|
||||
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='dialplan_edit.php?id=".$dialplan_uuid."'\" value='Back'></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function public_include_details_tag_onchange() {
|
||||
var dialplan_detail_tag = document.getElementById("form_tag").value;
|
||||
if (dialplan_detail_tag == "condition") {
|
||||
document.getElementById("label_field_type").innerHTML = "Field";
|
||||
document.getElementById("label_field_data").innerHTML = "Expression";
|
||||
}
|
||||
else if (dialplan_detail_tag == "regex") {
|
||||
document.getElementById("label_field_type").innerHTML = "Field";
|
||||
document.getElementById("label_field_data").innerHTML = "Expression";
|
||||
}
|
||||
else if (dialplan_detail_tag == "action") {
|
||||
document.getElementById("label_field_type").innerHTML = "Application";
|
||||
document.getElementById("label_field_data").innerHTML = "Data";
|
||||
}
|
||||
else if (dialplan_detail_tag == "anti-action") {
|
||||
document.getElementById("label_field_type").innerHTML = "Application";
|
||||
document.getElementById("label_field_data").innerHTML = "Data";
|
||||
}
|
||||
else if (dialplan_detail_tag == "param") {
|
||||
document.getElementById("label_field_type").innerHTML = "Name";
|
||||
document.getElementById("label_field_data").innerHTML = "Value";
|
||||
}
|
||||
if (dialplan_detail_tag == "") {
|
||||
document.getElementById("label_field_type").innerHTML = "Type";
|
||||
document.getElementById("label_field_data").innerHTML = "Data";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " Tag:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name='dialplan_detail_tag' class='formfld' id='form_tag' onchange='public_include_details_tag_onchange();'>\n";
|
||||
echo " <option></option>\n";
|
||||
switch ($dialplan_detail_tag) {
|
||||
case "condition":
|
||||
echo " <option selected='yes'>condition</option>\n";
|
||||
echo " <option>action</option>\n";
|
||||
echo " <option>anti-action</option>\n";
|
||||
echo " <option>regex</option>\n";
|
||||
//echo " <option>param</option>\n";
|
||||
break;
|
||||
case "regex":
|
||||
echo " <option>condition</option>\n";
|
||||
echo " <option>action</option>\n";
|
||||
echo " <option>anti-action</option>\n";
|
||||
echo " <option selected='yes'>regex</option>\n";
|
||||
//echo " <option>param</option>\n";
|
||||
break;
|
||||
case "action":
|
||||
echo " <option>condition</option>\n";
|
||||
echo " <option selected='yes'>action</option>\n";
|
||||
echo " <option>anti-action</option>\n";
|
||||
echo " <option>regex</option>\n";
|
||||
//echo " <option>param</option>\n";
|
||||
break;
|
||||
case "anti-action":
|
||||
echo " <option>condition</option>\n";
|
||||
echo " <option>action</option>\n";
|
||||
echo " <option selected='yes'>anti-action</option>\n";
|
||||
echo " <option>regex</option>\n";
|
||||
//echo " <option>param</option>\n";
|
||||
break;
|
||||
case "param":
|
||||
echo " <option>condition</option>\n";
|
||||
echo " <option>action</option>\n";
|
||||
echo " <option>anti-action</option>\n";
|
||||
echo " <option>regex</option>\n";
|
||||
//echo " <option selected='yes'>param</option>\n";
|
||||
break;
|
||||
default:
|
||||
echo " <option>condition</option>\n";
|
||||
echo " <option>action</option>\n";
|
||||
echo " <option>anti-action</option>\n";
|
||||
echo " <option>regex</option>\n";
|
||||
//echo " <option>param</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
|
||||
//condition
|
||||
//field expression
|
||||
//action
|
||||
//application
|
||||
//data
|
||||
//antiaction
|
||||
//application
|
||||
//data
|
||||
//param
|
||||
//name
|
||||
//value
|
||||
//echo " <input class='formfld' type='text' name='dialplan_detail_tag' maxlength='255' value=\"$dialplan_detail_tag\">\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " Order:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name='dialplan_detail_order' class='formfld'>\n";
|
||||
if (strlen($dialplan_detail_order)> 0) {
|
||||
echo " <option selected='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";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
?>
|
||||
<script language="javascript">
|
||||
var Objs;
|
||||
|
||||
function changeToInput_dialplan_detail_type(obj){
|
||||
tb=document.createElement('INPUT');
|
||||
tb.type='text';
|
||||
tb.name=obj.name;
|
||||
tb.className='formfld';
|
||||
tb.setAttribute('id', 'ivr_menu_option_param');
|
||||
tb.setAttribute('style', '');
|
||||
tb.value=obj.options[obj.selectedIndex].value;
|
||||
document.getElementById('btn_select_to_input_dialplan_detail_type').style.visibility = 'hidden';
|
||||
tbb=document.createElement('INPUT');
|
||||
tbb.setAttribute('class', 'btn');
|
||||
tbb.type='button';
|
||||
tbb.value='<';
|
||||
tbb.objs=[obj,tb,tbb];
|
||||
tbb.onclick=function(){ Replaceivr_menu_option_param(this.objs); }
|
||||
obj.parentNode.insertBefore(tb,obj);
|
||||
obj.parentNode.insertBefore(tbb,obj);
|
||||
obj.parentNode.removeChild(obj);
|
||||
Replaceivr_menu_option_param(this.objs);
|
||||
}
|
||||
|
||||
function Replaceivr_menu_option_param(obj){
|
||||
obj[2].parentNode.insertBefore(obj[0],obj[2]);
|
||||
obj[0].parentNode.removeChild(obj[1]);
|
||||
obj[0].parentNode.removeChild(obj[2]);
|
||||
document.getElementById('btn_select_to_input_dialplan_detail_type').style.visibility = 'visible';
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Type:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo "<select name='dialplan_detail_type' id='dialplan_detail_type' class='formfld' onchange='changeToInput_dialplan_detail_type(this);'>\n";
|
||||
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='conditions or regex'>\n";
|
||||
echo " <option value='context'>context</option>\n";
|
||||
echo " <option value='username'>username</option>\n";
|
||||
echo " <option value='rdnis'>rdnis</option>\n";
|
||||
echo " <option value='destination_number'>destination_number</option>\n";
|
||||
echo " <option value='dialplan'>dialplan</option>\n";
|
||||
echo " <option value='caller_id_name'>caller_id_name</option>\n";
|
||||
echo " <option value='caller_id_number'>caller_id_number</option>\n";
|
||||
echo " <option value='ani'>ani</option>\n";
|
||||
echo " <option value='ani2'>ani2</option>\n";
|
||||
echo " <option value='uuid'>uuid</option>\n";
|
||||
echo " <option value='source'>source</option>\n";
|
||||
echo " <option value='chan_name'>chan_name</option>\n";
|
||||
echo " <option value='network_addr'>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='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 "<input type='button' id='btn_select_to_input_dialplan_detail_type' class='btn' name='' alt='back' onclick='changeToInput_dialplan_detail_type(document.getElementById(\"dialplan_detail_type\"));this.style.visibility = \"hidden\";' value='<'>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Data:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='dialplan_detail_data' value=\"".htmlspecialchars($dialplan_detail_data)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Group:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name='dialplan_detail_group' class='formfld'>\n";
|
||||
echo " <option></option>\n";
|
||||
if (strlen($dialplan_detail_group)> 0) {
|
||||
echo " <option selected='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";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($action == "update") {
|
||||
if ($dialplan_detail_tag == "condition") {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Break:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name='dialplan_detail_break' class='formfld'>\n";
|
||||
echo " <option></option>\n";
|
||||
if ($dialplan_detail_break == "on-true") {
|
||||
echo " <option selected='selected' value='on-true'>on-true</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='on-true'>on-true</option>\n";
|
||||
}
|
||||
if ($dialplan_detail_break == "on-false") {
|
||||
echo " <option selected='selected' value='on-false'>on-false</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='on-false'>on-false</option>\n";
|
||||
}
|
||||
if ($dialplan_detail_break == "always") {
|
||||
echo " <option selected='selected' value='always'>always</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='always'>always</option>\n";
|
||||
}
|
||||
if ($dialplan_detail_break == "never") {
|
||||
echo " <option selected='selected' value='never'>never</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='never'>never</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
if ($dialplan_detail_tag == "action") {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Inline:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name='dialplan_detail_inline' class='formfld'>\n";
|
||||
echo " <option></option>\n";
|
||||
if ($dialplan_detail_inline == "true") {
|
||||
echo " <option selected='selected' value='true'>true</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>true</option>\n";
|
||||
}
|
||||
if ($dialplan_detail_inline == "false") {
|
||||
echo " <option selected='selected' value='false'>false</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>false</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='dialplan_detail_uuid' value='$dialplan_detail_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>\n";
|
||||
echo "</form>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,592 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
require_once "includes/paging.php";
|
||||
if (permission_exists('dialplan_add')
|
||||
|| permission_exists('dialplan_edit')
|
||||
|| permission_exists('inbound_route_add')
|
||||
|| permission_exists('inbound_route_edit')
|
||||
|| permission_exists('outbound_route_add')
|
||||
|| permission_exists('outbound_route_edit')
|
||||
|| permission_exists('time_conditions_add')
|
||||
|| permission_exists('time_conditions_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//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
|
||||
if (count($_POST)>0) {
|
||||
$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"]);
|
||||
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"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
if (strlen($dialplan_name) == 0) { $msg .= "Please provide: Extension Name<br>\n"; }
|
||||
if (strlen($dialplan_order) == 0) { $msg .= "Please provide: Order<br>\n"; }
|
||||
if (strlen($dialplan_continue) == 0) { $msg .= "Please provide: Continue<br>\n"; }
|
||||
if (strlen($dialplan_context) == 0) { $msg .= "Please provide: Context<br>\n"; }
|
||||
if (strlen($dialplan_enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; }
|
||||
//if (strlen($dialplan_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//remove the invalid characters from the extension name
|
||||
$dialplan_name = str_replace(" ", "_", $dialplan_name);
|
||||
$dialplan_name = str_replace("/", "", $dialplan_name);
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('dialplan_add')) {
|
||||
//add the data into the database
|
||||
$dialplan_context = $_SESSION['context'];
|
||||
$dialplan_uuid = uuid();
|
||||
$sql = "insert into v_dialplans ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "app_uuid, ";
|
||||
$sql .= "dialplan_name, ";
|
||||
$sql .= "dialplan_number, ";
|
||||
$sql .= "dialplan_order, ";
|
||||
$sql .= "dialplan_continue, ";
|
||||
$sql .= "dialplan_context, ";
|
||||
$sql .= "dialplan_enabled, ";
|
||||
$sql .= "dialplan_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'$dialplan_uuid', ";
|
||||
$sql .= "'742714e5-8cdf-32fd-462c-cbe7e3d655db', ";
|
||||
$sql .= "'$dialplan_name', ";
|
||||
$sql .= "'$dialplan_number', ";
|
||||
$sql .= "'$dialplan_order', ";
|
||||
$sql .= "'$dialplan_continue', ";
|
||||
$sql .= "'$dialplan_context', ";
|
||||
$sql .= "'$dialplan_enabled', ";
|
||||
$sql .= "'$dialplan_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
switch ($app_uuid) {
|
||||
case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4":
|
||||
//inbound routes
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=$app_uuid\">\n";
|
||||
break;
|
||||
case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3":
|
||||
//outbound routes
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=$app_uuid\">\n";
|
||||
break;
|
||||
case "4b821450-926b-175a-af93-a03c441818b1":
|
||||
//time conditions
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=$app_uuid\">\n";
|
||||
break;
|
||||
default:
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php\">\n";
|
||||
break;
|
||||
}
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update" && permission_exists('dialplan_edit')) {
|
||||
//update the database
|
||||
$sql = "update v_dialplans set ";
|
||||
$sql .= "dialplan_name = '$dialplan_name', ";
|
||||
$sql .= "dialplan_number = '$dialplan_number', ";
|
||||
$sql .= "dialplan_order = '$dialplan_order', ";
|
||||
$sql .= "dialplan_continue = '$dialplan_continue', ";
|
||||
$sql .= "dialplan_context = '$dialplan_context', ";
|
||||
$sql .= "dialplan_enabled = '$dialplan_enabled', ";
|
||||
$sql .= "dialplan_description = '$dialplan_description' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
switch ($app_uuid) {
|
||||
case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4":
|
||||
//inbound routes
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=$app_uuid\">\n";
|
||||
break;
|
||||
case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3":
|
||||
//outbound routes
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=$app_uuid\">\n";
|
||||
break;
|
||||
case "4b821450-926b-175a-af93-a03c441818b1":
|
||||
//time conditions
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=$app_uuid\">\n";
|
||||
break;
|
||||
default:
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php\">\n";
|
||||
break;
|
||||
}
|
||||
echo "<div align='center'>\n";
|
||||
echo "Update Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$dialplan_uuid = $_GET["id"];
|
||||
$sql = "select * from v_dialplans ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$app_uuid = $row["app_uuid"];
|
||||
$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);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
|
||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' width='30%'>\n";
|
||||
echo" <span class=\"vexpl\"><strong>Dialplan</strong></span><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " <td width='70%' align='right'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='copy' onclick=\"if (confirm('Do you really want to copy this?')){window.location='dialplan_copy.php?id=".$row['dialplan_uuid']."';}\" value='Copy'>\n";
|
||||
switch ($app_uuid) {
|
||||
case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4":
|
||||
//inbound routes
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='dialplans.php?app_uuid=$app_uuid'\" value='Back'>\n";
|
||||
break;
|
||||
case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3":
|
||||
//outbound routes
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='dialplans.php?app_uuid=$app_uuid'\" value='Back'>\n";
|
||||
break;
|
||||
case "4b821450-926b-175a-af93-a03c441818b1":
|
||||
//time conditions
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='dialplans.php?app_uuid=$app_uuid'\" value='Back'>\n";
|
||||
break;
|
||||
default:
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='dialplans.php'\" value='Back'>\n";
|
||||
break;
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>\n";
|
||||
echo " Dialplan Include general settings. \n";
|
||||
echo " \n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>";
|
||||
echo "<br />\n";
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Name:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='dialplan_name' maxlength='255' value=\"".htmlspecialchars($dialplan_name)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Number:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='dialplan_number' maxlength='255' value=\"".htmlspecialchars($dialplan_number)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Context:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='dialplan_context' maxlength='255' value=\"$dialplan_context\">\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Continue:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='dialplan_continue'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($dialplan_continue == "true") {
|
||||
echo " <option value='true' selected='selected'>true</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>true</option>\n";
|
||||
}
|
||||
if ($dialplan_continue == "false") {
|
||||
echo " <option value='false' selected='selected'>false</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>false</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Order:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name='dialplan_order' class='formfld'>\n";
|
||||
//echo " <option></option>\n";
|
||||
if (strlen(htmlspecialchars($dialplan_order))> 0) {
|
||||
echo " <option selected='yes' value='".htmlspecialchars($dialplan_order)."'>".htmlspecialchars($dialplan_order)."</option>\n";
|
||||
}
|
||||
$i=0;
|
||||
while($i<=999) {
|
||||
if (strlen($i) == 1) {
|
||||
echo " <option value='00$i'>00$i</option>\n";
|
||||
}
|
||||
if (strlen($i) == 2) {
|
||||
echo " <option value='0$i'>0$i</option>\n";
|
||||
}
|
||||
if (strlen($i) == 3) {
|
||||
echo " <option value='$i'>$i</option>\n";
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Enabled:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='dialplan_enabled'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($dialplan_enabled == "true") {
|
||||
echo " <option value='true' SELECTED >true</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>true</option>\n";
|
||||
}
|
||||
if ($dialplan_enabled == "false") {
|
||||
echo " <option value='false' SELECTED >false</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>false</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Description:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <textarea class='formfld' name='dialplan_description' rows='4'>".htmlspecialchars($dialplan_description)."</textarea>\n";
|
||||
echo "<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//dialplan details
|
||||
if ($action == "update") {
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
|
||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'><p><span class=\"vexpl\"><span class=\"red\"><strong>Conditions and Actions<br />\n";
|
||||
echo " </strong></span>\n";
|
||||
echo " The following conditions, actions and anti-actions are used in the dialplan to direct \n";
|
||||
echo " call flow. Each is processed in order that it is given. \n";
|
||||
echo " Use as many conditions, actions or anti-actions as needed. \n";
|
||||
echo " </span></p></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>";
|
||||
echo "<br />\n";
|
||||
|
||||
$sql = " select * from v_dialplan_details ";
|
||||
$sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= " and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$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);
|
||||
|
||||
//define the alternating row styles
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
//display the results
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th align='center' width='90px;'>Tag</th>\n";
|
||||
echo "<th align='center' width='150px;'>Type</th>\n";
|
||||
echo "<th align='center' width='70%'>Data</th>\n";
|
||||
echo "<th align='center'>Order</th>\n";
|
||||
//echo "<th align='center'>Group</th>\n";
|
||||
echo "<td align='right' width='42'>\n";
|
||||
echo " <a href='dialplan_details_edit.php?id2=".$dialplan_uuid."' alt='add'>$v_link_label_add</a>\n";
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
$x = 0;
|
||||
foreach($details as $group) {
|
||||
if ($x > 0) {
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap='nowrap'> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
echo " <a href='dialplan_details_edit.php?id2=".$dialplan_uuid."' alt='add'>$v_link_label_add</a>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th align='center' width='90px;'>Tag</th>\n";
|
||||
echo "<th align='center' width='150px;'>Type</th>\n";
|
||||
echo "<th align='center' width='70%'>Data</th>\n";
|
||||
echo "<th align='center'>Order</th>\n";
|
||||
//echo "<th align='center'>Group</th>\n";
|
||||
echo "<td align='right' width='42'>\n";
|
||||
echo " <a href='dialplan_details_edit.php?id2=".$dialplan_uuid."' alt='add'>$v_link_label_add</a>\n";
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
}
|
||||
|
||||
foreach($group as $row) {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row['dialplan_detail_tag']."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row['dialplan_detail_type']."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".wordwrap($row['dialplan_detail_data'],180,"<br>",1)."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row['dialplan_detail_order']."</td>\n";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'> ".$row['dialplan_detail_group']."</td>\n";
|
||||
echo " <td valign='top' align='right' nowrap='nowrap'>\n";
|
||||
echo " <a href='dialplan_details_edit.php?id=".$row['dialplan_detail_uuid']."&id2=".$dialplan_uuid."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
echo " <a href='dialplan_details_delete.php?id=".$row['dialplan_detail_uuid']."&id2=".$dialplan_uuid."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
$x++;
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap='nowrap'> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
echo " <a href='dialplan_details_edit.php?id2=".$dialplan_uuid."' alt='add'>$v_link_label_add</a>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
} //end if update
|
||||
|
||||
//show the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,348 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('dialplan_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//includes
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
//set the http values as php variables
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
$dialplan_context = $_GET["dialplan_context"];
|
||||
$app_uuid = $_GET["app_uuid"];
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo "<td align=\"center\">\n";
|
||||
echo "<br />";
|
||||
|
||||
echo " <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'>\n";
|
||||
echo " <span class=\"vexpl\">\n";
|
||||
if ($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4") {
|
||||
echo " <strong>Inbound Routes</strong>\n";
|
||||
}
|
||||
elseif ($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3") {
|
||||
echo " <strong>Outbound Routes</strong>\n";
|
||||
}
|
||||
elseif ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1") {
|
||||
echo " <strong>Time Conditions</strong>\n";
|
||||
}
|
||||
else {
|
||||
echo " <strong>Dialplan</strong>\n";
|
||||
}
|
||||
|
||||
echo " </span>\n";
|
||||
echo " </td>\n";
|
||||
echo " <td align='right'>\n";
|
||||
if (permission_exists('dialplan_advanced_view') && strlen($app_uuid) == 0) {
|
||||
echo " <input type='button' class='btn' value='advanced' onclick=\"document.location.href='dialplan_advanced.php';\">\n";
|
||||
}
|
||||
else {
|
||||
echo " \n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>\n";
|
||||
echo " <span class=\"vexpl\">\n";
|
||||
|
||||
if ($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4") {
|
||||
//inbound routes
|
||||
echo " Route incoming calls to destinations based on one \n";
|
||||
echo " or more conditions. It can send incoming calls to an IVR Menu, \n";
|
||||
echo " Call Group, Extension, External Number, Script. Order is important when an \n";
|
||||
echo " anti-action is used or when there are multiple conditions that match. \n";
|
||||
}
|
||||
elseif ($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3") {
|
||||
//outbound routes
|
||||
echo " Route outbound calls to gateways, tdm, enum and more. \n";
|
||||
echo " When a call matches the conditions the call to outbound routes . \n";
|
||||
}
|
||||
elseif ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1") {
|
||||
//time conditions
|
||||
echo " Time conditions route calls based on time conditions. You can \n";
|
||||
echo " use time conditions to send calls to an IVR Menu, External numbers, \n";
|
||||
echo " Scripts, or other destinations. \n";
|
||||
}
|
||||
else {
|
||||
//dialplan
|
||||
if (if_group("superadmin")) {
|
||||
echo " The dialplan is used to setup call destinations based on conditions and context.\n";
|
||||
echo " You can use the dialplan to send calls to gateways, auto attendants, external numbers,\n";
|
||||
echo " to scripts, or any destination.\n";
|
||||
}
|
||||
else {
|
||||
echo " The dialplan provides a view of some of the feature codes, as well as the IVR Menu, \n";
|
||||
echo " Conferences, Queues and other destinations.\n";
|
||||
}
|
||||
}
|
||||
echo " </span>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>";
|
||||
|
||||
echo " <br />";
|
||||
echo " <br />";
|
||||
|
||||
//get the number of rows in the dialplan
|
||||
$sql = "";
|
||||
$sql .= " select count(*) as num_rows from v_dialplans ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
if (strlen($app_uuid) == 0) {
|
||||
//hide inbound routes
|
||||
$sql .= "and app_uuid <> 'c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4' ";
|
||||
//hide outbound routes
|
||||
$sql .= "and app_uuid <> '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' ";
|
||||
}
|
||||
else {
|
||||
$sql .= "and app_uuid = '".$app_uuid."' ";
|
||||
}
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
unset($prep_statement, $result);
|
||||
|
||||
$rows_per_page = 150;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
$sql = "";
|
||||
$sql .= " select * from v_dialplans ";
|
||||
$sql .= " where domain_uuid = '$domain_uuid' ";
|
||||
if (strlen($app_uuid) == 0) {
|
||||
//hide inbound routes
|
||||
$sql .= "and app_uuid <> 'c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4' ";
|
||||
//hide outbound routes
|
||||
$sql .= "and app_uuid <> '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' ";
|
||||
}
|
||||
else {
|
||||
$sql .= "and app_uuid = '".$app_uuid."' ";
|
||||
}
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } else { $sql .= "order by dialplan_order asc, dialplan_name asc "; }
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('dialplan_name', 'Name', $order_by, $order);
|
||||
echo th_order_by('dialplan_number', 'Number', $order_by, $order);
|
||||
echo th_order_by('dialplan_order', 'Order', $order_by, $order);
|
||||
echo th_order_by('dialplan_enabled', 'Enabled', $order_by, $order);
|
||||
echo th_order_by('dialplan_description', 'Description', $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
if ($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4") {
|
||||
if (permission_exists('inbound_route_add')) {
|
||||
echo " <a href='".PROJECT_PATH."/app/dialplan_inbound/dialplan_inbound_add.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
}
|
||||
elseif ($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3") {
|
||||
if (permission_exists('outbound_route_add')) {
|
||||
echo " <a href='".PROJECT_PATH."/app/dialplan_outbound/dialplan_outbound_add.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
}
|
||||
elseif ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1") {
|
||||
if (permission_exists('time_conditions_add')) {
|
||||
echo " <a href='".PROJECT_PATH."/app/time_conditions/time_condition_add.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (permission_exists('dialplan_add')) {
|
||||
echo " <a href='dialplan_add.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
$app_uuid = $row['app_uuid'];
|
||||
if (strlen($row['dialplan_number']) == 0) {
|
||||
$sql = "";
|
||||
$sql .= "select * from v_dialplan_details ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and dialplan_uuid = '".$row['dialplan_uuid']."' ";
|
||||
$sql .= "and dialplan_detail_type = 'destination_number' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$tmp_result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($tmp_result as &$tmp) {
|
||||
//prepare the extension number
|
||||
preg_match_all('/[\|0-9\*]/',$tmp["dialplan_detail_data"], $tmp_match);
|
||||
$dialplan_number = implode("",$tmp_match[0]);
|
||||
$dialplan_number = str_replace("|", " ", $dialplan_number);
|
||||
$row['dialplan_number'] = $dialplan_number;
|
||||
//update the extension number
|
||||
$sql = "update v_dialplans set ";
|
||||
$sql .= "dialplan_number = '$dialplan_number', ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and dialplan_uuid = '".$row['dialplan_uuid']."'";
|
||||
$db->exec($sql);
|
||||
unset($sql);
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row['dialplan_name']."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row['dialplan_number']."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row['dialplan_order']."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'> ".$row['dialplan_enabled']."</td>\n";
|
||||
echo " <td valign='top' class='row_stylebg' width='30%'>".$row['dialplan_description']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
if ($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4") {
|
||||
if (permission_exists('inbound_route_edit')) {
|
||||
echo " <a href='dialplan_edit.php?id=".$row['dialplan_uuid']."&app_uuid=$app_uuid' alt='edit'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('inbound_route_delete')) {
|
||||
echo " <a href='dialplan_delete.php?id=".$row['dialplan_uuid']."&app_uuid=$app_uuid' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
}
|
||||
elseif ($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3") {
|
||||
if (permission_exists('outbound_route_edit')) {
|
||||
echo " <a href='dialplan_edit.php?id=".$row['dialplan_uuid']."&app_uuid=$app_uuid' alt='edit'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('outbound_route_delete')) {
|
||||
echo " <a href='dialplan_delete.php?id=".$row['dialplan_uuid']."&app_uuid=$app_uuid' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
}
|
||||
elseif ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1") {
|
||||
if (permission_exists('time_conditions_edit')) {
|
||||
echo " <a href='dialplan_edit.php?id=".$row['dialplan_uuid']."&app_uuid=$app_uuid' alt='edit'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('time_conditions_delete')) {
|
||||
echo " <a href='dialplan_delete.php?id=".$row['dialplan_uuid']."&app_uuid=$app_uuid' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (permission_exists('dialplan_edit')) {
|
||||
echo " <a href='dialplan_edit.php?id=".$row['dialplan_uuid']."&app_uuid=$app_uuid' alt='edit'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('dialplan_delete')) {
|
||||
echo " <a href='dialplan_delete.php?id=".$row['dialplan_uuid']."&app_uuid=$app_uuid' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
echo " ";
|
||||
if ($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4") {
|
||||
if (permission_exists('inbound_route_add')) {
|
||||
echo " <a href='".PROJECT_PATH."/app/dialplan_inbound/dialplan_inbound_add.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
}
|
||||
elseif ($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3") {
|
||||
if (permission_exists('outbound_route_add')) {
|
||||
echo " <a href='".PROJECT_PATH."/app/dialplan_outbound/dialplan_outbound_add.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
}
|
||||
elseif ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1") {
|
||||
if (permission_exists('time_conditions_add')) {
|
||||
echo " <a href='".PROJECT_PATH."/app/time_conditions/time_condition_add.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (permission_exists('dialplan_add')) {
|
||||
echo " <a href='dialplan_add.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='5' align='left'>\n";
|
||||
echo "<br />\n";
|
||||
if ($v_path_show) {
|
||||
echo $_SESSION['switch']['dialplan']['dir'];
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
|
||||
require_once "includes/footer.php";
|
||||
unset ($result_count);
|
||||
unset ($result);
|
||||
unset ($key);
|
||||
unset ($val);
|
||||
unset ($c);
|
||||
?>
|
||||
@@ -0,0 +1,5 @@
|
||||
<extension name="call-direction" continue="true" app_uuid="3780f814-5543-4350-b65d-563512d1fe71">
|
||||
<condition field="${call_direction}" expression="^(inbound|outbound|local)$">
|
||||
<anti-action application="set" data="call_direction=local"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,7 @@
|
||||
<extension name="global-intercept" app_uuid="59aff1f2-719c-403e-9306-5eb3a0cbd16c" enabled="false">
|
||||
<condition field="destination_number" expression="^\*886$">
|
||||
<action application="answer"/>
|
||||
<action application="intercept" data="${hash(select/${domain_name}-last_dial/global)}"/>
|
||||
<action application="sleep" data="2000"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,7 @@
|
||||
<extension name="group-intercept" app_uuid="15332e83-12f5-44d3-8472-633736eb4b9b">
|
||||
<condition field="destination_number" expression="^\*8$">
|
||||
<action application="answer"/>
|
||||
<action application="intercept" data="${hash(select/${domain_name}-last_dial/${call_group})}"/>
|
||||
<action application="sleep" data="2000"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,5 @@
|
||||
<extension name="redial" app_uuid="459da8c1-073a-458e-ae7e-8194342f9583">
|
||||
<condition field="destination_number" expression="^(redial|\*870)$">
|
||||
<action application="transfer" data="${hash(select/${domain_name}-last_dial/${caller_id_number})}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,9 @@
|
||||
<extension name="page" app_uuid="2011c518-696d-4878-a9b2-b217b6311311" enabled="false">
|
||||
<condition field="destination_number" expression="^\*724$" >
|
||||
<action application="set" data="caller_id_name=Page" />
|
||||
<action application="set" data="caller_id_number=" />
|
||||
<action application="set" data="pin_number=" />
|
||||
<action application="set" data="extension_list=1001-1003,1005" />
|
||||
<action application="lua" data="page.lua" />
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,11 @@
|
||||
<extension name="global" continue="true" app_uuid="34dd307b-fffe-4ead-990c-3d070e288126">
|
||||
<condition field="${call_debug}" expression="^true$" break="never">
|
||||
<action application="info"/>
|
||||
</condition>
|
||||
<condition>
|
||||
<action application="hash" data="insert/${domain_name}-spymap/${caller_id_number}/${uuid}"/>
|
||||
<action application="hash" data="insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}"/>
|
||||
<action application="hash" data="insert/${domain_name}-last_dial/global/${uuid}"/>
|
||||
<action application="set" data="RFC2822_DATE=${strftime(%a, %d %b %Y %T %z)}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,6 @@
|
||||
<extension name="eavesdrop" app_uuid="e944af7e-8fcc-429b-a32f-0dcdce1585d8" enabled="false">
|
||||
<condition field="destination_number" expression="^\*88(\d{2,7})$|^\*0(.*)$">
|
||||
<action application="answer"/>
|
||||
<action application="eavesdrop" data="${hash(select/${domain_name}-spymap/$1)}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,8 @@
|
||||
<extension name="call_privacy" app_uuid="eb478e66-f637-4ae7-b1eb-9a7b87a1bd9e">
|
||||
<condition field="destination_number" expression="^\*67(\d+)$">
|
||||
<action application="privacy" data="full"/>
|
||||
<action application="set" data="sip_h_Privacy=id"/>
|
||||
<action application="set" data="privacy=yes"/>
|
||||
<action application="transfer" data="$1 XML default"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,5 @@
|
||||
<extension name="call_return" app_uuid="fa516204-920f-4802-8bb1-04c6a010bfe1">
|
||||
<condition field="destination_number" expression="^\*69$|^lcr$">
|
||||
<action application="transfer" data="${hash(select/${domain_name}-call_return/${caller_id_number})}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,7 @@
|
||||
<extension name="intercept-ext" app_uuid="2b7b2f82-edfe-4339-8cc5-7d0cf36e1e68">
|
||||
<condition field="destination_number" expression="^\*\*(\d+)$">
|
||||
<action application="answer"/>
|
||||
<action application="intercept" data="${hash(select/${domain_name}-last_dial_ext/$1)}"/>
|
||||
<action application="sleep" data="2000"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,7 @@
|
||||
<extension name="extension-intercom" app_uuid="1b224444-de8b-448d-b2d1-19feaac3effa" enabled="false">
|
||||
<condition field="destination_number" expression="^\*8(\d{2,7})$">
|
||||
<action application="set" data="dialed_extension=$1"/>
|
||||
<action application="export" data="sip_auto_answer=true"/>
|
||||
<action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,9 @@
|
||||
<extension name="send_to_voicemail" app_uuid="001d5dab-e0c6-4352-8f06-e9986ee7b0d8">
|
||||
<condition field="destination_number" expression="^\*99(\d{2,7})$">
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="set" data="dialed_extension=$1"/>
|
||||
<action application="export" data="dialed_extension=$1"/>
|
||||
<action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,8 @@
|
||||
<!-- voicemail main extension, used when * is pressed from an external number -->
|
||||
<extension name="vmain" app_uuid="d085a1e3-c53a-4480-9ca6-6a362899a681">
|
||||
<condition field="destination_number" expression="^vmain$|^4000$|^\*98$">
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="voicemail" data="check default ${domain_name}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,8 @@
|
||||
<!-- voicemail provide user extension -->
|
||||
<extension name="vmain_user" app_uuid="5d47ab13-f25d-4f62-a68e-2a7d945d05b7">
|
||||
<condition field="destination_number" expression="^\*97$">
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="voicemail" data="check default ${domain_name} ${sip_from_user}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,6 @@
|
||||
<extension name="delay_echo" app_uuid="fe638409-b347-46d7-9aca-489561df8b35">
|
||||
<condition field="destination_number" expression="^\*9195$">
|
||||
<action application="answer"/>
|
||||
<action application="delay_echo" data="5000"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,6 @@
|
||||
<extension name="echo" app_uuid="1f894dfb-0567-4e20-9026-d538bbaa5261">
|
||||
<condition field="destination_number" expression="^\*9196$">
|
||||
<action application="answer"/>
|
||||
<action application="echo"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,6 @@
|
||||
<extension name="milliwatt" app_uuid="296acca3-d30f-42a0-ba90-5af2208ad7f8">
|
||||
<condition field="destination_number" expression="^\*9197$">
|
||||
<action application="answer"/>
|
||||
<action application="playback" data="tone_stream://%(251,0,1004);loops=-1"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,6 @@
|
||||
<extension name="tone_stream" app_uuid="98ccdb0b-c074-4f74-b28a-9528372faa7d">
|
||||
<condition field="destination_number" expression="^\*9198$">
|
||||
<action application="answer"/>
|
||||
<action application="playback" data="tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,13 @@
|
||||
<extension name="hold_music" app_uuid="b824b88a-e6da-486e-9f17-7b93cbaa318e">
|
||||
<condition field="destination_number" expression="^\*9664$"/>
|
||||
<condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$">
|
||||
<action application="answer"/>
|
||||
<action application="execute_extension" data="is_secure XML features"/>
|
||||
<action application="playback" data="$${hold_music}"/>
|
||||
<anti-action application="set" data="zrtp_secure_media=true"/>
|
||||
<anti-action application="answer"/>
|
||||
<anti-action application="playback" data="silence_stream://2000"/>
|
||||
<anti-action application="execute_extension" data="is_zrtp_secure XML features"/>
|
||||
<anti-action application="playback" data="$${hold_music}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,10 @@
|
||||
<extension name="recordings" app_uuid="430737df-5385-42d1-b933-22600d3fb79e">
|
||||
<condition field="destination_number" expression="^\*(732)$">
|
||||
<action application="answer"/>
|
||||
<action application="set" data="pin_number={v_pin_number}"/>
|
||||
<action application="set" data="recordings_dir={v_switch_recordings_dir}"/>
|
||||
<action application="set" data="recording_slots=true"/>
|
||||
<action application="set" data="recording_prefix=recording"/>
|
||||
<action application="lua" data="recordings.lua"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,14 @@
|
||||
<extension name="freeswitch_conference" app_uuid="8e3ad78e-4b48-4d36-af7e-4920a9757043" enabled="false">
|
||||
<condition field="destination_number" expression="^\*9(888|8888|1616|3232)$">
|
||||
<action application="export" data="hold_music=silence"/>
|
||||
<!--
|
||||
This will take the SAS from the b-leg and send it to the display on the a-leg phone.
|
||||
Known working with Polycom and Snom maybe others.
|
||||
-->
|
||||
<!--
|
||||
<action application="set" data="exec_after_bridge_app=${sched_api(+4 zrtp expand uuid_display ${uuid} \${uuid_getvar(\${uuid_getvar(${uuid} signal_bond)} zrtp_sas1_string )} \${uuid_getvar(\${uuid_getvar(${uuid} signal_bond)} zrtp_sas2_string )} )}"/>
|
||||
<action application="export" data="nolocal:zrtp_secure_media=true"/>
|
||||
-->
|
||||
<action application="bridge" data="sofia/${use_profile}/$1@conference.freeswitch.org"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,8 @@
|
||||
<extension name="disa" app_uuid="3ade2d9a-f55d-4240-bb60-b4a3ab36951c" enabled="false">
|
||||
<condition field="destination_number" expression="^\*(3472)$">
|
||||
<action application="answer"/>
|
||||
<action application="set" data="pin_number={v_pin_number}"/>
|
||||
<action application="set" data="dialplan_context={v_context}"/>
|
||||
<action application="lua" data="disa.lua"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,5 @@
|
||||
<extension name="directory" app_uuid="a223dc70-28a1-4979-834e-8af813cd8ea6">
|
||||
<condition field="destination_number" expression="^\*411$">
|
||||
<action application="directory" data="default ${domain_name} ${domain_name}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,8 @@
|
||||
<extension name="wake-up" app_uuid="e27abe68-41c0-4188-bb0f-67d93de0c610">
|
||||
<condition field="destination_number" expression="^\*(925)$">
|
||||
<action application="answer"/>
|
||||
<action application="set" data="pin_number={v_pin_number}"/>
|
||||
<action application="set" data="time_zone_offset=-7"/>
|
||||
<action application="lua" data="wakeup.lua"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,12 @@
|
||||
<extension name="park_in" app_uuid="ffb30da6-30e4-43b8-9847-2ed40e232f89" enabled="false">
|
||||
<condition field="destination_number" expression="^5900$" >
|
||||
<action application="set" data="park_direction=in" />
|
||||
<action application="set" data="park_extension=5901" />
|
||||
<action application="set" data="park_range=3" />
|
||||
<action application="set" data="park_announce=true" />
|
||||
<action application="set" data="park_timeout_seconds=70" />
|
||||
<action application="set" data="park_timeout_destination=1000" />
|
||||
<action application="set" data="park_music=$${hold_music}" />
|
||||
<action application="lua" data="park.lua" />
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,7 @@
|
||||
<extension name="park_out" app_uuid="cf8234b6-a039-4ec2-87bd-3db0799a3f75" enabled="false">
|
||||
<condition field="destination_number" expression="(^5901$|^5902$|^5903$)" >
|
||||
<action application="set" data="park_direction=out" />
|
||||
<action application="set" data="park_extension=$1" />
|
||||
<action application="lua" data="park.lua" />
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,11 @@
|
||||
<extension name="park_slots" app_uuid="f096f899-c78e-409c-8290-00f6d423b31c" enabled="false">
|
||||
<condition field="destination_number" expression="(^5901$|^5902$|^5903$)" >
|
||||
<action application="set" data="park_extension=$1" />
|
||||
<action application="set" data="park_direction=both" />
|
||||
<action application="set" data="park_announce=true" />
|
||||
<action application="set" data="park_timeout_seconds=250" />
|
||||
<action application="set" data="park_timeout_destination=1000" />
|
||||
<action application="set" data="park_music=$${hold_music}" />
|
||||
<action application="lua" data="park.lua" />
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,32 @@
|
||||
<extension name="local_extension" app_uuid="71cf1310-b6e3-415b-8745-3cbdc8e15212">
|
||||
<condition field="destination_number" expression="(^\d{2,7}$)">
|
||||
<action application="set" data="dialed_extension=$1"/>
|
||||
<action application="export" data="dialed_extension=$1"/>
|
||||
<action application="limit" data="hash ${domain_name} $1 ${limit_max} ${limit_destination}"/>
|
||||
<!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
|
||||
<action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
|
||||
<action application="bind_meta_app" data="2 b s record_session::$${recordings_dir}/archive/${strftime(%Y)}/${strftime(%b)}/${strftime(%d)}/${uuid}.wav"/>
|
||||
<action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
|
||||
<action application="bind_meta_app" data="4 b s execute_extension::att_xfer XML features"/>
|
||||
<action application="set" data="ringback=${us-ring}"/>
|
||||
<action application="set" data="transfer_ringback=$${hold_music}"/>
|
||||
<action application="set" data="call_timeout=30"/>
|
||||
<action application="set" data="hangup_after_bridge=true"/>
|
||||
<!--<action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
|
||||
<action application="set" data="continue_on_fail=true"/>
|
||||
<action application="hash" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
|
||||
<action application="hash" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
|
||||
<action application="set" data="called_party_call_group=${user_data(${dialed_extension}@${domain_name} var call_group)}"/>
|
||||
<!--<action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>-->
|
||||
<action application="hash" data="insert/${domain_name}-last_dial/${called_party_call_group}/${uuid}"/>
|
||||
<!-- standard method -->
|
||||
<!--<action application="bridge" data="user/${dialed_extension}@${domain_name}"/> -->
|
||||
<!-- sofia contact -->
|
||||
<!--<action application="bridge" data="${sofia_contact(${dialed_extension}@${domain_name})}"/>-->
|
||||
<!-- number-alias / http://wiki.freeswitch.com/wiki/XML_User_Directory_Guide -->
|
||||
<action application="bridge" data="user/${user_data(${destination_number}@${domain_name} attr id)}@${domain_name}"/>
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user