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

View File

@@ -0,0 +1,75 @@
<?php
//application details
$apps[$x]['name'] = "Active Calls";
$apps[$x]['uuid'] = 'ec8530a9-903a-469d-3717-281f798b9ef6';
$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'] = 'Active channels on the system.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Active Calls';
$apps[$x]['menu'][0]['uuid'] = 'eba3d07f-dd5c-6b7b-6880-493b44113ade';
$apps[$x]['menu'][0]['parent_uuid'] = '0438b504-8613-7887-c420-c837ffb20cb1';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/calls_active/v_calls_active.php';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
$apps[$x]['menu'][1]['title']['en'] = 'Active Extensions';
$apps[$x]['menu'][1]['uuid'] = '6dd85c19-cb6b-5cca-bf32-499bbe936f79';
$apps[$x]['menu'][1]['parent_uuid'] = '0438b504-8613-7887-c420-c837ffb20cb1';
$apps[$x]['menu'][1]['category'] = 'internal';
$apps[$x]['menu'][1]['path'] = '/app/calls_active/v_calls_active_extensions.php';
//$apps[$x]['menu'][1]['groups'][] = 'user';
$apps[$x]['menu'][1]['groups'][] = 'admin';
$apps[$x]['menu'][1]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'calls_active_view';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'calls_active_transfer';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'calls_active_hangup';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'calls_active_park';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
$apps[$x]['permissions'][4]['name'] = 'calls_active_rec';
$apps[$x]['permissions'][4]['groups'][] = 'superadmin';
$apps[$x]['permissions'][5]['name'] = 'extensions_active_view';
$apps[$x]['permissions'][5]['groups'][] = 'user';
$apps[$x]['permissions'][5]['groups'][] = 'admin';
$apps[$x]['permissions'][5]['groups'][] = 'superadmin';
$apps[$x]['permissions'][6]['name'] = 'extensions_active_transfer';
$apps[$x]['permissions'][6]['groups'][] = 'admin';
$apps[$x]['permissions'][6]['groups'][] = 'superadmin';
$apps[$x]['permissions'][7]['name'] = 'extensions_active_hangup';
$apps[$x]['permissions'][7]['groups'][] = 'admin';
$apps[$x]['permissions'][7]['groups'][] = 'superadmin';
$apps[$x]['permissions'][8]['name'] = 'extensions_active_park';
$apps[$x]['permissions'][8]['groups'][] = 'admin';
$apps[$x]['permissions'][8]['groups'][] = 'superadmin';
$apps[$x]['permissions'][9]['name'] = 'extensions_active_rec';
$apps[$x]['permissions'][9]['groups'][] = 'admin';
$apps[$x]['permissions'][9]['groups'][] = 'superadmin';
$apps[$x]['permissions'][10]['name'] = 'extensions_active_list_view';
//$apps[$x]['permissions'][10]['groups'][] = 'user';
$apps[$x]['permissions'][10]['groups'][] = 'admin';
$apps[$x]['permissions'][10]['groups'][] = 'superadmin';
$apps[$x]['permissions'][11]['name'] = 'extensions_active_assigned_view';
//$apps[$x]['permissions'][11]['groups'][] = 'user';
$apps[$x]['permissions'][11]['groups'][] = 'admin';
$apps[$x]['permissions'][11]['groups'][] = 'superadmin';
?>

50
app/calls_active/root.php Normal file
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'] );
}
?>

View File

