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
+37
View File
@@ -0,0 +1,37 @@
<?php
//application details
$apps[$x]['name'] = "FIFO List";
$apps[$x]['uuid'] = 'fcd0afab-164b-abd7-3971-d613598fe3da';
$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'] = 'List all the queues that are currently active with one or more callers.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Active Queues';
$apps[$x]['menu'][0]['uuid'] = '450f1225-9187-49ac-a119-87bc26025f7d';
$apps[$x]['menu'][0]['parent_uuid'] = '0438b504-8613-7887-c420-c837ffb20cb1';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/fifo_list/v_fifo_list.php';
$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'active_queues_view';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'active_queues_add';
$apps[$x]['permissions'][1]['groups'][] = 'admin';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'active_queues_edit';
$apps[$x]['permissions'][2]['groups'][] = 'admin';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'active_queues_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'] );
}
?>
+89
View File
@@ -0,0 +1,89 @@
<?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('active_queues_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_GET)>0) {
$switch_cmd = trim($_GET["cmd"]);
$action = trim($_GET["action"]);
$direction = trim($_GET["direction"]);
}
//GET to PHP variables
if (count($_GET)>0) {
//fs cmd
if (strlen($switch_cmd) > 0) {
/*
if ($action == "energy") {
//conference 3001-example.dyndns.org energy 103
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$result_array = explode("=",$switch_result);
$tmp_value = $result_array[1];
if ($direction == "up") { $tmp_value = $tmp_value + 100; }
if ($direction == "down") { $tmp_value = $tmp_value - 100; }
//echo "energy $tmp_value<br />\n";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
}
if ($action == "volume_in") {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$result_array = explode("=",$switch_result);
$tmp_value = $result_array[1];
if ($direction == "up") { $tmp_value = $tmp_value + 1; }
if ($direction == "down") { $tmp_value = $tmp_value - 1; }
//echo "volume $tmp_value<br />\n";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
}
if ($action == "volume_out") {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$result_array = explode("=",$switch_result);
$tmp_value = $result_array[1];
if ($direction == "up") { $tmp_value = $tmp_value + 1; }
if ($direction == "down") { $tmp_value = $tmp_value - 1; }
//echo "volume $tmp_value<br />\n";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
}
*/
//connect to the event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//send the command over event socket
if ($fp) {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
}
}
?>
+143
View File
@@ -0,0 +1,143 @@
<?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('active_queues_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get the fifo_name from http and set it to a php variable
$fifo_name = trim($_REQUEST["c"]);
//if not the user is not a member of the superadmin then restrict to viewing their own domain
if (!if_group("superadmin")) {
if (stripos($fifo_name, $_SESSION['domain_name']) === false) {
echo "access denied";
exit;
}
}
//remove the domain from fifo name
$tmp_fifo_name = str_replace('_', ' ', $fifo_name);
$tmp_fifo_array = explode('@', $tmp_fifo_name);
$tmp_fifo_name = $tmp_fifo_array[0];
//show 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_reponse').innerHTML = this.xmlHttp.responseText;
}
var requestTime = function() {
var url = 'v_fifo_interactive_inc.php?c=<?php echo trim($_REQUEST["c"]); ?>';
new loadXmlHttp(url, 'ajax_reponse');
setInterval(function(){new loadXmlHttp(url, 'ajax_reponse');}, 1222);
}
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_reponse').innerHTML=xmlhttp.responseText;
}
var record_count = 0;
</script>
<?php
echo "<div align='center'>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>Queues</b><br>\n";
echo " Use this to monitor queue activty for the <strong>$tmp_fifo_name</strong> queue.\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
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_reponse\"></div>\n";
echo " <div id=\"time_stamp\" style=\"visibility:hidden\">".date('Y-m-d-s')."</div>\n";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
?>
+206
View File
@@ -0,0 +1,206 @@
<?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('active_queues_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//set variables
$fifo_name = trim($_REQUEST["c"]);
//if not the user is not a member of the superadmin then restrict to viewing their own domain
if (!if_group("superadmin")) {
if (stripos($fifo_name, $_SESSION['domain_name']) === false) {
echo "access denied";
exit;
}
}
//prepare and send the api command over event socket
$switch_cmd = 'fifo list_verbose '.$fifo_name.'';
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
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 {
//send the api command over event socket
$xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
//parse the response as xml
try {
$xml = new SimpleXMLElement($xml_str);
}
catch(Exception $e) {
//echo $e->getMessage();
}
//set variables from the xml
//$name = $xml->conference['name'];
//$member_count = $xml->conference['member-count'];
//$locked = $xml->conference['locked'];
//set the alternating row styles
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//response div tag
echo "<div id='cmd_reponse'>\n";
echo "</div>\n";
//show the content
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
/*
echo "<tr>\n";
echo "<td >\n";
//echo " <strong>Count: $member_count</strong>\n";
echo "</td>\n";
echo "<td colspan='7'>\n";
echo " &nbsp;\n";
echo "</td>\n";
echo "<td colspan='1' align='right'>\n";
echo " <strong>Queues Tools:</strong> \n";
echo " <a href='javascript:void(0);' onclick=\"record_count++;send_cmd('v_conference_exec.php?cmd=conference%20".$conference_name." record recordings/conference_".$conference_name."-'+document.getElementById('time_stamp').innerHTML+'_'+record_count+'.wav');\">Start Record</a>&nbsp;\n";
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?cmd=conference%20".$conference_name." norecord recordings/conference_".$conference_name."-'+document.getElementById('time_stamp').innerHTML+'_'+record_count+'.wav');\">Stop Record</a>&nbsp;\n";
if ($locked == "true") {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?cmd=conference%20".$conference_name." unlock');\">Unlock</a>&nbsp;\n";
}
else {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?cmd=conference%20".$conference_name." lock');\">Lock</a>&nbsp;\n";
}
echo "</td>\n";
echo "</tr>\n";
*/
echo "<tr>\n";
echo "<th>Username</th>\n";
//echo "<th>Dialplan</th>\n";
echo "<th>Caller ID Name</th>\n";
echo "<th>Caller ID Number</th>\n";
echo "<th>Language</th>\n";
//echo "<th>ANI</th>\n";
//echo "<th>ANIII</th>\n";
//echo "<th>Network Addr</th>\n";
echo "<th>Destination Number</th>\n";
//echo "<th>RDNIS</th>\n";
//echo "<th>UUID</th>\n";
//echo "<th>Source</th>\n";
//echo "<th>Context</th>\n";
//echo "<th>Chan Name</th>\n";
echo "<th>Position</th>\n";
echo "<th>Priority</th>\n";
echo "<th>Status</th>\n";
echo "<th>Duration</th>\n";
echo "</tr>\n";
foreach ($xml->fifo->callers->caller as $row) {
/*
$username = $row->caller_profile->username;
$dialplan = $row->caller_profile->dialplan;
$caller_id_name = urldecode($row->caller_profile->caller_id_name);
$caller_id_number = $row->caller_profile->caller_id_number;
$ani = $row->caller_profile->ani;
$aniii = $row->caller_profile->aniii;
$network_addr = $row->caller_profile->network_addr;
$destination_number = $row->destination_number->rdnis;
$rdnis = $row->caller_profile->rdnis;
$uuid = $row->caller_profile->uuid;
$source = $row->caller_profile->source;
$context = $row->caller_profile->context;
$chan_name = $row->caller_profile->chan_name;
$default_language = $row->variables->default_language;
$fifo_position = $row->variables->fifo_position;
$fifo_priority = $row->variables->fifo_priority;
$fifo_status = $row->variables->fifo_status;
$fifo_timestamp = urldecode($row->variables->fifo_timestamp);
$fifo_time = strtotime($fifo_timestamp);
$fifo_duration = time() - $fifo_time;
$fifo_duration_formatted = str_pad(intval(intval($fifo_duration/3600)),2,"0",STR_PAD_LEFT).":" . str_pad(intval(($fifo_duration / 60) % 60),2,"0",STR_PAD_LEFT).":" . str_pad(intval($fifo_duration % 60),2,"0",STR_PAD_LEFT) ;
*/
$username = $row->cdr->callflow->caller_profile->username;
$dialplan = $row->cdr->callflow->caller_profile->dialplan;
$caller_id_name = urldecode($row->cdr->callflow->caller_profile->caller_id_name);
$caller_id_number = $row->cdr->callflow->caller_profile->caller_id_number;
$ani = $row->cdr->callflow->caller_profile->ani;
$aniii = $row->cdr->callflow->caller_profile->aniii;
$network_addr = $row->cdr->callflow->caller_profile->network_addr;
$destination_number = $row->cdr->callflow->caller_profile->destination_number;
$rdnis = $row->cdr->callflow->caller_profile->rdnis;
$uuid = $row->cdr->callflow->caller_profile->uuid;
$source = $row->cdr->callflow->caller_profile->source;
$context = $row->cdr->callflow->caller_profile->context;
$chan_name = $row->cdr->callflow->caller_profile->chan_name;
$default_language = $row->cdr->variables->default_language;
$fifo_position = $row->cdr->variables->fifo_position;
$fifo_priority = $row->cdr->variables->fifo_priority;
$fifo_status = $row->cdr->variables->fifo_status;
$fifo_timestamp = urldecode($row->cdr->variables->fifo_timestamp);
$fifo_time = strtotime($fifo_timestamp);
$fifo_duration = time() - $fifo_time;
$fifo_duration_formatted = str_pad(intval(intval($fifo_duration/3600)),2,"0",STR_PAD_LEFT).":" . str_pad(intval(($fifo_duration / 60) % 60),2,"0",STR_PAD_LEFT).":" . str_pad(intval($fifo_duration % 60),2,"0",STR_PAD_LEFT) ;
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$username &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$dialplan &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$caller_id_name &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$caller_id_number &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$default_language &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$ani &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$aniii &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$network_addr &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$destination_number &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$rdnis &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$uuid &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$source &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$context &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$chan_name &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$fifo_position &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$fifo_priority &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$fifo_status &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$fifo_duration_formatted &nbsp;</td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
}
echo "</table>\n";
}
?>
+112
View File
@@ -0,0 +1,112 @@
<?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('active_queues_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
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_reponse').innerHTML = this.xmlHttp.responseText;
}
var requestTime = function() {
var url = 'v_fifo_list_inc.php';
new loadXmlHttp(url, 'ajax_reponse');
setInterval(function(){new loadXmlHttp(url, 'ajax_reponse');}, 1777);
}
if (window.addEventListener) {
window.addEventListener('load', requestTime, false);
}
else if (window.attachEvent) {
window.attachEvent('onload', requestTime);
}
</script>
<?php
echo "<div align='center'>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>Active Queues</b><br>\n";
echo " List all the queues that are currently active with one or more callers.\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
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_reponse\">\n";
echo " </div>\n";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
?>
+121
View File
@@ -0,0 +1,121 @@
<?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('active_queues_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
$switch_cmd = 'fifo list';
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
try {
$xml = new SimpleXMLElement($xml_str);
}
catch(Exception $e) {
//echo $e->getMessage();
}
/*
<fifo_report>
<fifo name="5900@voip.fusionpbx.com" consumer_count="0" caller_count="1" waiting_count="1" importance="0">
<callers>
<caller uuid="73a9324f-2a87-df11-bedf-0019dbe93b1f" status="WAITING" timestamp="2010-07-04 05:09:23">
<caller_profile></caller_profile>
</caller>
</callers>
<consumers></consumers>
</fifo>
<fifo name="cool_fifo@voip.fusionpbx.com" consumer_count="0" caller_count="0" waiting_count="0" importance="0">
<callers></callers>
<consumers></consumers>
</fifo>
</fifo_report>
*/
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>Name</th>\n";
echo "<th>Consumer Count</th>\n";
echo "<th>Caller Count</th>\n";
echo "<th>Waiting Count</th>\n";
echo "<th>Importance</th>\n";
echo "<th>&nbsp;</th>\n";
echo "</tr>\n";
foreach ($xml->fifo as $row) {
foreach($row->attributes() as $tmp_name => $tmp_value) {
$$tmp_name = $tmp_value;
}
unset($tmp_name, $tmp_value);
//remove the domain from name
$tmp_name = str_replace('_', ' ', $name);
$tmp_name_array = explode('@', $name);
$tmp_name = $tmp_name_array[0];
if (if_group("superadmin")) {
//show all fifo queues
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tmp_name."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$consumer_count."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$caller_count."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$waiting_count."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$importance."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'><a href='v_fifo_interactive.php?c=".$name."'>view</a></td>\n";
echo "</tr>\n";
}
else {
//show only the fifo queues that match the domain_name
if (stripos($name, $_SESSION['domain_name']) !== false) {
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tmp_name."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$consumer_count."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$caller_count."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$waiting_count."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$importance."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'><a href='v_fifo_interactive.php?c=".$name."'>view</a></td>\n";
echo "</tr>\n";
}
}
if ($c==0) { $c=1; } else { $c=0; }
}
echo "</table>\n";
}
?>