Add a missing file sip_profile_copy.php to the dev branch.

This commit is contained in:
Mark Crane
2012-06-04 14:58:40 +00:00
commit af103e9c41
1240 changed files with 164946 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
//application details
$apps[$x]['name'] = "FIFO";
$apps[$x]['uuid'] = '16589224-c876-aeb3-f59f-523a1c0801f7';
$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'] = 'Queues are used to setup waiting lines for callers. Also known as FIFO Queues.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Queues';
$apps[$x]['menu'][0]['uuid'] = 'c535ac0b-1da1-0f9c-4653-7934c6f4732c';
$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/fifo/v_fifo.php';
$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'fifo_view';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'fifo_add';
$apps[$x]['permissions'][1]['groups'][] = 'admin';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'fifo_edit';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'fifo_delete';
$apps[$x]['permissions'][3]['groups'][] = 'admin';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
?>
+50
View File
@@ -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'] );
}
?>
+194
View File
@@ -0,0 +1,194 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('fifo_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/paging.php";
//get http values and set them as variables
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//show the content
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo "<td align=\"center\">\n";
echo "<br />";
echo " <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><span class=\"vexpl\"><span class=\"red\"><strong>Queues\n";
echo " </strong></span></span>\n";
echo " </td>\n";
echo " <td align='right'>\n";
//echo " <input type='button' class='btn' value='advanced' onclick=\"document.location.href='v_fifo.php';\">\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " <span class=\"vexpl\">\n";
echo " Queues are used to setup waiting lines for callers. Also known as FIFO Queues.\n";
echo " </span>\n";
echo " </td>\n";
echo "\n";
echo " </tr>\n";
echo " </table>";
echo " <br />";
echo " <br />";
//get the number of rows in the dialplan
$sql = "";
$sql .= " select count(*) as num_rows from v_dialplans ";
$sql .= " where domain_uuid = '$domain_uuid' ";
$sql .= " and app_uuid = '16589224-c876-aeb3-f59f-523a1c0801f7' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } else { $sql .= "order by dialplan_order, dialplan_name asc "; }
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] > 0) {
$num_rows = $row['num_rows'];
}
else {
$num_rows = '0';
}
}
unset($prep_statement, $result);
//paging prep
$rows_per_page = 20;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the dialplans
$sql = "";
$sql .= " select * from v_dialplans ";
$sql .= " where domain_uuid = '$domain_uuid' ";
$sql .= " and app_uuid = '16589224-c876-aeb3-f59f-523a1c0801f7' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } else { $sql .= "order by dialplan_order, dialplan_name asc "; }
$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('dialplan_name', 'Extension Name', $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 (permission_exists('fifo_add')) {
echo " <a href='v_fifo_add.php' alt='add'>$v_link_label_add</a>\n";
}
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row['dialplan_name']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row['dialplan_order']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row['dialplan_enabled']."</td>\n";
echo " <td valign='top' class='row_stylebg' width='30%'>".$row['dialplan_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('fifo_edit')) {
echo " <a href='v_fifo_edit.php?id=".$row['dialplan_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
}
if (permission_exists('fifo_delete')) {
echo " <a href='v_fifo_delete.php?id=".$row['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; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='5'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n";
if (permission_exists('fifo_add')) {
echo " <a href='v_fifo_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']['conf']['dir']."/dialplan/default/";
}
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "</div>";
echo "<br><br>";
echo "<br><br>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<br><br>";
//show the footer
require_once "includes/footer.php";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
?>
+426
View File
@@ -0,0 +1,426 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('fifo_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/paging.php";
//get http values and set them as variables
if (count($_POST)>0) {
$order_by = $_GET["order_by"];
$order = $_GET["order"];
$extension_name = check_str($_POST["extension_name"]);
$queue_extension_number = check_str($_POST["queue_extension_number"]);
$agent_queue_extension_number = check_str($_POST["agent_queue_extension_number"]);
$agent_login_logout_extension_number = check_str($_POST["agent_login_logout_extension_number"]);
$dialplan_order = check_str($_POST["dialplan_order"]);
$pin_number = check_str($_POST["pin_number"]);
$profile = check_str($_POST["profile"]);
$flags = check_str($_POST["flags"]);
$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($extension_name) == 0) { $msg .= "Please provide: Extension Name<br>\n"; }
if (strlen($queue_extension_number) == 0) { $msg .= "Please provide: Extension Number 1<br>\n"; }
//if (strlen($agent_queue_extension_number) == 0) { $msg .= "Please provide: Queue Extension Number<br>\n"; }
//if (strlen($agent_queue_extension_number) == 0) { $msg .= "Please provide: Agent Login Logout Extension Number<br>\n"; }
//if (strlen($pin_number) == 0) { $msg .= "Please provide: PIN Number<br>\n"; }
//if (strlen($profile) == 0) { $msg .= "Please provide: profile<br>\n"; }
//if (strlen($flags) == 0) { $msg .= "Please provide: Flags<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;
}
if (strlen($queue_extension_number) > 0) {
//--------------------------------------------------------
//Caller Queue [FIFO in]
//<extension name="Queue_Call_In">
// <condition field="destination_number" expression="^7011\$">
// <action application="set" data="fifo_music=$${hold_music}"/>
// <action application="answer"/>
// <action application="fifo" data="myq in"/>
// </condition>
//</extension>
//--------------------------------------------------------
$extension_name = $extension_name."_call_queue";
$dialplan_context = $_SESSION['context'];
$app_uuid = '16589224-c876-aeb3-f59f-523a1c0801f7';
$dialplan_uuid = uuid();
dialplan_add($domain_uuid, $dialplan_uuid, $extension_name, $dialplan_order, $dialplan_context, $dialplan_enabled, $dialplan_description, $app_uuid);
if (strlen($dialplan_uuid) > 0) {
//set the destination number
$dialplan_detail_tag = 'condition'; //condition, action, antiaction
$dialplan_detail_type = 'destination_number';
$dialplan_detail_data = '^'.$queue_extension_number.'$';
$dialplan_detail_order = '000';
$dialplan_detail_group = '';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//set the hold music
//if (strlen($hold_music) > 0) {
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'set';
$dialplan_detail_data = 'fifo_music=$${hold_music}';
$dialplan_detail_order = '001';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//}
//action answer
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'answer';
$dialplan_detail_data = '';
$dialplan_detail_order = '002';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//action fifo
//if (strlen($pin_number) > 0) { $pin_number = "+".$pin_number; }
//if (strlen($flags) > 0) { $flags = "+{".$flags."}"; }
//$queue_action_data = $extension_name."@\${domain_name}".$profile.$flags.$pin_number;
$queue_action_data = $extension_name."@\${domain_name} in";
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'fifo';
$dialplan_detail_data = $queue_action_data;
$dialplan_detail_order = '003';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
}
} //end if queue_extension_number
// Caller Queue / Agent Queue
if (strlen($agent_queue_extension_number) > 0) {
//--------------------------------------------------------
// Agent Queue [FIFO out]
//<extension name="Agent_Wait">
// <condition field="destination_number" expression="^7010\$">
// <action application="set" data="fifo_music=$${hold_music}"/>
// <action application="answer"/>
// <action application="fifo" data="myq out wait"/>
// </condition>
//</extension>
//--------------------------------------------------------
$extension_name = $extension_name."_agent_queue";
$dialplan_context = $_SESSION['context'];
$app_uuid = '16589224-c876-aeb3-f59f-523a1c0801f7';
$dialplan_uuid = uuid();
dialplan_add($domain_uuid, $dialplan_uuid, $extension_name, $dialplan_order, $dialplan_context, $dialplan_enabled, $dialplan_description, $app_uuid);
if (strlen($dialplan_uuid) > 0) {
//set the destination number
$dialplan_detail_tag = 'condition'; //condition, action, antiaction
$dialplan_detail_type = 'destination_number';
$dialplan_detail_data = '^'.$agent_queue_extension_number.'$';
$dialplan_detail_order = '000';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//set the hold music
//if (strlen($hold_music) > 0) {
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'set';
$dialplan_detail_data = 'fifo_music=$${hold_music}';
$dialplan_detail_order = '001';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//}
//action answer
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'answer';
$dialplan_detail_data = '';
$dialplan_detail_order = '002';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//action fifo
//if (strlen($pin_number) > 0) { $pin_number = "+".$pin_number; }
//if (strlen($flags) > 0) { $flags = "+{".$flags."}"; }
//$queue_action_data = $extension_name."@\${domain_name}".$profile.$flags.$pin_number;
$queue_action_data = $extension_name."@\${domain_name} out wait";
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'fifo';
$dialplan_detail_data = $queue_action_data;
$dialplan_detail_order = '003';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
}
}
// agent or member login / logout
if (strlen($agent_login_logout_extension_number) > 0) {
//--------------------------------------------------------
// Agent Queue [FIFO out]
//<extension name="Agent_Wait">
// <condition field="destination_number" expression="^7010\$">
// <action application="set" data="fifo_music=$${hold_music}"/>
// <action application="answer"/>
// <action application="fifo" data="myq out wait"/>
// </condition>
//</extension>
//--------------------------------------------------------
$extension_name = $extension_name."_agent_login_logout";
$dialplan_context = $_SESSION['context'];
$app_uuid = '16589224-c876-aeb3-f59f-523a1c0801f7';
$dialplan_uuid = uuid();
$dialplan_uuid = dialplan_add($domain_uuid, $dialplan_uuid, $extension_name, $dialplan_order, $dialplan_context, $dialplan_enabled, $dialplan_description, $app_uuid);
if (strlen($dialplan_uuid) > 0) {
//set the destination number
$dialplan_detail_tag = 'condition'; //condition, action, antiaction
$dialplan_detail_type = 'destination_number';
$dialplan_detail_data = '^'.$agent_login_logout_extension_number.'$';
$dialplan_detail_order = '000';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//set the queue_name
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'set';
$dialplan_detail_data = 'queue_name='.$extension_name.'@\${domain_name}';
$dialplan_detail_order = '001';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//set the fifo_simo
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'set';
$dialplan_detail_data = 'fifo_simo=1';
$dialplan_detail_order = '002';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//set the fifo_timeout
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'set';
$dialplan_detail_data = 'fifo_timeout=10';
$dialplan_detail_order = '003';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//set the fifo_lag
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'set';
$dialplan_detail_data = 'fifo_lag=10';
$dialplan_detail_order = '004';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//set the pin_number
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'set';
$dialplan_detail_data = 'pin_number=';
$dialplan_detail_order = '005';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//action lua
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'lua';
$dialplan_detail_data = 'fifo_member.lua';
$dialplan_detail_order = '006';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
}
}
//synchronize the xml config
save_dialplan_xml();
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_fifo.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)
//show the content
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class=''>\n";
echo " <td align=\"left\">\n";
echo " <br>";
echo "<form method='post' name='frm' action=''>\n";
echo " <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><span class=\"vexpl\"><span class=\"red\">\n";
echo " <strong>Queues</strong>\n";
echo " </span></span>\n";
echo " </td>\n";
echo " <td align='right'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='v_fifo.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 " In simple terms queues are holding patterns for callers to wait until someone is available to take the call. Also known as FIFO Queues.\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 " Queue Name:\n";
echo " </td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input class='formfld' style='width: 60%;' type='text' name='extension_name' maxlength='255' value=\"$extension_name\">\n";
echo " <br />\n";
echo " The name the queue will be assigned.\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Extension Number:\n";
echo " </td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input class='formfld' style='width: 60%;' type='text' name='queue_extension_number' maxlength='255' value=\"$queue_extension_number\">\n";
echo " <br />\n";
echo " The number that will be assigned to the queue.\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";
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";
if ($dialplan_enabled == "true") {
echo " <option value='true' selected='selected' >true</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
}
if ($dialplan_enabled == "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 "\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 " <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 class='vtable' valign='top' align='left' nowrap>\n";
echo " <br /><br />\n";
echo " <b>Agent Details</b>\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " &nbsp\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap>\n";
echo " Queue Extension Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' style='width: 60%;' type='text' name='agent_queue_extension_number' maxlength='255' value=\"$agent_queue_extension_number\">\n";
echo "<br />\n";
echo "The extension number for the Agent FIFO Queue. This is the holding pattern for agents wating to service calls in the caller FIFO queue.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Login/Logout Extension Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' style='width: 60%;' type='text' name='agent_login_logout_extension_number' maxlength='255' value=\"$agent_login_logout_extension_number\">\n";
echo "<br />\n";
echo "Agents use this extension number to login or logout of the Queue. After logging into the agent will be ready to receive calls from the Queue. \n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\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 "</form>";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>";
echo "<br><br>";
//show the footer
require_once "includes/footer.php";
?>
+81
View File
@@ -0,0 +1,81 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('fifo_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get the id
if (count($_GET)>0) {
$id = $_GET["id"];
}
if (strlen($id)>0) {
//start the atomic transaction
$count = $db->exec("BEGIN;");
//delete child data
$sql = "";
$sql .= "delete from v_dialplan_details ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$id' ";
//echo $sql;
$db->query($sql);
unset($sql);
//delete parent data
$sql = "";
$sql .= "delete from v_dialplans ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$id' ";
//echo $sql;
$db->query($sql);
unset($sql);
//commit the atomic transaction
$count = $db->exec("COMMIT;");
//synchronize the xml config
save_dialplan_xml();
}
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_fifo.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>
+66
View File
@@ -0,0 +1,66 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (if_group("fifo_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 the 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=v_fifo_edit.php?id=".$dialplan_uuid."\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
//show the footer
require_once "includes/footer.php";
return;
?>
+456
View File
@@ -0,0 +1,456 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('fifo_add') || permission_exists('fifo_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//if (permission_exists('fifo_add')) {
//set the action as an add or an update
if (isset($_REQUEST["id"])) {
$action = "update";
$dialplan_detail_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
$dialplan_uuid = check_str($_REQUEST["id2"]);
}
if (isset($_REQUEST["id2"])) {
$dialplan_uuid = check_str($_REQUEST["id2"]);
}
//get http values and set them as php variables
if (count($_POST)>0) {
if (isset($_REQUEST["dialplan_uuid"])) {
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
}
$dialplan_detail_tag = check_str($_POST["dialplan_detail_tag"]);
$dialplan_detail_order = check_str($_POST["dialplan_detail_order"]);
$dialplan_detail_type = check_str($_POST["dialplan_detail_type"]);
$dialplan_detail_data = check_str($_POST["dialplan_detail_data"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$dialplan_detail_uuid = check_str($_POST["dialplan_detail_uuid"]);
}
//check for all required data
if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
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('fifo_add')) {
$dialplan_detail_uuid = uuid();
$sql = "insert into v_dialplan_details ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "dialplan_uuid, ";
$sql .= "dialplan_detail_uuid, ";
$sql .= "dialplan_detail_tag, ";
$sql .= "dialplan_detail_order, ";
$sql .= "dialplan_detail_type, ";
$sql .= "dialplan_detail_data ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$dialplan_uuid', ";
$sql .= "'$dialplan_detail_uuid', ";
$sql .= "'$dialplan_detail_tag', ";
$sql .= "'$dialplan_detail_order', ";
$sql .= "'$dialplan_detail_type', ";
$sql .= "'$dialplan_detail_data' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//synchronize the xml config
save_dialplan_xml();
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_fifo_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('fifo_edit')) {
$sql = "update v_dialplan_details set ";
$sql .= "domain_uuid = '$domain_uuid', ";
$sql .= "dialplan_uuid = '$dialplan_uuid', ";
$sql .= "dialplan_detail_tag = '$dialplan_detail_tag', ";
$sql .= "dialplan_detail_order = '$dialplan_detail_order', ";
$sql .= "dialplan_detail_type = '$dialplan_detail_type', ";
$sql .= "dialplan_detail_data = '$dialplan_detail_data' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_detail_uuid = '$dialplan_detail_uuid'";
$db->exec(check_sql($sql));
unset($sql);
//synchronize the xml config
save_dialplan_xml();
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_fifo_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 = "";
$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"];
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=\"center\">\n";
echo " <br>";
echo "<form method='post' name='frm' action=''>\n";
//echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
if ($action == "add") {
echo "<td align='left' width='30%' nowrap><b>Queue Detail Add</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap><b>Queue Detail Update</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='v_fifo_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 == "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 (htmlspecialchars($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>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>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>param</option>\n";
break;
case "param":
echo " <option>condition</option>\n";
echo " <option>action</option>\n";
echo " <option>anti-action</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>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";
//echo " <option></option>\n";
if (strlen(htmlspecialchars($dialplan_detail_order))> 0) {
echo " <option selected='yes' value='".htmlspecialchars($dialplan_detail_order)."'>".htmlspecialchars($dialplan_detail_order)."</option>\n";
}
$i=0;
while($i<=999) {
if (strlen($i) == 1) {
echo " <option value='00$i'>00$i</option>\n";
}
if (strlen($i) == 2) {
echo " <option value='0$i'>0$i</option>\n";
}
if (strlen($i) == 3) {
echo " <option value='$i'>$i</option>\n";
}
$i++;
}
echo " </select>\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Type:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='dialplan_detail_type' maxlength='255' value=\"$dialplan_detail_type\">\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Data:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='dialplan_detail_data' maxlength='255' value=\"$dialplan_detail_data\">\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
if ($action == "update") {
echo " <input type='hidden' name='dialplan_detail_uuid' value='$dialplan_detail_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
//echo "</div>\n";
echo "</form>";
echo " <table width='90%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left'>\n";
if ($v_path_show) {
echo "<br />\n";
echo "<br />\n";
echo "<b>Additional Information</b>\n";
echo "<br />\n";
echo "<br />\n";
}
?>
<b>Conditions</b>
<br />
<br />
Conditions are pattern matching tags that help decide if the current call should be processed in this extension or not. When matching conditions against the current call you have several <b>fields</b> that you can compare against.
<ul>
<li><b>context</b></li>
<li><b>rdnis</b> Redirected Number, the directory number to which the call was last presented.</li>
<li><b>destination_number</b> Called Number, the number this call is trying to reach (within a given context)</li>
<li><b>dialplan</b> Name of the dialplan module that are used, the name is provided by each dialplan module. Example: XML</li>
<li><b>caller_id_name</b> Name of the caller (provided by the User Agent that has called us).</li>
<li><b>caller_id_number</b> Directory Number of the party who called (callee) -- can be masked (hidden)</li>
<li><b>ani</b> Automatic Number Identification, the number of the calling party (callee) -- cannot be masked</li>
<li><b>ani2</b> The type of device placing the call [1]</li>
<li><b>uuid</b> Unique identifier of the current call? (looks like a GUID)</li>
<li><b>source</b> Name of the module that received the call (e.g. PortAudio)</li>
<li><b>chan_name</b> Name of the current channel (Example: PortAudio/1234). Give us examples when this one can be used.</li>
<li><b>network_addr</b> IP address of the signalling source for a VoIP call.</li>
</ul>
In addition to the above you can also do variables using the syntax ${variable} or api functions using the syntax %{api} {args}
<br />
<br />
Variables may be used in either the field or the expression, as follows
<br />
<br />
<br />
<br />
<b>Action and Anti-Actions</b>
<br />
<br />
Actions are executed when the <b>condition matches</b>. Anti-Actions are executed when the <b>condition does NOT match</b>.
<br />
<br />
<br />
The following is a partial list of <b>applications</b>.
<ul>
<li><b>answer</b> answer the call</li>
<li><b>bridge</b> bridge the call</li>
<li><b>cond</b></li>
<li><b>db</b> is a a runtime database either sqlite by default or odbc</li>
<li><b>global_set</b> allows setting of global vars similar to the ones found in vars.xml</li>
<li><b>group</b> allows grouping of several extensions for things like ring groups</li>
<li><b>expr</b></li>
<li><b>hangup</b> hangs up the call</li>
<li><b>info</b> sends call info to the console</li>
<li><b>javascript</b> run javascript .js files</li>
<li><b>playback</b></li>
<li><b>reject</b> reject the call</li>
<li><b>respond</b></li>
<li><b>ring_ready</b></li>
<li><b>set</b> set a variable</li>
<li><b>set_user</b></li>
<li><b>sleep</b></li>
<li><b>sofia_contact</b></li>
<li><b>transfer</b> transfer the call to another extension or number</li>
<li><b>voicemail</b> send the call to voicemail</li>
</ul>
<br />
<br />
<!--
<b>Param</b>
Example parameters by name and value
<br />
<ul>
<li><b>codec-ms</b> 20</li>
<li><b>codec-prefs</b> PCMU@20i</li>
<li><b>debug</b> 1</li>
<li><b>dialplan</b> XML</li>
<li><b>dtmf-duration</b> 100</li>
<li><b>rfc2833-pt</b>" 101</li>
<li><b>sip-port</b> 5060</li>
<li><b>use-rtp-timer</b> true</li>
</ul>
<br />
<br />
-->
</td>
</tr>
</table>
<br />
<br />
<br />
<br />
<br />
<?php
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//show the footer
require_once "includes/footer.php";
?>
+515
View File
@@ -0,0 +1,515 @@
<?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('fifo_add') || permission_exists('fifo_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//set the action to an add or an update
if (isset($_REQUEST["id"])) {
$action = "update";
$dialplan_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http values and set them as variables
if (count($_POST)>0) {
//$domain_uuid = check_str($_POST["domain_uuid"]);
$dialplan_name = check_str($_POST["dialplan_name"]);
$dialplan_order = check_str($_POST["dialplan_order"]);
$dialplan_continue = check_str($_POST["dialplan_continue"]);
$dialplan_context = check_str($_POST["dialplan_context"]);
$dialplan_enabled = check_str($_POST["dialplan_enabled"]);
$dialplan_description = check_str($_POST["dialplan_description"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
}
//check for all required data
if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
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_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;
}
//set the default dialplan_continue to false
if (strlen($dialplan_continue) == 0) { $dialplan_continue = 'false'; }
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('fifo_add')) {
$dialplan_context = $_SESSION['context'];
$dialplan_uuid = uuid();
$sql = "insert into v_dialplans ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "dialplan_uuid, ";
$sql .= "app_uuid, ";
$sql .= "dialplan_name, ";
$sql .= "dialplan_order, ";
$sql .= "dialplan_continue, ";
$sql .= "dialplan_context, ";
$sql .= "dialplan_enabled, ";
$sql .= "dialplan_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$dialplan_uuid', ";
$sql .= "'16589224-c876-aeb3-f59f-523a1c0801f7', ";
$sql .= "'$dialplan_name', ";
$sql .= "'$dialplan_order', ";
$sql .= "'$dialplan_continue', ";
$sql .= "'$dialplan_context', ";
$sql .= "'$dialplan_enabled', ";
$sql .= "'$dialplan_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//synchronize the xml config
save_dialplan_xml();
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_fifo.php\">\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('fifo_edit')) {
$sql = "update v_dialplans set ";
$sql .= "domain_uuid = '$domain_uuid', ";
$sql .= "dialplan_name = '$dialplan_name', ";
$sql .= "dialplan_order = '$dialplan_order', ";
$sql .= "dialplan_continue = '$dialplan_continue', ";
$sql .= "dialplan_context = '$dialplan_context', ";
$sql .= "dialplan_enabled = '$dialplan_enabled', ";
$sql .= "dialplan_description = '$dialplan_description' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid'";
$db->exec(check_sql($sql));
unset($sql);
//synchronize the xml config
save_dialplan_xml();
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_fifo.php\">\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_uuid = $_GET["id"];
$sql = "";
$sql .= "select * from v_dialplans ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$dialplan_name = $row["dialplan_name"];
$dialplan_order = $row["dialplan_order"];
$dialplan_continue = $row["dialplan_continue"];
$dialplan_context = $row["dialplan_context"];
$dialplan_enabled = $row["dialplan_enabled"];
$dialplan_description = $row["dialplan_description"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//show the header
require_once "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%'><p><span class=\"vexpl\"><span class=\"red\">\n";
echo " <strong>Queues</strong><br />\n";
echo " </span>\n";
echo " </td>\n";
echo " <td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='v_fifo.php'\" value='Back'></td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " Queues are used to setup waiting lines for callers. Also known as FIFO Queues.\n";
echo " </span></p>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>";
echo "<br />\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Name:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='dialplan_name' maxlength='255' value=\"$dialplan_name\">\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Order:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='dialplan_order' class='formfld'>\n";
//echo " <option></option>\n";
if (strlen(htmlspecialchars($dialplan_order))> 0) {
echo " <option selected='yes' value='".htmlspecialchars($dialplan_order)."'>".htmlspecialchars($dialplan_order)."</option>\n";
}
$i=0;
while($i<=999) {
if (strlen($i) == 1) {
echo " <option value='00$i'>00$i</option>\n";
}
if (strlen($i) == 2) {
echo " <option value='0$i'>0$i</option>\n";
}
if (strlen($i) == 3) {
echo " <option value='$i'>$i</option>\n";
}
$i++;
}
echo " </select>\n";
//echo " <input class='formfld' type='text' name='dialplan_order' maxlength='255' value='$dialplan_order'>\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
//echo "<tr>\n";
//echo "<td class='vncell' valign='top' align='left' nowrap>\n";
//echo " 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>\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 >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 is false.\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'>\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 class='vtable' align='left'>\n";
echo " <textarea class='formfld' name='dialplan_description' rows='4'>$dialplan_description</textarea>\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//v_dialplan_details
if ($action == "update" && permission_exists('fifo_edit')) {
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"center\">\n";
echo " <br>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><p><span class=\"vexpl\"><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 until you reach the action dialplan_detail_tag which tells what action to perform. \n";
echo " You are not limited to only one condition or action dialplan_detail_tag for a given extension.\n";
echo " </span></p></td>\n";
echo " </tr>\n";
echo "</table>";
echo "<br />\n";
$sql = "";
$sql .= " select * from v_dialplan_details ";
$sql .= " where domain_uuid = '$domain_uuid' ";
$sql .= " and dialplan_uuid = '$dialplan_uuid' ";
$sql .= " and dialplan_detail_tag = 'condition' ";
$sql .= " order by dialplan_detail_order asc";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th align='center'>Tag</th>\n";
echo "<th align='center'>Type</th>\n";
echo "<th align='center'>Data</th>\n";
echo "<th align='center'>Order</th>\n";
echo "<td align='right' width='42'>\n";
if (permission_exists('fifo_add')) {
echo " <a href='v_fifo_details_edit.php?id2=".$dialplan_uuid."' alt='add'>$v_link_label_add</a>\n";
}
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row[dialplan_detail_tag]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row[dialplan_detail_type]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row[dialplan_detail_data]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row[dialplan_detail_order]."</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('fifo_edit')) {
echo " <a href='v_fifo_details_edit.php?id=".$row[dialplan_detail_uuid]."&id2=".$dialplan_uuid."' alt='edit'>$v_link_label_edit</a>\n";
}
if (permission_exists('fifo_delete')) {
echo " <a href='v_fifo_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; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
//v_dialplan_details dialplan_detail_tag: action
$sql = "";
$sql .= " select * from v_dialplan_details ";
$sql .= " where domain_uuid = '$domain_uuid' ";
$sql .= " and dialplan_uuid = '$dialplan_uuid' ";
$sql .= " and dialplan_detail_tag = 'action' ";
$sql .= " order by dialplan_detail_order asc";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
if ($result_count > 0) {
foreach($result as $row) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row[dialplan_detail_tag]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row[dialplan_detail_type]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row[dialplan_detail_data]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row[dialplan_detail_order]."</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('fifo_edit')) {
echo " <a href='v_fifo_details_edit.php?id=".$row[dialplan_detail_uuid]."&id2=".$dialplan_uuid."' alt='edit'>$v_link_label_edit</a>\n";
}
if (permission_exists('fifo_delete')) {
echo " <a href='v_fifo_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; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
//v_dialplan_details dialplan_detail_tag: anti-action
$sql = "";
$sql .= " select * from v_dialplan_details ";
$sql .= " where domain_uuid = '$domain_uuid' ";
$sql .= " and dialplan_uuid = '$dialplan_uuid' ";
$sql .= " and dialplan_detail_tag = 'anti-action' ";
$sql .= " order by dialplan_detail_order asc";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
if ($result_count == 0) {
//no results
}
else { //received results
foreach($result as $row) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row[dialplan_detail_tag]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row[dialplan_detail_type]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row[dialplan_detail_data]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row[dialplan_detail_order]."</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('fifo_edit')) {
echo " <a href='v_fifo_details_edit.php?id=".$row[dialplan_detail_uuid]."&id2=".$dialplan_uuid."' alt='edit'>$v_link_label_edit</a>\n";
}
if (permission_exists('fifo_delete')) {
echo " <a href='v_fifo_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; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='5'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n";
if (permission_exists('fifo_add')) {
echo " <a href='v_fifo_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 "<br><br>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<br><br>";
} //end if update
//show the footer
require_once "includes/footer.php";
?>