@@ -0,0 +1,165 @@
<?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('calls_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
$conference_name = trim($_REQUEST["c"]);
$tmp_conference_name = str_replace("_", " ", $conference_name);
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_calls_active_inc.php?c=<?php echo trim($_REQUEST["c"]); ?>';
new loadXmlHttp(url, 'ajax_reponse');
setInterval(function(){new loadXmlHttp(url, 'ajax_reponse');}, 1500);
}
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;
var cmd;
var destination;
</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 Calls</b><br>\n";
echo " Use this to monitor and interact with the active calls.\n";
echo " </td>\n";
echo " <td align='right'>\n";
echo " <table>\n";
echo " <td align='left' valign='middle'>\n";
echo " <div id=\"form_label\">\n";
echo " <div id=\"url\"></div>\n";
echo " </td>\n";
echo " <td align='left' valign='middle'>\n";
echo " <div id=\"form_label\"></div><input type=\"text\" id=\"form_value\" name=\"form_value\" />\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\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>\n";
echo "<script type=\"text/javascript\">\n";
echo "<!--\n";
echo "function get_transfer_cmd(uuid) {\n";
echo " destination = document.getElementById('form_value').value;\n";
echo " cmd = \"uuid_transfer \"+uuid+\" -bleg \"+destination+\" xml ".$_SESSION['user_context']."\";\n";
echo " return escape(cmd);\n";
echo "}\n";
echo "\n";
echo "function get_park_cmd(uuid) {\n";
echo " cmd = \"uuid_transfer \"+uuid+\" -bleg *6000 xml ".$_SESSION['user_context']."\";\n";
echo " return escape(cmd);\n";
echo "}\n";
echo "\n";
echo "function get_record_cmd(uuid, prefix, name) {\n";
echo " cmd = \"uuid_record \"+uuid+\" start ".$_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/\"+uuid+\".wav\";\n";
echo " return escape(cmd);\n";
echo "}\n";
echo "-->\n";
echo "</script>\n";
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,231 @@
<?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('extensions_active_assigned_view')) {
//http get and set variables
if (strlen($_GET['url']) > 0) {
$url = $_GET['url'];
}
echo "<table width='100%' border='0' cellpadding='5' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td valign='top'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th width='50px;'>Ext</th>\n";
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo "<th>Status</th>\n";
}
echo "<th>Time</th>\n";
//echo "<th>Direction</th>\n";
//echo "<th>Profile</th>\n";
echo "<th>CID Name</th>\n";
echo "<th>CID Number</th>\n";
echo "<th>Dest</th>\n";
echo "<th>Application</th>\n";
echo "<th>Secure</th>\n";
echo "<th>Name</th>\n";
echo "<th>Options</th>\n";
echo "</tr>\n";
foreach ($_SESSION['extension_array'] as $row) {
$domain_uuid = $row['domain_uuid'];
$extension = $row['extension'];
$enabled = $row['enabled'];
$effective_caller_id_name = $row['effective_caller_id_name'];
foreach ($_SESSION['user']['extension'] as &$user_row) {
if ($extension == $user_row['user']) {
$found_extension = false;
$x = 1;
foreach ($channels_array as $row) {
//set the php variables
foreach ($row as $key => $value) {
$$key = $value;
}
//find the matching extensions
if ($number == $extension) {
//set the found extension to true
$found_extension = true;
break;
}
} //end foreach
if ($number == $extension) {
if ($application == "conference") {
$alt_color = "background-image: url('".PROJECT_PATH."/images/background_cell_active.gif";
}
switch ($application) {
case "conference":
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_conference.gif');\"";
break;
case "fifo":
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_fifo.gif');\"";
break;
case "valet_park":
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_fifo.gif');\"";
break;
default:
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_active.gif');\"";
}
echo "<tr>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>$extension</td>\n";
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo "<td class='".$row_style[$c]."' $style_alternate>".$user_array[$extension]['user_status']."&nbsp;</td>\n";
}
echo "<td class='".$row_style[$c]."' $style_alternate width='20px;'>".$call_length."</td>\n";
if (strlen($url) == 0) {
$url = PROJECT_PATH."/app/contacts/contacts.php?search_all={cid_num}";
}
$url = str_replace ("{cid_num}", $cid_num, $url);
$url = str_replace ("{cid_name}", $cid_name, $url);
echo "<td class='".$row_style[$c]."' $style_alternate><a href='".$url."' style='color: #444444;' target='_blank'>".$cid_name."</a></td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate><a href='".$url."' style='color: #444444;' target='_blank'>".$cid_num."</a></td>\n";
//get the active uuid list
if (strlen($uuid) > 1) {
if (strlen($uuid_1) == 0) {
$uuid_1 = $uuid;
//$direction_1 = $direction;
$cid_name_1 = $cid_name;
$cid_num_1 = $cid_num;
}
if (strlen($uuid_1) > 0 && $uuid != $uuid_1) {
$uuid_2 = $uuid;
//$direction_2 = $direction;
$cid_name_2 = $cid_name;
$cid_num_2 = $cid_num;
}
}
echo "<td class='".$row_style[$c]."' $style_alternate>\n";
if ($application == "valet_park") {
echo $valet_array[trim($uuid)]['extension']."\n";
}
else {
echo $dest."&nbsp;\n";
}
echo "</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>\n";
if ($application == "fifo") {
echo "queue &nbsp;\n";
}
else {
echo $application."&nbsp;\n";
}
echo "</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>\n";
echo "".$secure."&nbsp;\n";
echo "</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>\n";
echo "".$effective_caller_id_name."&nbsp;\n";
echo "</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
//transfer
echo " <a href='javascript:void(0);' style='color: #444444;' onMouseover=\"document.getElementById('form_label').innerHTML='<strong>Transfer To</strong>';\" onclick=\"send_cmd('v_calls_exec.php?cmd='+get_transfer_cmd(escape('$uuid')));\">transfer</a>&nbsp;\n";
//park
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_park_cmd(escape('$uuid')));\">park</a>&nbsp;\n";
//hangup
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('Do you really want to hangup this call?');if (confirm_response){send_cmd('v_calls_exec.php?cmd=uuid_kill%20'+(escape('$uuid')));}\">hangup</a>&nbsp;\n";
//record start/stop
$tmp_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$uuid.".wav";
if (file_exists($tmp_file)) {
//stop
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_record_cmd(escape('$uuid'), 'active_extensions_', escape('$cid_num'))+'&uuid='+escape('$uuid')+'&action=record&action2=stop&prefix=active_extensions_&name='+escape('$cid_num'));\">stop record</a>&nbsp;\n";
}
else {
//start
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_record_cmd(escape('$uuid'), 'active_extensions_', escape('$cid_num'))+'&uuid='+escape('$uuid')+'&action=record&action2=start&prefix=active_extensions_');\">start record</a>&nbsp;\n";
}
echo " &nbsp;";
echo "</td>\n";
echo "</tr>\n";
}
else {
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_light.gif');\"";
echo "<tr>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>$extension</td>\n";
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo "<td class='".$row_style[$c]."' $style_alternate>".$user_array[$extension]['user_status']."&nbsp;</td>\n";
}
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
echo " &nbsp;";
echo "</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
echo " &nbsp;";
echo "</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
echo " &nbsp;";
echo "</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
echo " &nbsp;";
echo "</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
echo " &nbsp;";
echo "</td>\n";
echo "</tr>\n";
}
if ($c==0) { $c=1; } else { $c=0; }
} //end if
} //end foreach
}
echo "</table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<span id='uuid_1' style='visibility:hidden;'>$uuid_1</span>\n";
//echo "<span id='direction_1' style='visibility:hidden;'>$direction_1</span>\n";
echo "<span id='cid_name_1' style='visibility:hidden;'>$cid_name_1</span>\n";
echo "<span id='cid_num_1' style='visibility:hidden;'>$cid_num_1</span>\n";
echo "<span id='uuid_2' style='visibility:hidden;'>$uuid_2</span>\n";
//echo "<span id='direction_2' style='visibility:hidden;'>$direction_2</span>\n";
echo "<span id='cid_name_2' style='visibility:hidden;'>$cid_name_2</span>\n";
echo "<span id='cid_num_2' style='visibility:hidden;'>$cid_num_2</span>\n";
echo "<br />\n";
}
?>

