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
+26
View File
@@ -0,0 +1,26 @@
<?php
//application details
$apps[$x]['name'] = "Call Center Active";
$apps[$x]['uuid'] = '3f159f62-ca2d-41b8-b3f0-c5519cebbc5a';
$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'] = 'Shows active calls, and agents in the call center queue.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Active Call Center';
$apps[$x]['menu'][0]['uuid'] = '7fb0dd87-e984-9980-c512-2c76b887aeb2';
$apps[$x]['menu'][0]['parent_uuid'] = '0438b504-8613-7887-c420-c837ffb20cb1';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/call_center_active/v_call_center_queue.php';
$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'call_center_active_view';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['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'] );
}
?>
@@ -0,0 +1,122 @@
<?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('call_center_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get the queue_name and set it as a variable
$queue_name = $_GET[queue_name];
//get the header
require_once "includes/header.php";
?><script type="text/javascript">
function loadXmlHttp(url, id) {
var f = this;
f.xmlHttp = null;
/*@cc_on @*/ // used here and below, limits try/catch to those IE browsers that both benefit from and support it
/*@if(@_jscript_version >= 5) // prevents errors in old browsers that barf on try/catch & problems in IE if Active X disabled
try {f.ie = window.ActiveXObject}catch(e){f.ie = false;}
@end @*/
if (window.XMLHttpRequest&&!f.ie||/^http/.test(window.location.href))
f.xmlHttp = new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari, others, IE 7+ when live - this is the standard method
else if (/(object)|(function)/.test(typeof createRequest))
f.xmlHttp = createRequest(); // ICEBrowser, perhaps others
else {
f.xmlHttp = null;
// Internet Explorer 5 to 6, includes IE 7+ when local //
/*@cc_on @*/
/*@if(@_jscript_version >= 5)
try{f.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch (e){try{f.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){f.xmlHttp=null;}}
@end @*/
}
if(f.xmlHttp != null){
f.el = document.getElementById(id);
f.xmlHttp.open("GET",url,true);
f.xmlHttp.onreadystatechange = function(){f.stateChanged();};
f.xmlHttp.send(null);
}
}
loadXmlHttp.prototype.stateChanged=function () {
if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !/^http/.test(window.location.href)))
//this.el.innerHTML = this.xmlHttp.responseText;
document.getElementById('ajax_response').innerHTML = this.xmlHttp.responseText;
}
var requestTime = function() {
var url = 'v_call_center_active_inc.php?queue_name=<?php echo $queue_name; ?>';
new loadXmlHttp(url, 'ajax_response');
<?php
if (strlen($_SESSION["ajax_refresh_rate"]) == 0) { $_SESSION["ajax_refresh_rate"] = "1777"; }
echo "setInterval(function(){new loadXmlHttp(url, 'ajax_reponse');}, ".$_SESSION["ajax_refresh_rate"].");";
?>
}
if (window.addEventListener) {
window.addEventListener('load', requestTime, false);
}
else if (window.attachEvent) {
window.attachEvent('onload', requestTime);
}
function send_cmd(url) {
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",url,false);
xmlhttp.send(null);
//document.getElementById('cmd_response').innerHTML=xmlhttp.responseText;
}
</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 " <div id=\"ajax_response\">\n";
echo " </div>\n";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
?>
@@ -0,0 +1,302 @@
<?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('call_center_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get the queue_name and set it as a variable
$queue_name = $_GET[queue_name].'@'. $_SESSION['domains'][$domain_uuid]['domain_name'];
//convert the string to a named array
function str_to_named_array($tmp_str, $tmp_delimiter) {
$tmp_array = explode ("\n", $tmp_str);
$result = '';
if (trim(strtoupper($tmp_array[0])) != "+OK") {
$tmp_field_name_array = explode ($tmp_delimiter, $tmp_array[0]);
$x = 0;
foreach ($tmp_array as $row) {
if ($x > 0) {
$tmp_field_value_array = explode ($tmp_delimiter, $tmp_array[$x]);
$y = 0;
foreach ($tmp_field_value_array as $tmp_value) {
$tmp_name = $tmp_field_name_array[$y];
if (trim(strtoupper($tmp_value)) != "+OK") {
$result[$x][$tmp_name] = $tmp_value;
}
$y++;
}
}
$x++;
}
unset($row);
}
return $result;
}
//alternate the color of the row
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//create an event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//get the call center queue, agent and tiers list
if (!$fp) {
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
echo "<tr>\n";
echo "<th align='left'>Message</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1'><strong>$msg</strong></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
}
else {
//get the queue list
//send the event socket command and get the response
//callcenter_config queue list members [queue_name]
$switch_cmd = 'callcenter_config queue list members '.$queue_name;
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$result = str_to_named_array($event_socket_str, '|');
//show the title
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>".ucfirst($_GET[queue_name])." Queue</b><br />\n";
echo " Shows a list of callers in the queue.<br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>Time</th>\n";
//echo "<th>System</th>\n";
echo "<th>Name</th>\n";
echo "<th>Number</th>\n";
echo "<th>Status</th>\n";
if (if_group("admin") || if_group("superadmin")) {
echo "<th>Options</th>\n";
}
echo "</tr>\n";
foreach ($result as $row) {
$switch_cmd = 'uuid_exists '.$row['session_uuid'];
if (trim(event_socket_request($fp, 'api '.$switch_cmd)) == "true") {
$queue = $row['queue'];
$system = $row['system'];
$uuid = $row['uuid'];
$session_uuid = $row['session_uuid'];
$caller_number = $row['caller_number'];
$caller_name = $row['caller_name'];
$system_epoch = $row['system_epoch'];
$joined_epoch = $row['joined_epoch'];
$rejoined_epoch = $row['rejoined_epoch'];
$bridge_epoch = $row['bridge_epoch'];
$abandoned_epoch = $row['abandoned_epoch'];
$base_score = $row['base_score'];
$skill_score = $row['skill_score'];
$serving_agent = $row['serving_agent'];
$serving_system = $row['serving_system'];
$state = $row['state'];
$joined_seconds = time() - $joined_epoch;
$joined_length_hour = floor($joined_seconds/3600);
$joined_length_min = floor($joined_seconds/60 - ($joined_length_hour * 60));
$joined_length_sec = $joined_seconds - (($joined_length_hour * 3600) + ($joined_length_min * 60));
$joined_length_min = sprintf("%02d", $joined_length_min);
$joined_length_sec = sprintf("%02d", $joined_length_sec);
$joined_length = $joined_length_hour.':'.$joined_length_min.':'.$joined_length_sec;
//$system_seconds = time() - $system_epoch;
//$system_length_hour = floor($system_seconds/3600);
//$system_length_min = floor($system_seconds/60 - ($system_length_hour * 60));
//$system_length_sec = $system_seconds - (($system_length_hour * 3600) + ($system_length_min * 60));
//$system_length_min = sprintf("%02d", $system_length_min);
//$system_length_sec = sprintf("%02d", $system_length_sec);
//$system_length = $system_length_hour.':'.$system_length_min.':'.$system_length_sec;
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$joined_length."</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>".$system_length."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$caller_name."&nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$caller_number."&nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$state."</td>\n";
if (if_group("admin") || if_group("superadmin")) {
echo "<td valign='top' class='".$row_style[$c]."'>";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('Do you really want to do this?');if (confirm_response){send_cmd('v_call_center_exec.php?cmd=originate+user/".$_SESSION['user']['extension']['user'][0]."+%26eavesdrop(".$uuid.")');}\">eavesdrop</a>&nbsp;\n";
echo "</td>";
}
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end if uuid_exists
}
echo "</table>\n";
//add vertical spacing
echo "<br />\n";
echo "<br />\n";
echo "<br />\n";
//get the agent list
//show the title
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>Agents</b><br />\n";
echo " List all the agents.<br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />\n";
//send the event socket command and get the response
//callcenter_config queue list tiers [queue_name] |
$switch_cmd = 'callcenter_config queue list tiers '.$queue_name;
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$result = str_to_named_array($event_socket_str, '|');
//prepare the result for array_multisort
$x = 0;
foreach ($result as $row) {
$tier_result[$x]['level'] = $row['level'];
$tier_result[$x]['position'] = $row['position'];
$tier_result[$x]['agent'] = $row['agent'];
$tier_result[$x]['state'] = trim($row['state']);
$tier_result[$x]['queue'] = $row['queue'];
$x++;
}
//sort the array //SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING
array_multisort($tier_result, SORT_ASC);
//send the event socket command and get the response
//callcenter_config queue list agents [queue_name] [status] |
$switch_cmd = 'callcenter_config queue list agents '.$queue_name;
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$agent_result = str_to_named_array($event_socket_str, '|');
//list the agents
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>Name</th>\n";
echo "<th>Contact</th>\n";
echo "<th>Status</th>\n";
echo "<th>State</th>\n";
//echo "<th>Offered Call</th>\n";
echo "<th>Status Change</th>\n";
echo "<th>Missed</th>\n";
echo "<th>Answered</th>\n";
echo "<th>Tier State</th>\n";
echo "<th>Tier Level</th>\n";
echo "<th>Tier Position</th>\n";
echo "</tr>\n";
foreach ($tier_result as $tier_row) {
//$queue = $tier_row['queue'];
//$queue = str_replace('@'.$_SESSION['domain_name'], '', $queue);
$agent = $tier_row['agent'];
//$agent = str_replace('@'.$_SESSION['domain_name'], '', $agent);
$tier_state = $tier_row['state'];
$tier_level = $tier_row['level'];
$tier_position = $tier_row['position'];
foreach ($agent_result as $agent_row) {
if ($tier_row['agent'] == $agent_row['name']) {
$name = $agent_row['name'];
$name = str_replace('@'.$_SESSION['domain_name'], '', $name);
//$system = $agent_row['system'];
//$uuid = $agent_row['uuid'];
//$type = $agent_row['type'];
$contact = $agent_row['contact'];
$status = $agent_row['status'];
$state = $agent_row['state'];
$max_no_answer = $agent_row['max_no_answer'];
$wrap_up_time = $agent_row['wrap_up_time'];
$reject_delay_time = $agent_row['reject_delay_time'];
$busy_delay_time = $agent_row['busy_delay_time'];
$last_bridge_start = $agent_row['last_bridge_start'];
$last_bridge_end = $agent_row['last_bridge_end'];
//$last_offered_call = $agent_row['last_offered_call'];
$last_status_change = $agent_row['last_status_change'];
$no_answer_count = $agent_row['no_answer_count'];
$calls_answered = $agent_row['calls_answered'];
$talk_time = $agent_row['talk_time'];
$ready_time = $agent_row['ready_time'];
$last_offered_call_seconds = time() - $last_offered_call;
$last_offered_call_length_hour = floor($last_offered_call_seconds/3600);
$last_offered_call_length_min = floor($last_offered_call_seconds/60 - ($last_offered_call_length_hour * 60));
$last_offered_call_length_sec = $last_offered_call_seconds - (($last_offered_call_length_hour * 3600) + ($last_offered_call_length_min * 60));
$last_offered_call_length_min = sprintf("%02d", $last_offered_call_length_min);
$last_offered_call_length_sec = sprintf("%02d", $last_offered_call_length_sec);
$last_offered_call_length = $last_offered_call_length_hour.':'.$last_offered_call_length_min.':'.$last_offered_call_length_sec;
$last_status_change_seconds = time() - $last_status_change;
$last_status_change_length_hour = floor($last_status_change_seconds/3600);
$last_status_change_length_min = floor($last_status_change_seconds/60 - ($last_status_change_length_hour * 60));
$last_status_change_length_sec = $last_status_change_seconds - (($last_status_change_length_hour * 3600) + ($last_status_change_length_min * 60));
$last_status_change_length_min = sprintf("%02d", $last_status_change_length_min);
$last_status_change_length_sec = sprintf("%02d", $last_status_change_length_sec);
$last_status_change_length = $last_status_change_length_hour.':'.$last_status_change_length_min.':'.$last_status_change_length_sec;
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$name."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$contact."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$status."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$state."</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>".$last_offered_call_length."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$last_status_change_length."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$no_answer_count."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$calls_answered."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tier_state."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tier_level."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tier_position."</td>\n";
}
}
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
}
echo "</table>\n";
//add vertical spacing
echo "<br />\n";
echo "<br />\n";
echo "<br />\n";
}
?>
@@ -0,0 +1,96 @@
<?php
/* $Id$ */
/*
v_exec.php
Copyright (C) 2008 Mark J Crane
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//http get variables set to php variables
if (count($_GET)>0) {
$switch_cmd = trim($_GET["cmd"]);
$action = trim(check_str($_GET["action"]));
$data = trim(check_str($_GET["data"]));
$username = trim(check_str($_GET["username"]));
}
//authorized commands
if (stristr($switch_cmd, 'user_status') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'callcenter_config') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'eavesdrop') == true) {
//authorized;
} else {
//not found. this command is not authorized
echo "access denied";
exit;
}
//set the username
if (if_group("admin") || if_group("superadmin")) {
//use the username that was provided
}
else {
$username = $_SESSION['username'];
}
//get to php variables
if (count($_GET)>0) {
if ($action == "user_status") {
$user_status = $data;
$sql = "update v_users set ";
$sql .= "user_status = '".trim($user_status, "'")."' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '".$username."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
}
//fs cmd
if (strlen($switch_cmd) > 0) {
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//ensure the connection exists
if ($fp) {
//send the command
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
//set the user state
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
}
}
}
?>
@@ -0,0 +1,177 @@
<?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>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_active_view')) {
//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"];
//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'>\n";
echo "<tr>\n";
echo "<td width='50%' align=\"left\" nowrap=\"nowrap\"><b>Call Center Queue List</b></td>\n";
echo "<td width='50%' align=\"right\">\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align=\"left\" colspan='2'>\n";
echo "List of queues for the call center.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "</tr></table>\n";
$sql = "";
$sql .= " select * from v_call_center_queues ";
$sql .= " where domain_uuid = '$domain_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$num_rows = count($result);
unset ($prep_statement, $result, $sql);
$rows_per_page = 100;
$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_call_center_queues ";
$sql .= " where domain_uuid = '$domain_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$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('queue_name', 'Queue Name', $order_by, $order);
echo th_order_by('queue_extension', 'Extension', $order_by, $order);
echo th_order_by('queue_strategy', 'Strategy', $order_by, $order);
//echo th_order_by('queue_moh_sound', 'Music On Hold', $order_by, $order);
//echo th_order_by('queue_record_template', 'Record Template', $order_by, $order);
//echo th_order_by('queue_time_base_score', 'Time Base Score', $order_by, $order);
//echo th_order_by('queue_max_wait_time', 'Max Wait Time', $order_by, $order);
//echo th_order_by('queue_max_wait_time_with_no_agent', 'Max Wait Time With No Agent', $order_by, $order);
//echo th_order_by('queue_tier_rules_apply', 'Tier Rules Apply', $order_by, $order);
//echo th_order_by('queue_tier_rule_wait_second', 'Tier Rule Wait Second', $order_by, $order);
//echo th_order_by('queue_tier_rule_no_agent_no_wait', 'Tier Rule No Agent No Wait', $order_by, $order);
//echo th_order_by('queue_discard_abandoned_after', 'Discard Abandoned After', $order_by, $order);
//echo th_order_by('queue_abandoned_resume_allowed', 'Abandoned Resume Allowed', $order_by, $order);
//echo th_order_by('queue_tier_rule_wait_multiply_level', 'Tier Rule Wait Multiply Level', $order_by, $order);
echo th_order_by('queue_description', 'Description', $order_by, $order);
echo "<td align='right' width='42'>\n";
//echo " <a href='v_call_center_queue_edit.php' alt='add'>$v_link_label_add</a>\n";
echo "</td>\n";
echo "<tr>\n";
if ($result_count == 0) { //no results
}
else { //received results
foreach($result as $row) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_name]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_extension]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_strategy]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_moh_sound]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_record_template]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_time_base_score]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_max_wait_time]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_max_wait_time_with_no_agent]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rules_apply]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rule_wait_second]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rule_no_agent_no_wait]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_discard_abandoned_after]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_abandoned_resume_allowed]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rule_wait_multiply_level]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_description]."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
echo " <a href='".PROJECT_PATH."/app/call_center_active/v_call_center_active.php?queue_name=".$row[queue_name]."' alt='edit'>$v_link_label_edit</a>\n";
//echo " <a href='v_call_center_queue_delete.php?id=".$row[call_center_queue_uuid]."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
//echo " <input type='button' class='btn' name='' alt='edit' onclick=\"window.location='v_call_center_queue_edit.php?id=".$row[call_center_queue_uuid]."'\" value='e'>\n";
//echo " <input type='button' class='btn' name='' alt='delete' onclick=\"if (confirm('Are you sure you want to delete this?')) { window.location='v_call_center_queue_delete.php?id=".$row[call_center_queue_uuid]."' }\" value='x'>\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='17' align='left'>\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";
//echo " <a href='v_call_center_queue_edit.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 "</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";
?>