2015-04-29 22:45:32 +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>
|
2016-04-14 23:08:16 +02:00
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2016
|
2015-04-29 22:45:32 +02:00
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
|
|
|
|
*/
|
|
|
|
|
|
2016-04-14 23:08:16 +02:00
|
|
|
//includes
|
|
|
|
|
require_once "root.php";
|
|
|
|
|
require_once "resources/require.php";
|
2015-04-29 22:45:32 +02:00
|
|
|
|
2016-04-14 23:08:16 +02:00
|
|
|
//permisisions
|
2015-04-29 22:45:32 +02:00
|
|
|
require_once "resources/check_auth.php";
|
|
|
|
|
if (permission_exists('xml_cdr_view')) {
|
|
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//add multi-lingual support
|
2016-04-14 23:08:16 +02:00
|
|
|
$language = new text;
|
|
|
|
|
$text = $language->get();
|
2015-04-29 22:45:32 +02:00
|
|
|
|
|
|
|
|
//additional includes
|
2016-04-14 23:08:16 +02:00
|
|
|
require_once "resources/header.php";
|
2015-04-29 22:45:32 +02:00
|
|
|
|
|
|
|
|
//retrieve submitted data
|
2016-04-14 23:08:16 +02:00
|
|
|
$quick_select = check_str($_REQUEST['quick_select']);
|
|
|
|
|
$start_stamp_begin = check_str($_REQUEST['start_stamp_begin']);
|
|
|
|
|
$start_stamp_end = check_str($_REQUEST['start_stamp_end']);
|
|
|
|
|
$include_internal = check_str($_REQUEST['include_internal']);
|
|
|
|
|
$quick_select = (sizeof($_REQUEST) == 0) ? 1 : $quick_select; //set default
|
2015-04-29 22:45:32 +02:00
|
|
|
|
2016-06-06 01:19:06 +02:00
|
|
|
//get the summary
|
|
|
|
|
$cdr = new xml_cdr;
|
2016-06-06 05:54:54 +02:00
|
|
|
$cdr->domain_uuid = $_SESSION['domain_uuid'];
|
2016-06-06 01:19:06 +02:00
|
|
|
$cdr->quick_select = $quick_select;
|
|
|
|
|
$cdr->start_stamp_begin = $start_stamp_begin;
|
|
|
|
|
$cdr->start_stamp_end = $start_stamp_end;
|
|
|
|
|
$cdr->include_internal = $include_internal;
|
|
|
|
|
$cdr->quick_select = $quick_select;
|
|
|
|
|
$summary = $cdr->user_summary();
|
2016-06-06 05:54:54 +02:00
|
|
|
$extensions = $cdr->extensions;
|
2015-04-29 22:45:32 +02:00
|
|
|
|
|
|
|
|
//page title and description
|
|
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td align='left' width='50%' nowrap='nowrap' style='vertical-align: top;'>\n";
|
|
|
|
|
echo " <b>".$text['title-extension_summary']."</b><br><br>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td align='right' width='100%' style='vertical-align: top;'>";
|
|
|
|
|
if (permission_exists('xml_cdr_all') && $_GET['showall'] != 'true') {
|
|
|
|
|
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='xml_cdr_extension_summary.php?showall=true';\">\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
echo "<br>\n";
|
|
|
|
|
|
|
|
|
|
if (permission_exists('xml_cdr_search')) {
|
2016-04-15 05:11:05 +02:00
|
|
|
echo "<form name='frm' id='frm' method='get' action=''>\n";
|
2015-04-29 22:45:32 +02:00
|
|
|
|
|
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
|
2016-04-14 23:08:16 +02:00
|
|
|
echo " <td width='25%' style='vertical-align: top;'>\n";
|
|
|
|
|
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td class='vncell' valign='top' nowrap='nowrap' width='30%'>\n";
|
|
|
|
|
echo " ".$text['label-preset']."\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='vtable' width='70%' align='left' style='white-space: nowrap;'>\n";
|
|
|
|
|
echo " <select class='formfld' name='quick_select' id='quick_select' onchange=\"if (this.selectedIndex != 0) { document.getElementById('start_stamp_begin').value = ''; document.getElementById('start_stamp_end').value = ''; document.getElementById('frm').submit(); }\">\n";
|
2015-04-29 22:45:32 +02:00
|
|
|
echo " <option value=''></option>\n";
|
|
|
|
|
echo " <option value='1' ".(($quick_select == 1) ? "selected='selected'" : null).">".$text['option-last_seven_days']."</option>\n";
|
2016-04-14 23:08:16 +02:00
|
|
|
echo " <option value='2' ".(($quick_select == 2) ? "selected='selected'" : null).">".$text['option-last_hour']."</option>\n";
|
|
|
|
|
echo " <option value='3' ".(($quick_select == 3) ? "selected='selected'" : null).">".$text['option-today']."</option>\n";
|
|
|
|
|
echo " <option value='4' ".(($quick_select == 4) ? "selected='selected'" : null).">".$text['option-yesterday']."</option>\n";
|
|
|
|
|
echo " <option value='5' ".(($quick_select == 5) ? "selected='selected'" : null).">".$text['option-this_week']."</option>\n";
|
|
|
|
|
echo " <option value='6' ".(($quick_select == 6) ? "selected='selected'" : null).">".$text['option-this_month']."</option>\n";
|
|
|
|
|
echo " <option value='7' ".(($quick_select == 7) ? "selected='selected'" : null).">".$text['option-this_year']."</option>\n";
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo " </td>";
|
2015-04-29 22:45:32 +02:00
|
|
|
|
|
|
|
|
echo " <td width='25%' style='vertical-align: top;'>\n";
|
|
|
|
|
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td class='vncell' valign='top' nowrap='nowrap' width='30%'>\n";
|
|
|
|
|
echo " ".$text['label-start_date_time']."\n";
|
|
|
|
|
echo " </td>\n";
|
2016-04-13 21:23:07 +02:00
|
|
|
echo " <td class='vtable' width='70%' align='left' style='position: relative; min-width: 135px;'>\n";
|
|
|
|
|
echo " <input type='text' class='formfld datetimepicker' style='min-width: 115px; width: 115px; max-width: 115px;' name='start_stamp_begin' id='start_stamp_begin' placeholder='".$text['label-from']."' value='$start_stamp_begin'>\n";
|
2015-04-29 22:45:32 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo " </td>";
|
|
|
|
|
|
|
|
|
|
echo " <td width='25%' style='vertical-align: top;'>\n";
|
|
|
|
|
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td class='vncell' valign='top' nowrap='nowrap' width='30%'>\n";
|
|
|
|
|
echo " ".$text['label-end_date_time']."\n";
|
|
|
|
|
echo " </td>\n";
|
2016-04-13 21:23:07 +02:00
|
|
|
echo " <td class='vtable' width='70%' align='left' style='position: relative; min-width: 135px;'>\n";
|
|
|
|
|
echo " <input type='text' class='formfld datetimepicker' style='min-width: 115px; width: 115px; max-width: 115px;' name='start_stamp_end' id='start_stamp_end' placeholder='".$text['label-to']."' value='$start_stamp_end'>\n";
|
2015-04-29 22:45:32 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo " </td>";
|
|
|
|
|
|
|
|
|
|
echo " <td width='25%' style='vertical-align: top;'>\n";
|
|
|
|
|
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td class='vncell' valign='top' nowrap='nowrap' width='30%'>\n";
|
|
|
|
|
echo " ".$text['label-include_internal']."\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='vtable' width='70%' align='left' style='white-space: nowrap;'>\n";
|
|
|
|
|
echo " <select class='formfld' name='include_internal' id='include_internal'>\n";
|
|
|
|
|
echo " <option value='0'>".$text['option-false']."</option>\n";
|
|
|
|
|
echo " <option value='1' ".(($include_internal == 1) ? "selected" : null).">".$text['option-true']."</option>\n";
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo " </td>";
|
|
|
|
|
|
|
|
|
|
echo " </tr>";
|
|
|
|
|
echo " <tr>";
|
|
|
|
|
echo " <td colspan='4' style='padding-top: 8px;' align='right'>";
|
|
|
|
|
echo " <input type='button' class='btn' value='".$text['button-reset']."' onclick=\"document.location.href='xml_cdr_extension_summary.php';\">\n";
|
|
|
|
|
echo " <input type='submit' class='btn' value='".$text['button-update']."'>\n";
|
|
|
|
|
echo " </td>";
|
|
|
|
|
echo " </tr>";
|
|
|
|
|
echo "</table>";
|
|
|
|
|
|
|
|
|
|
echo "</form>";
|
|
|
|
|
echo "<br /><br />";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//show the results
|
|
|
|
|
echo "<table xclass='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
|
|
|
|
|
echo " <th>".$text['label-domain']."</th>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " <th>".$text['label-extension']."</th>\n";
|
|
|
|
|
echo " <th>".$text['label-number_alias']."</th>\n";
|
|
|
|
|
echo " <th>".$text['label-missed']."</th>\n";
|
|
|
|
|
echo " <th>".$text['label-no_answer']."</th>\n";
|
|
|
|
|
echo " <th>".$text['label-busy']."</th>\n";
|
|
|
|
|
echo " <th>".$text['label-aloc']."</th>\n";
|
|
|
|
|
echo " <th style='text-align: right;'>".$text['label-inbound_calls']."</th>\n";
|
|
|
|
|
echo " <th style='text-align: right;'>".$text['label-inbound_duration']."</th>\n";
|
|
|
|
|
echo " <th style='text-align: right;'>".$text['label-outbound_calls']."</th>\n";
|
|
|
|
|
echo " <th style='text-align: right;'>".$text['label-outbound_duration']."</th>\n";
|
|
|
|
|
echo " <th style='text-align: left;'>".$text['label-description']."</th>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
|
|
|
|
|
$c = 0;
|
|
|
|
|
$row_style["0"] = "row_style0";
|
|
|
|
|
$row_style["1"] = "row_style1";
|
2016-06-06 01:19:06 +02:00
|
|
|
if (isset($extensions)) foreach ($extensions as $extension => $row) {
|
2015-04-29 22:45:32 +02:00
|
|
|
$seconds['inbound'] = $summary[$extension]['inbound']['seconds'];
|
|
|
|
|
$seconds['outbound'] = $summary[$extension]['outbound']['seconds'];
|
|
|
|
|
if ($summary[$extension]['missed'] == null) {
|
|
|
|
|
$summary[$extension]['missed'] = 0;
|
|
|
|
|
}
|
|
|
|
|
if ($summary[$extension]['no_answer'] == null) {
|
|
|
|
|
$summary[$extension]['no_answer'] = 0;
|
|
|
|
|
}
|
|
|
|
|
if ($summary[$extension]['busy'] == null) {
|
|
|
|
|
$summary[$extension]['busy'] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//missed
|
|
|
|
|
$missed = $summary[$extension]['missed'];
|
|
|
|
|
|
|
|
|
|
//volume
|
|
|
|
|
$volume = $summary[$extension]['inbound']['count'] + $summary[$extension]['outbound']['count'];
|
|
|
|
|
|
|
|
|
|
//average length of call
|
2016-04-26 03:19:58 +02:00
|
|
|
$summary[$extension]['aloc'] = $volume==0 ? 0 : ($seconds['inbound'] + $seconds['outbound']) / ($volume - $missed);
|
2015-04-29 22:45:32 +02:00
|
|
|
|
|
|
|
|
$tr_link = "xhref='xml_cdr.php?'";
|
|
|
|
|
echo "<tr ".$tr_link.">\n";
|
|
|
|
|
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
|
2016-06-06 01:19:06 +02:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$_SESSION['domains'][$row['domain_uuid']]['domain_name']."</td>\n";
|
2015-04-29 22:45:32 +02:00
|
|
|
}
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$extension."</td>\n";
|
2016-06-06 01:19:06 +02:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$row['number_alias']." </td>\n";
|
2015-04-29 22:45:32 +02:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$summary[$extension]['missed']." </td>\n";
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$summary[$extension]['no_answer']." </td>\n";
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$summary[$extension]['busy']." </td>\n";
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".gmdate("H:i:s",$summary[$extension]['aloc'])." </td>\n";
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."' style='text-align: right;'> ".(($summary[$extension]['inbound']['count'] != '') ? $summary[$extension]['inbound']['count'] : "0")."</td>\n";
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."' style='text-align: right;'>".(($seconds['inbound'] != '') ? gmdate("G:i:s", $seconds['inbound']) : '0:00:00')."</td>\n";
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."' style='text-align: right;'> ".(($summary[$extension]['outbound']['count'] != '') ? $summary[$extension]['outbound']['count'] : "0")."</td>\n";
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."' style='text-align: right;'>".(($seconds['outbound'] != '') ? gmdate("G:i:s", $seconds['outbound']) : '0:00:00')."</td>\n";
|
2016-06-06 01:19:06 +02:00
|
|
|
echo " <td valign='top' class='row_stylebg'>".$row['description']." </td>\n";
|
2015-04-29 22:45:32 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
$c = ($c==0) ? 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo "</table>";
|
|
|
|
|
echo "<br><br>";
|
|
|
|
|
|
|
|
|
|
//show the footer
|
|
|
|
|
require_once "resources/footer.php";
|
|
|
|
|
|
2016-06-06 05:54:54 +02:00
|
|
|
?>
|