View File

@@ -0,0 +1,337 @@
<?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('extensions_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//http get and set variables
$event_type = $_GET['event_type']; //open_window //iframe
if ($event_type=="iframe") {
$iframe_width = $_GET['iframe_width'];
$iframe_height = $_GET['iframe_height'];
$iframe_postition = $_GET['iframe_postition'];
if (strlen($iframe_postition) > 0) { $iframe_postition = 'right'; }
if (strlen($iframe_width) > 0) { $iframe_width = '25%'; }
if (strlen($iframe_height) > 0) { $iframe_height = '100%'; }
}
if (strlen($_GET['url']) > 0) {
$url = $_GET['url'];
}
if (strlen($_GET['rows']) > 0) {
$rows = $_GET['rows'];
}
else {
$rows = 0;
}
$conference_name = trim($_REQUEST["c"]);
$tmp_conference_name = str_replace("_", " ", $conference_name);
require_once "includes/header.php";
?><script type="text/javascript">
<!--
//declare variables
var previous_uuid_1 = '';
var previous_uuid_2 = '';
var url = '<?php echo $url; ?>';
//define the ajax function
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)))
document.getElementById('ajax_reponse').innerHTML = this.xmlHttp.responseText;
if (document.getElementById('uuid_1')) {
uuid_1 = document.getElementById('uuid_1').innerHTML;
}
else {
uuid_1 = "";
}
if (document.getElementById('direction_1')) {
direction_1 = document.getElementById('direction_1').innerHTML;
}
else {
direction_1 = "";
}
if (document.getElementById('cid_name_1')) {
cid_name_1 = document.getElementById('cid_name_1').innerHTML;
}
else {
cid_name_1 = "";
}
if (document.getElementById('cid_num_1')) {
cid_num_1 = document.getElementById('cid_num_1').innerHTML;
}
else {
cid_num_1 = "";
}
//get the user_status from the database
if (document.getElementById('db_user_status')) {
db_user_status = document.getElementById('db_user_status').innerHTML;
}
if (previous_uuid_1 != uuid_1) {
if (cid_num_1.length > 6) {
var new_url = url;
new_url = new_url.replace("{cid_name}", cid_name_1);
new_url = new_url.replace("{cid_num}", cid_num_1);
new_url = new_url.replace("{uuid}", uuid_1);
previous_uuid_1 = uuid_1;
<?php
if ($event_type=="open_window") {
echo "open_window = window.open(new_url,'width='+window.innerWidth+',height='+window.innerHeight+',left=0px;toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');";
echo "if (window.focus) {open_window.focus()}\n";
}
if ($event_type=="iframe") {
echo "document.getElementById('iframe1').src = new_url;\n";
//iframe_postition
//iframe_width
//iframe_height
}
?>
}
else {
//hangup or initial page load detected
}
previous_uuid_1 = uuid_1;
}
}
var requestTime = function() {
<?php
echo "var url = 'v_calls_active_extensions_inc.php?". $_SERVER["QUERY_STRING"]."';\n";
echo "new loadXmlHttp(url, 'ajax_reponse');\n";
if (strlen($_SESSION["ajax_refresh_rate"]) == 0) { $_SESSION["ajax_refresh_rate"] = "900"; }
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_reponse').innerHTML=xmlhttp.responseText;
}
var record_count = 0;
var cmd;
var destination;
// -->
</script>
<?php
echo "<div align='center'>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left' colspan='2' nowrap='nowrap'>\n";
echo " <b>Active Extensions</b><br>\n";
echo " </td>\n";
//get the user status when the page loads
$sql = "";
$sql .= "select * from v_users ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '".$_SESSION['username']."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$user_status = $row["user_status"];
break; //limit to 1 row
}
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo " <td class='' width='40%'>\n";
echo " &nbsp;";
echo " </td>\n";
echo " <td class='' valign='bottom' align='right' style='width:200px' nowrap='nowrap'>\n";
//status list
echo " &nbsp;";
echo " <strong>Status</strong>&nbsp;\n";
$cmd = "'v_calls_exec.php?action=user_status&data='+this.value+'";
$cmd .= "&cmd=callcenter_config+agent+set+status+".$_SESSION['username']."@".$_SESSION['domain_name']."+'+this.value";
echo " <select id='agent_status' name='agent_status' class='formfld' style='width:125px' nowrap='nowrap' onchange=\"send_cmd($cmd);\">\n";
echo " <option value=' '></option>\n";
if ($user_status == "Available") {
echo " <option value='Available' selected='selected'>Available</option>\n";
}
else {
echo " <option value='Available'>Available</option>\n";
}
if ($user_status == "Available (On Demand)") {
echo " <option value='Available_On_Demand' selected='selected'>Available (On Demand)</option>\n";
}
else {
echo " <option value='Available_On_Demand'>Available (On Demand)</option>\n";
}
if ($user_status == "Logged Out") {
echo " <option value='Logged_Out' selected='selected'>Logged Out</option>\n";
}
else {
echo " <option value='Logged_Out'>Logged Out</option>\n";
}
if ($user_status == "On Break") {
echo " <option value='On_Break' selected='selected'>On Break</option>\n";
}
else {
echo " <option value='On_Break'>On Break</option>\n";
}
if ($user_status == "Do Not Disturb") {
echo " <option value='Do_Not_Disturb' selected='selected'>Do Not Disturb</option>\n";
}
else {
echo " <option value='Do_Not_Disturb'>Do Not Disturb</option>\n";
}
echo " </select>\n";
echo " </td>\n";
}
echo " <td align='right' nowrap='nowrap'>\n";
echo " &nbsp;";
echo " <strong>Transfer To</strong>\n";
echo " <input type=\"text\" id=\"form_value\" name=\"form_value\" class='formfld' style='width:125px'/>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='99'>\n";
echo " Use this to view all extensions and monitor and interact with active calls.\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<div id=\"url\"></div>\n";
echo "<br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo " <tr class='border'>\n";
if ($event_type=="iframe") {
echo " <td align=\"left\" width='".$iframe_width."'>\n";
}
else {
echo " <td align=\"left\" width='100%'>\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>\n";
if ($event_type=="iframe") {
echo "</td>\n";
echo "<td width='".$iframe_width."' height='".$iframe_height."'>\n";
echo " <iframe src ='$url' width='100%' id='iframe1' height='100%' frameborder=0>\n";
echo " <p>Your browser does not support iframes.</p>\n";
echo " </iframe>\n";
echo "</td>\n";
}
echo " </tr>";
echo "</table>";
echo "</div>\n";
echo "<script type=\"text/javascript\">\n";
echo "<!--\n";
echo "function get_transfer_cmd(uuid) {\n";
echo " destination = document.getElementById('form_value').value;\n";
echo " if (destination.length > 1) { \n";
echo " cmd = \"uuid_transfer \"+uuid+\" -bleg \"+destination+\" xml ".$_SESSION['user_context']."\";\n";
echo " }\n";
echo " else {\n";
echo " cmd = '';\n";
echo " alert(\"Please provide a number to transfer the call to.\");\n";
echo " }\n";
echo " return escape(cmd);\n";
echo "}\n";
echo "\n";
echo "function get_park_cmd(uuid) {\n";
echo " cmd = \"uuid_transfer \"+uuid+\" -bleg *6000 xml ".$_SESSION['user_context']."\";\n";
echo " return escape(cmd);\n";
echo "}\n";
echo "\n";
echo "function get_record_cmd(uuid, prefix, name) {\n";
echo " cmd = \"uuid_record \"+uuid+\" start ".$_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/\"+uuid+\".wav\";\n";
echo " return escape(cmd);\n";
echo "}\n";
echo "-->\n";
echo "</script>\n";
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,561 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
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('extensions_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//set debug to true or false
$debug = false;
//http get and set variables
if (strlen($_GET['url']) > 0) {
$url = $_GET['url'];
}
if (strlen($_GET['rows']) == 0) {
$_GET['rows'] = 0;
}
//define variables
$c = 0;
$row_style["0"] = "row_style1";
$row_style["1"] = "row_style1";
//get the user status
$sql = "";
$sql .= "select e.extension, u.username, u.user_status ";
$sql .= "from v_users as u, v_extensions as e ";
$sql .= "where e.domain_uuid = '$domain_uuid' ";
$sql .= "and u.domain_uuid = '$domain_uuid' ";
if (!(if_group("admin") || if_group("superadmin"))) {
if (count($_SESSION['user']['extension']) > 0) {
$sql .= "and (";
$x = 0;
foreach($_SESSION['user']['extension'] as $row) {
if ($x > 0) { $sql .= "or "; }
$sql .= "e.extension = '".$row['user']."' ";
$x++;
}
$sql .= ")";
}
else {
//hide any results when a user has not been assigned an extension
$sql .= "and extension = 'disabled' ";
}
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$x = 0;
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
if (strlen($row["user_status"]) > 0) {
$user_array[$row["extension"]]['username'] = $row["username"];
$user_array[$row["extension"]]['user_status'] = $row["user_status"];
$username_array[$row["username"]]['user_status'] = $row["user_status"];
if ($row["username"] == $_SESSION["username"]) {
$user_status = $row["user_status"];
}
}
$x++;
}
unset ($prep_statement, $x);
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//get information over event socket
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 agent list from event socket
$switch_cmd = 'callcenter_config agent list';
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$agent_array = csv_to_named_array($event_socket_str, '|');
//set the status on the user_array by using the extension as the key
foreach ($agent_array as $row) {
if (count($_SESSION['domains']) == 1) {
//get the extension status from the call center agent list
preg_match('/user\/(\d{2,7})/', $row['contact'], $matches);
$extension = $matches[1];
$user_array[$extension]['username'] = $tmp[0];
if ($user_array[$extension]['user_status'] != "Do Not Disturb") {
$user_array[$extension]['user_status'] = $row['status'];
}
} else {
$tmp = explode('@',$row["name"]);
if ($tmp[1] == $_SESSION['domain_name']) {
//get the extension status from the call center agent list
preg_match('/user\/(\d{2,7})/', $row['contact'], $matches);
$extension = $matches[1];
$user_array[$extension]['username'] = $tmp[0];
if ($user_array[$extension]['user_status'] != "Do Not Disturb") {
$user_array[$extension]['user_status'] = $row['status'];
}
}
}
}
//send the api command over event socket
$switch_cmd = 'valet_info';
$valet_xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
//parse the xml
try {
$valet_xml = new SimpleXMLElement($valet_xml_str);
}
catch(Exception $e) {
//echo $e->getMessage();
}
$valet_xml = new SimpleXMLElement($valet_xml_str);
foreach ($valet_xml as $row) {
$valet_name = (string) $row->attributes()->name;
foreach ($row->extension as $row2) {
$extension = (string) $row2;
$uuid = (string) $row2->attributes()->uuid;
$uuid = trim($uuid);
$valet_array[$uuid]['name'] = $valet_name;
$valet_array[$uuid]['extension'] = $extension;
}
}
//send the event socket command
$switch_cmd = 'show channels as xml';
$xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
//parse the xml
try {
$xml = new SimpleXMLElement($xml_str);
}
catch(Exception $e) {
//echo $e->getMessage();
}
//active channels array
$channels_array = '';
$x = 1;
foreach ($xml as $row) {
//set the original array id
$channels_array[$x]['x'] = $x;
//get the values from xml and set them to the channel array
$channels_array[$x]['uuid'] = $row->uuid;
$channels_array[$x]['direction'] = $row->direction;
$channels_array[$x]['created'] = $row->created;
$channels_array[$x]['created_epoch'] = $row->created_epoch;
$channels_array[$x]['name'] = $row->name;
$channels_array[$x]['state'] = $row->state;
$channels_array[$x]['cid_name'] = $row->cid_name;
$channels_array[$x]['cid_num'] = $row->cid_num;
$channels_array[$x]['ip_addr'] = $row->ip_addr;
$channels_array[$x]['dest'] = $row->dest;
$channels_array[$x]['application'] = $row->application;
$channels_array[$x]['application_data'] = $row->application_data;
$channels_array[$x]['dialplan'] = $row->dialplan;
$channels_array[$x]['context'] = $row->context;
$channels_array[$x]['read_codec'] = $row->read_codec;
$channels_array[$x]['read_rate'] = $row->read_rate;
$channels_array[$x]['read_bit_rate'] = $row->read_bit_rate;
$channels_array[$x]['write_codec'] = $row->write_codec;
$channels_array[$x]['write_rate'] = $row->write_rate;
$channels_array[$x]['write_bit_rate'] = $row->write_bit_rate;
$channels_array[$x]['secure'] = $row->secure;
$channels_array[$x]['hostname'] = $row->hostname;
$channels_array[$x]['presence_id'] = $row->presence_id;
$channels_array[$x]['presence_data'] = $row->presence_data;
$channels_array[$x]['callstate'] = $row->callstate;
$channels_array[$x]['callee_name'] = $row->callee_name;
$channels_array[$x]['callee_num'] = $row->callee_num;
$channels_array[$x]['callee_direction'] = $row->callee_direction;
$channels_array[$x]['call_uuid'] = $row->call_uuid;
//remove other domains
if (count($_SESSION["domains"]) > 1) {
//unset domains that are not related to this tenant
$temp_array = explode("@", $channels_array[$x]['presence_id']);
if ($temp_array[1] != $_SESSION['domain_name']) {
unset($channels_array[$x]);
}
}
//parse some of the php variables\
$temp_array = explode("@", $channels_array[$x]['presence_id']);
$channels_array[$x]['number'] = $temp_array[0];
//remove the '+' because it breaks the call recording
$channels_array[$x]['cid_num'] = $temp_array[0] = str_replace("+", "", $channels_array[$x]['cid_num']);
//calculate and set the call length
$call_length_seconds = time() - $channels_array[$x]['created_epoch'];
$call_length_hour = floor($call_length_seconds/3600);
$call_length_min = floor($call_length_seconds/60 - ($call_length_hour * 60));
$call_length_sec = $call_length_seconds - (($call_length_hour * 3600) + ($call_length_min * 60));
$call_length_min = sprintf("%02d", $call_length_min);
$call_length_sec = sprintf("%02d", $call_length_sec);
$call_length = $call_length_hour.':'.$call_length_min.':'.$call_length_sec;
$channels_array[$x]['call_length'] = $call_length;
//valet park
if (is_array($valet_array[$uuid])) {
$valet_array[$uuid]['context'] = $channels_array[$x]['context'];
$valet_array[$uuid]['cid_name'] = $channels_array[$x]['cid_name'];
$valet_array[$uuid]['cid_num'] = $channels_array[$x]['cid_num'];
$valet_array[$uuid]['call_length'] = $call_length;
}
//increment the array index
$x++;
}
//active extensions
//get the extension information
if ($debug) {
unset($_SESSION['extension_array']);
}
if (count($_SESSION['extension_array']) == 0) {
$sql = "";
$sql .= "select * from v_extensions ";
$x = 0;
$range_array = $_GET['range'];
foreach($range_array as $tmp_range) {
$tmp_range = str_replace(":", "-", $tmp_range);
$tmp_array = explode("-", $tmp_range);
$tmp_min = $tmp_array[0];
$tmp_max = $tmp_array[1];
if ($x == 0) {
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension >= $tmp_min ";
$sql .= "and extension <= $tmp_max ";
$sql .= "and enabled = 'true' ";
}
else {
$sql .= "or domain_uuid = '$domain_uuid' ";
$sql .= "and extension >= $tmp_min ";
$sql .= "and extension <= $tmp_max ";
$sql .= "and enabled = 'true' ";
}
$x++;
}
if (count($range_array) == 0) {
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and enabled = 'true' ";
}
$sql .= "order by extension asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
if ($row["enabled"] == "true") {
$extension = $row["extension"];
$extension_array[$extension]['domain_uuid'] = $row["domain_uuid"];
$extension_array[$extension]['extension'] = $row["extension"];
//$extension_array[$extension]['password'] = $row["password"];
$extension_array[$extension]['mailbox'] = $row["mailbox"];
//$vm_password = $row["vm_password"];
//$vm_password = str_replace("#", "", $vm_password); //preserves leading zeros
//$_SESSION['extension_array'][$extension]['vm_password'] = $vm_password;
$extension_array[$extension]['accountcode'] = $row["accountcode"];
$extension_array[$extension]['effective_caller_id_name'] = $row["effective_caller_id_name"];
$extension_array[$extension]['effective_caller_id_number'] = $row["effective_caller_id_number"];
$extension_array[$extension]['outbound_caller_id_name'] = $row["outbound_caller_id_name"];
$extension_array[$extension]['outbound_caller_id_number'] = $row["outbound_caller_id_number"];
$extension_array[$extension]['vm_enabled'] = $row["vm_enabled"];
$extension_array[$extension]['vm_mailto'] = $row["vm_mailto"];
$extension_array[$extension]['vm_attach_file'] = $row["vm_attach_file"];
$extension_array[$extension]['vm_keep_local_after_email'] = $row["vm_keep_local_after_email"];
$extension_array[$extension]['user_context'] = $row["user_context"];
$extension_array[$extension]['call_group'] = $row["call_group"];
$extension_array[$extension]['auth_acl'] = $row["auth_acl"];
$extension_array[$extension]['cidr'] = $row["cidr"];
$extension_array[$extension]['sip_force_contact'] = $row["sip_force_contact"];
//$extension_array[$extension]['enabled'] = $row["enabled"];
$extension_array[$extension]['effective_caller_id_name'] = $row["effective_caller_id_name"];
}
}
$_SESSION['extension_array'] = $extension_array;
}
//get a list of assigned extensions for this user
include "v_calls_active_assigned_extensions_inc.php";
//list all extensions
if (permission_exists('extensions_active_list_view')) {
echo "<table width='100%' border='0' cellpadding='5' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td valign='top'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th width='50px;'>Ext</th>\n";
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo "<th>Status</th>\n";
}
echo "<th>Time</th>\n";
if (if_group("admin") || if_group("superadmin")) {
if (strlen(($_GET['rows'])) == 0) {
echo "<th>CID Name</th>\n";
echo "<th>CID Number</th>\n";
echo "<th>Dest</th>\n";
echo "<th>App</th>\n";
echo "<th>Secure</th>\n";
}
}
echo "<th>Name</th>\n";
if (if_group("admin") || if_group("superadmin")) {
if (strlen(($_GET['rows'])) == 0) {
echo "<th>Options</th>\n";
}
}
echo "</tr>\n";
$x = 1;
foreach ($_SESSION['extension_array'] as $row) {
$domain_uuid = $row['domain_uuid'];
$extension = $row['extension'];
$enabled = $row['enabled'];
$effective_caller_id_name = $row['effective_caller_id_name'];
$found_extension = false;
foreach ($channels_array as $row) {
//set the php variables
foreach ($row as $key => $value) {
$$key = $value;
}
//check to see if the extension is found in the channel array
if ($number == $extension) {
$found_extension = true;
break;
}
}
if ($found_extension) {
if ($application == "conference") {
$alt_color = "background-image: url('".PROJECT_PATH."/images/background_cell_active.gif";
}
switch ($application) {
case "conference":
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_conference.gif');\"";
break;
case "fifo":
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_fifo.gif');\"";
break;
case "valet_park":
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_fifo.gif');\"";
break;
default:
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_active.gif');\"";
}
echo "<tr>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>$extension</td>\n";
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo "<td class='".$row_style[$c]."' $style_alternate>".$user_array[$extension]['user_status']."&nbsp;</td>\n";
}
echo "<td class='".$row_style[$c]."' $style_alternate width='20px;'>".$call_length."</td>\n";
if (if_group("admin") || if_group("superadmin")) {
if (strlen(($_GET['rows'])) == 0) {
if (strlen($url) == 0) {
$url = PROJECT_PATH."/app/contacts/contacts.php?search_all={cid_num}";
}
$url = str_replace ("{cid_num}", $cid_num, $url);
$url = str_replace ("{cid_name}", $cid_name, $url);
echo "<td class='".$row_style[$c]."' $style_alternate><a href='".$url."' style='color: #444444;' target='_blank'>".$cid_name."</a></td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate><a href='".$url."' style='color: #444444;' target='_blank'>".$cid_num."</a></td>\n";
}
}
if (if_group("admin") || if_group("superadmin")) {
if (strlen(($_GET['rows'])) == 0) {
echo "<td class='".$row_style[$c]."' $style_alternate>\n";
echo "".$dest."<br />\n";
echo "</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>\n";
if ($application == "fifo") {
echo "queue &nbsp;\n";
}
else {
echo $application." &nbsp;\n";
}
echo "</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>\n";
echo "".$secure."<br />\n";
echo "</td>\n";
}
}
}
else {
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_light.gif');\"";
echo "<tr>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>$extension</td>\n";
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo "<td class='".$row_style[$c]."' $style_alternate>".$user_array[$extension]['user_status']."&nbsp;</td>\n";
}
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
if (if_group("admin") || if_group("superadmin")) {
if (strlen(($_GET['rows'])) == 0) {
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
}
}
}
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
echo " ".$effective_caller_id_name."&nbsp;\n";
echo "</td>\n";
if (if_group("admin") || if_group("superadmin")) {
if (strlen(($_GET['rows'])) == 0) {
if ($found_extension) {
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
//transfer
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_transfer_cmd(escape('$uuid')));\">transfer</a>&nbsp;\n";
//park
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_park_cmd(escape('$uuid')));\">park</a>&nbsp;\n";
//hangup
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('Do you really want to hangup this call?');if (confirm_response){send_cmd('v_calls_exec.php?cmd=uuid_kill%20'+(escape('$uuid')));}\">hangup</a>&nbsp;\n";
//record start/stop
$tmp_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$uuid.".wav";
if (file_exists($tmp_file)) {
//stop
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_record_cmd(escape('$uuid'), 'active_extensions_', escape('$cid_num'))+'&uuid='+escape('$uuid')+'&action=record&action2=stop&prefix=active_extensions_&name='+escape('$cid_num'));\">stop record</a>&nbsp;\n";
}
else {
//start
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_record_cmd(escape('$uuid'), 'active_extensions_', escape('$cid_num'))+'&uuid='+escape('$uuid')+'&action=record&action2=start&prefix=active_extensions_');\">start record</a>&nbsp;\n";
}
echo " &nbsp;";
echo "</td>\n";
}
else {
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
echo " &nbsp;";
echo "</td>\n";
}
}
}
echo "</tr>\n";
if ($y == $_GET['rows'] && $_GET['rows'] > 0) {
$y = 0;
echo "</table>\n";
echo "</td>\n";
echo "<td valign='top'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>Ext</th>\n";
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo "<th>Status</th>\n";
}
echo "<th>Time</th>\n";
if (if_group("admin") || if_group("superadmin")) {
if ($_GET['rows'] == 0) {
echo "<th>CID Name</th>\n";
echo "<th>CID Number</th>\n";
echo "<th>Dest</th>\n";
echo "<th>App</th>\n";
echo "<th>Secure</th>\n";
}
}
echo "<th>Name</th>\n";
if (if_group("admin") || if_group("superadmin")) {
if ($_GET['rows'] == 0) {
echo "<th>Options</th>\n";
}
}
echo "</tr>\n";
}
$y++;
if ($c==0) { $c=1; } else { $c=0; }
}
echo "</table>\n";
echo "<br /><br />\n";
//valet park
echo "<table width='100%' border='0' cellpadding='5' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th valign='top'>Park Extension</th>\n";
echo "<th valign='top'>Time</th>\n";
echo "<th valign='top'>CID Name</th>\n";
echo "<th valign='top'>CID Number</th>\n";
echo "</tr>\n";
foreach ($valet_array as $row) {
if (strlen($row['extension']) > 0) {
if ($row['context'] == $_SESSION['domain_name'] || $row['context'] == "default") {
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."' >*".$row['extension']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' >".$row['call_length']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' >".$row['cid_name']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' >".$row['cid_num']."</td>\n";
echo "</tr>\n";
}
}
}
echo "<table>\n";
}
echo "<br /><br />\n";
if ($user_status == "Available (On Demand)") {
$user_status = "Available_On_Demand";
}
$user_status = str_replace(" ", "_", $user_status);
echo "<span id='db_user_status' style='visibility:hidden;'>$user_status</span>\n";
echo "<div id='cmd_reponse'>\n";
echo "</div>\n";
}
?>

