2012-06-04 16:58:40 +02:00
|
|
|
<?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";
|
2012-10-06 20:01:45 +02:00
|
|
|
include "app_languages.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
if (permission_exists('calls_active_view')) {
|
|
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-06 20:01:45 +02:00
|
|
|
foreach($content_calls_active as $key => $value) {
|
|
|
|
|
$content_calls_active[$key] = $value[$_SESSION['domain']['language']['code']];
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
//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) {
|
2012-10-06 20:01:45 +02:00
|
|
|
$msg = "<div align='center'>".$content_calls_active['confirm-socket']."<br /></div>";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<div align='center'>\n";
|
|
|
|
|
echo "<table width='40%'>\n";
|
|
|
|
|
echo "<tr>\n";
|
2012-10-06 20:01:45 +02:00
|
|
|
echo "<th align='left'>".$content_calls_active['label-message']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
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";
|
2012-10-06 20:01:45 +02:00
|
|
|
echo "<th>".$content_calls_active['label-profile']."</th>\n";
|
|
|
|
|
echo "<th>".$content_calls_active['label-created']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
//echo "<th>Created Epoch</th>\n";
|
|
|
|
|
//echo "<th>Name</th>\n";
|
2012-10-06 20:01:45 +02:00
|
|
|
echo "<th>".$content_calls_active['label-num']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
//echo "<th>State</th>\n";
|
2012-10-09 05:45:34 +02:00
|
|
|
echo "<th>".$content_calls_active['label-cid-name']."</th>\n";
|
|
|
|
|
echo "<th>".$content_calls_active['label-cid-number']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
//echo "<th>IP Addr</th>\n";
|
2012-10-09 05:45:34 +02:00
|
|
|
echo "<th>".$content_calls_active['label-destination']."</th>\n";
|
2012-10-06 20:01:45 +02:00
|
|
|
echo "<th>".$content_calls_active['label-app']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
//echo "<th>Dialplan</th>\n";
|
|
|
|
|
//echo "<th>Context</th>\n";
|
2012-10-06 20:01:45 +02:00
|
|
|
echo "<th>".$content_calls_active['label-codec']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
//echo "<th>Read Rate</th>\n";
|
|
|
|
|
//echo "<th>Write Codec</th>\n";
|
|
|
|
|
//echo "<th>Write Rate</th>\n";
|
2012-10-06 20:01:45 +02:00
|
|
|
echo "<th>".$content_calls_active['label-secure']."</th>\n";
|
|
|
|
|
echo "<th>".$content_calls_active['label-opt']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
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 </td>\n";
|
|
|
|
|
//echo "<td valign='top' class='".$row_style[$c]."'>$uuid </td>\n";
|
|
|
|
|
//echo "<td valign='top' class='".$row_style[$c]."'>$direction </td>\n";
|
|
|
|
|
echo "<td valign='top' class='".$row_style[$c]."'>$sip_profile </td>\n";
|
|
|
|
|
echo "<td valign='top' class='".$row_style[$c]."'>$created </td>\n";
|
|
|
|
|
//echo "<td valign='top' class='".$row_style[$c]."'>$created_epoch </td>\n";
|
|
|
|
|
//echo "<td valign='top' class='".$row_style[$c]."'>$name </td>\n";
|
|
|
|
|
echo "<td valign='top' class='".$row_style[$c]."'>".$tmp_number." </td>\n";
|
|
|
|
|
//echo "<td valign='top' class='".$row_style[$c]."'>$state </td>\n";
|
|
|
|
|
echo "<td valign='top' class='".$row_style[$c]."'>$cid_name </td>\n";
|
|
|
|
|
echo "<td valign='top' class='".$row_style[$c]."'>$cid_num </td>\n";
|
|
|
|
|
//echo "<td valign='top' class='".$row_style[$c]."'>$ip_addr </td>\n";
|
|
|
|
|
echo "<td valign='top' class='".$row_style[$c]."'>$dest </td>\n";
|
|
|
|
|
if (strlen($application) > 0) {
|
|
|
|
|
echo "<td valign='top' class='".$row_style[$c]."'>".$application.":".$application_data." </td>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "<td valign='top' class='".$row_style[$c]."'> </td>\n";
|
|
|
|
|
}
|
|
|
|
|
//echo "<td valign='top' class='".$row_style[$c]."'>$dialplan </td>\n";
|
|
|
|
|
//echo "<td valign='top' class='".$row_style[$c]."'>$context </td>\n";
|
|
|
|
|
echo "<td valign='top' class='".$row_style[$c]."'>$read_codec:$read_rate / $write_codec:$write_rate </td>\n";
|
|
|
|
|
//echo "<td valign='top' class='".$row_style[$c]."'>$read_rate </td>\n";
|
|
|
|
|
//echo "<td valign='top' class='".$row_style[$c]."'>$write_codec </td>\n";
|
|
|
|
|
//echo "<td valign='top' class='".$row_style[$c]."'>$write_rate </td>\n";
|
|
|
|
|
echo "<td valign='top' class='".$row_style[$c]."'>$secure </td>\n";
|
|
|
|
|
echo "<td valign='top' class='".$row_style[$c]."' style='text-align:center;'>\n";
|
|
|
|
|
//transfer
|
2012-10-06 20:01:45 +02:00
|
|
|
echo " <a href='javascript:void(0);' onMouseover=\"document.getElementById('form_label').innerHTML='<strong>".$content_calls_active['label-transfer']."</strong>';\" onclick=\"send_cmd('v_calls_exec.php?cmd='+get_transfer_cmd(escape('$uuid')));\">".$content_calls_active['label-transf']."</a> \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
//park
|
2012-10-06 20:01:45 +02:00
|
|
|
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_park_cmd(escape('$uuid')));\">".$content_calls_active['label-park']."</a> \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
//hangup
|
2012-10-06 20:01:45 +02:00
|
|
|
echo " <a href='javascript:void(0);' onclick=\"confirm_response = confirm('".$content_calls_active['confirm-hangup']."');if (confirm_response){send_cmd('v_calls_exec.php?cmd=uuid_kill%20'+(escape('$uuid')));}\">".$content_calls_active['label-hangup']."</a> \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
//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
|
2012-10-06 20:01:45 +02:00
|
|
|
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'));\">".$content_calls_active['label-stop']."</a> \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
//start
|
2012-10-06 20:01:45 +02:00
|
|
|
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_');\">".$content_calls_active['label-start']."</a> \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
echo " ";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
if ($c==0) { $c=1; } else { $c=0; }
|
|
|
|
|
}
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
}
|
|
|
|
|
?>
|