View File

@@ -0,0 +1,172 @@
<?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('calls_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//set the command
$switch_cmd = 'show channels';
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//if the connnection is available then run it and return the results
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 event socket command
$csv = trim(event_socket_request($fp, 'api '.$switch_cmd));
//prepare the string
$result_array = explode("\n\n",$csv);
//get the named array
$result_array = csv_to_named_array($result_array[0], ",");
//set the alternating color for each row
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the results
echo "<div id='cmd_reponse'>\n";
echo "</div>\n";
echo "<table width='100%' border='0' cellpadding='3' cellspacing='0'>\n";
echo "<tr>\n";
//echo "<th>ID</th>\n";
//echo "<th>UUID</th>\n";
//echo "<th>Dir</th>\n";
echo "<th>Profile</th>\n";
echo "<th>Created</th>\n";
//echo "<th>Created Epoch</th>\n";
//echo "<th>Name</th>\n";
echo "<th>Number</th>\n";
//echo "<th>State</th>\n";
echo "<th>CID Name</th>\n";
echo "<th>CID Number</th>\n";
//echo "<th>IP Addr</th>\n";
echo "<th>Dest</th>\n";
echo "<th>Application</th>\n";
//echo "<th>Dialplan</th>\n";
//echo "<th>Context</th>\n";
echo "<th>Read / Write Codec</th>\n";
//echo "<th>Read Rate</th>\n";
//echo "<th>Write Codec</th>\n";
//echo "<th>Write Rate</th>\n";
echo "<th>Secure</th>\n";
echo "<th>Options</th>\n";
echo "</tr>\n";
foreach ($result_array as $row) {
//set the php variables
foreach ($row as $key => $value) {
$$key = $value;
}
//get the sip profile
$name_array = explode("/", $name);
$sip_profile = $name_array[1];
$sip_uri = $name_array[2];
//get the number
$temp_array = explode("@", $sip_uri);
$tmp_number = $temp_array[0];
$tmp_number = str_replace("sip:", "", $tmp_number);
//remove the '+' because it breaks the call recording
$cid_num = str_replace("+", "", $cid_num);
echo "<tr>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$id &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$uuid &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$direction &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$sip_profile &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$created &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$created_epoch &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$name &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tmp_number."&nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$state &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$cid_name &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$cid_num &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$ip_addr &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$dest &nbsp;</td>\n";
if (strlen($application) > 0) {
echo "<td valign='top' class='".$row_style[$c]."'>".$application.":".$application_data." &nbsp;</td>\n";
}
else {
echo "<td valign='top' class='".$row_style[$c]."'>&nbsp;</td>\n";
}
//echo "<td valign='top' class='".$row_style[$c]."'>$dialplan &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$context &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$read_codec:$read_rate / $write_codec:$write_rate &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$read_rate &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$write_codec &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$write_rate &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$secure &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' style='text-align:center;'>\n";
//transfer
echo " <a href='javascript:void(0);' onMouseover=\"document.getElementById('form_label').innerHTML='<strong>Transfer To</strong>';\" onclick=\"send_cmd('v_calls_exec.php?cmd='+get_transfer_cmd(escape('$uuid')));\">xfer</a>&nbsp;\n";
//park
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_park_cmd(escape('$uuid')));\">park</a>&nbsp;\n";
//hangup
echo " <a href='javascript:void(0);' onclick=\"confirm_response = confirm('Do you really want to hangup this call?');if (confirm_response){send_cmd('v_calls_exec.php?cmd=uuid_kill%20'+(escape('$uuid')));}\">hangup</a>&nbsp;\n";
//record start/stop
$tmp_dir = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d");
mkdir($tmp_dir, 0777, true);
$tmp_file = $tmp_dir."/".$uuid.".wav";
if (file_exists($tmp_file)) {
//stop
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_record_cmd(escape('$uuid'), 'active_calls_', escape('$cid_num'))+'&uuid='+escape('$uuid')+'&action=record&action2=stop&prefix=active_calls_&name='+escape('$cid_num'));\">stop rec</a>&nbsp;\n";
}
else {
//start
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_record_cmd(escape('$uuid'), 'active_calls_', escape('$cid_num'))+'&uuid='+escape('$uuid')+'&action=record&action2=start&prefix=active_calls_');\">rec</a>&nbsp;\n";
}
echo " &nbsp;";
echo "</td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
}
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
}
?>

View File

@@ -0,0 +1,259 @@
<?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('calls_active_view') || permission_exists('extensions_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//authorized referrer
if(stristr($_SERVER["HTTP_REFERER"], '/v_calls_active_extensions.php') === false) {
if(stristr($_SERVER["HTTP_REFERER"], '/v_calls_active.php') === false) {
echo " access denied";
exit;
}
}
//http get variables set to php variables
if (count($_GET)>0) {
$switch_cmd = trim($_GET["cmd"]);
$action = trim($_GET["action"]);
$data = trim($_GET["data"]);
$direction = trim($_GET["direction"]);
$username = $_SESSION['username'];
}
//authorized commands
if (stristr($switch_cmd, '&uuid=') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'uuid_kill') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'uuid_transfer') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'uuid_record') == true) {
//authorized;
} elseif (stristr($action, 'user_status') == true) {
//authorized;
} elseif (stristr($action, 'callcenter_config') == true) {
//authorized;
} else {
//not found. this command is not authorized
echo "access denied";
exit;
}
if (count($_GET)>0) {
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if (stristr($action, 'user_status') == true) {
$user_status = $data;
switch ($user_status) {
case "Available":
$user_status = "Available";
//update the user state
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
break;
case "Available_On_Demand":
$user_status = "Available (On Demand)";
//update the user state
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
break;
case "Logged_Out":
$user_status = "Logged Out";
//update the user state
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
break;
case "On_Break":
$user_status = "On Break";
//update the user state
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
break;
case "Do_Not_Disturb":
$user_status = "Do Not Disturb";
//update the user state
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
break;
default:
$user_status = "";
}
//update the v_users table with the status
$sql = "update v_users set ";
$sql .= "user_status = '$user_status' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '".$username."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
if (strlen($user_status) > 0) {
//include the dnd class
include "includes/classes/do_not_disturb.php";
//loop through the list of assigned extensions
foreach ($_SESSION['user']['extension'] as &$row) {
$extension = $row["user"];
//set the default action
if ($user_status == "Do Not Disturb") {
$dnd_action = "add";
}
//hunt_group information used to determine if this is an add or an update
$sql = "select * from v_hunt_groups ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and hunt_group_extension = '$extension' ";
$prep_statement_2 = $db->prepare(check_sql($sql));
$prep_statement_2->execute();
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
foreach ($result2 as &$row2) {
if ($row2["hunt_group_type"] == 'dnd') {
$dnd_action = "update";
$dnd_uuid = $row2["hunt_group_uuid"];
}
}
unset ($prep_statement_2, $result, $row2);
//add or update dnd
$dnd = new do_not_disturb;
$dnd->domain_uuid = $domain_uuid;
$dnd->dnd_uuid = $dnd_uuid;
$dnd->domain_name = $_SESSION['domain_name'];
$dnd->extension = $extension;
if ($user_status == "Do Not Disturb") {
$dnd->dnd_enabled = "true";
if ($dnd_action == "add") {
$dnd->dnd_add();
}
if ($dnd_action == "update") {
$dnd->dnd_update();
}
}
else {
//for other status disable dnd
if ($dnd_action == "update") {
$dnd->dnd_enabled = "false";
$dnd->dnd_update();
}
}
$dnd->debug = false;
$dnd->dnd_status();
unset($dnd);
}
unset ($prep_statement);
}
//synchronize the xml config
save_hunt_group_xml();
//synchronize the xml config
save_dialplan_xml();
//reloadxml
$cmd = 'api reloadxml';
$response = event_socket_request($fp, $cmd);
//apply settings reminder
$_SESSION["reload_xml"] = false;
}
//fs cmd
if (strlen($switch_cmd) > 0) {
//set the status so they are compatible with mod_callcenter
$switch_cmd = str_replace("Available_On_Demand", "'Available (On Demand)'", $switch_cmd);
$switch_cmd = str_replace("Logged_Out", "'Logged Out'", $switch_cmd);
$switch_cmd = str_replace("On_Break", "'On Break'", $switch_cmd);
$switch_cmd = str_replace("Do_Not_Disturb", "'Logged Out'", $switch_cmd);
/*
//if ($action == "energy") {
//conference 3001-example.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);
}
*/
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
if ($action == "record") {
if (trim($_GET["action2"]) == "stop") {
$x=0;
while (true) {
if ($x > 0) {
$dest_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"]."_".$x.".wav";
}
else {
$dest_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"].".wav";
}
if (!file_exists($dest_file)) {
rename($_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"].".wav", $dest_file);
break;
}
$x++;
}
}
}
}
}
?>