CDR: Database class integration.
This commit is contained in:
parent
27a7f6e9fc
commit
112ae11328
|
|
@ -42,4 +42,4 @@
|
|||
$obj = new xml_cdr;
|
||||
$obj->download();
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
@ -29,8 +29,6 @@
|
|||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
require_once "resources/header.php";
|
||||
//require_once "xml_cdr_statistics_inc.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('xml_cdr_view')) {
|
||||
|
|
@ -42,175 +40,154 @@
|
|||
}
|
||||
|
||||
//additional includes
|
||||
//require_once "xml_cdr_statistics_inc.php";
|
||||
require_once "resources/header.php";
|
||||
|
||||
|
||||
global $db;
|
||||
|
||||
$dom = date('m');
|
||||
$year = date('Y');
|
||||
|
||||
if (strlen($where) == 0) {
|
||||
$duuid = "domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
}
|
||||
for ($y = 0; $y < 4; $y++) {
|
||||
$fileheader = array('month', 'total calls', 'total seconds', 'total minutes', 'total hours', 'billing periods', 'rate', 'approx cost');
|
||||
|
||||
for ($y=0; $y<4; $y++) {
|
||||
$fileheader = array( 'month', 'total calls' , 'total seconds' , 'total minutes' , 'total hours' , 'billing periods', 'rate', 'approx cost');
|
||||
if ($y == 0) {
|
||||
$table_name = "<b>Previous 12 Months Inbound Call Summary</b><br>";
|
||||
$sql_begin = "select billsec as seconds from v_xml_cdr where (domain_uuid = :domain_uuid and direction = 'inbound') ";
|
||||
$rate = 0.012;
|
||||
$bill_period = 60;
|
||||
}
|
||||
else if ($y == 1) {
|
||||
$table_name = "<b>Previous 12 Months Outbound Metered Call Summary</b><br>";
|
||||
$sql_begin = "select billsec as seconds from v_xml_cdr where (domain_uuid = :domain_uuid and direction = 'outbound') ";
|
||||
$sql_end = "and destination_number not like '%800_______' and destination_number not like '%888_______' and destination_number not like '%877_______' and destination_number not like '%866_______' and destination_number not like '%855_______' ";
|
||||
$rate = 0.0098;
|
||||
$rate = $rate / 10;
|
||||
$bill_period = 6;
|
||||
}
|
||||
else if ($y == 2) {
|
||||
$table_name = "<b>Previous 12 Months Toll Free Call Summary</b><br>";
|
||||
$sql_begin = "select billsec as seconds from v_xml_cdr where (domain_uuid = :domain_uuid and direction = 'outbound') ";
|
||||
$sql_end = "and (destination_number like '%800_______' or destination_number like '%888_______' or destination_number like '%877_______' or destination_number like '%866_______' or destination_number like '%855_______') ";
|
||||
$rate = 0;
|
||||
$bill_period = 6;
|
||||
}
|
||||
else if ($y == 3) {
|
||||
$table_name = "<b>Previous 12 Months Local Free Call Summary</b><br>";
|
||||
$sql_begin = "select billsec as seconds from v_xml_cdr where (domain_uuid = :domain_uuid and direction = 'local') ";
|
||||
$rate = 0;
|
||||
$bill_period = 6;
|
||||
}
|
||||
|
||||
//set the style
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
if ( $y == 0) {
|
||||
$tablename = "<b>Previous 12 Months Inbound Call Summary</b><br>";
|
||||
$sql1 = "select billsec as seconds from v_xml_cdr where (".$duuid."and direction='inbound') ";
|
||||
$sql3 = ";";
|
||||
//really we should set rate in domain settings or something and pull it from the php session.
|
||||
$rate=0.012;
|
||||
$bill_period=60;
|
||||
}
|
||||
elseif ($y == 1) {
|
||||
$tablename = "<b>Previous 12 Months Outbound Metered Call Summary</b><br>";
|
||||
$sql1 = "select billsec as seconds from v_xml_cdr where (".$duuid."and direction='outbound') ";
|
||||
$sql3 = "and destination_number not like '%800_______' and destination_number not like '%888_______' and destination_number not like '%877_______' and destination_number not like '%866_______' and destination_number not like '%855_______' ;";
|
||||
$rate=0.0098;
|
||||
$rate=$rate/10;
|
||||
$bill_period=6;
|
||||
}
|
||||
elseif ($y == 2) {
|
||||
$tablename = "<b>Previous 12 Months Toll Free Call Summary</b><br>";
|
||||
$sql1 = "select billsec as seconds from v_xml_cdr where (".$duuid."and direction='outbound') ";
|
||||
$sql3 = "and (destination_number like '%800_______' or destination_number like '%888_______' or destination_number like '%877_______' or destination_number like '%866_______' or destination_number like '%855_______');";
|
||||
$rate=0;
|
||||
$bill_period=6;
|
||||
}
|
||||
elseif ($y == 3) {
|
||||
$tablename = "<b>Previous 12 Months Local Free Call Summary</b><br>";
|
||||
$sql1 = "select billsec as seconds from v_xml_cdr where (".$duuid."and direction='local') ";
|
||||
$sql3 = ";";
|
||||
$rate=0;
|
||||
$bill_period=6;
|
||||
}
|
||||
else {
|
||||
echo "whoops<br>";
|
||||
}
|
||||
echo "<table width='100%' cellpadding='0' cellspacing='0'>";
|
||||
|
||||
$dom = date('m');
|
||||
$year = date('Y');
|
||||
$lyear = $year;
|
||||
$last_month = $year."-".$dolm."-01";
|
||||
$this_month = $year."-".$dom."-01";
|
||||
|
||||
//set the style
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
echo $table_name;
|
||||
|
||||
echo "<table width='100%' cellpadding='0' cellspacing='0'>";
|
||||
foreach ($fileheader as $tr) {
|
||||
echo "<th>".$tr."</th>";
|
||||
}
|
||||
|
||||
$dom = date('m');
|
||||
$year = date('Y');
|
||||
$lyear=$year;
|
||||
$lastmonth = $year."-".$dolm."-01";
|
||||
$thismonth = $year."-".$dom."-01";
|
||||
for ($x = 0; $x < 12; $x++) {
|
||||
if ($dom == 1) {
|
||||
$dom = 12;
|
||||
$year = $year - 1;
|
||||
}
|
||||
else if ($x == 0) {
|
||||
$dom = $dom;
|
||||
}
|
||||
else {
|
||||
$dom = $dom - 1;
|
||||
}
|
||||
if ($dom == 1) {
|
||||
$dolm = 12;
|
||||
$lyear = $lyear - 1;
|
||||
}
|
||||
else {
|
||||
$dolm = $dom - 1;
|
||||
}
|
||||
|
||||
echo $tablename;
|
||||
//convert to int
|
||||
$dom = $dom * 1;
|
||||
$dolm = $dolm * 1;
|
||||
|
||||
foreach ($fileheader as $tr){
|
||||
echo "<th>" . $tr . "</th>";
|
||||
}
|
||||
//back to string, prepend 0)
|
||||
if ( $dolm < 10 ) {
|
||||
$dolm = "0".$dolm;
|
||||
}
|
||||
if ( $dom < 10 ) {
|
||||
$dom = "0".$dom;
|
||||
}
|
||||
$last_month = $lyear."-".$dolm."-01";
|
||||
$this_month = $year."-".$dom."-01";
|
||||
|
||||
for ($x=0; $x < 12; $x++)
|
||||
{
|
||||
if ($dom == 1){
|
||||
$dom=12;
|
||||
$year=$year-1;
|
||||
}
|
||||
elseif ($x == 0){
|
||||
$dom=$dom;
|
||||
}
|
||||
else {
|
||||
$dom=$dom-1;
|
||||
}
|
||||
if ($dom == 1) {
|
||||
$dolm=12;
|
||||
$lyear=$lyear-1;
|
||||
}
|
||||
else {
|
||||
$dolm=$dom-1;
|
||||
}
|
||||
$sql = $sql_begin." and (start_stamp >= :last_month and start_stamp < :this_month) ".$sql_end;
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['last_month'] = $last_month;
|
||||
$parameters['this_month'] = $this_month;
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
unset($sql);
|
||||
$max = sizeof($result) - 1;
|
||||
|
||||
//convert to int
|
||||
$dom=$dom*1;
|
||||
$dolm=$dolm*1;
|
||||
$i = 0;
|
||||
|
||||
//back to string, prepend 0)
|
||||
if ( $dolm < 10 ) {
|
||||
$dolm = "0".$dolm;
|
||||
}
|
||||
if ( $dom < 10 ) {
|
||||
$dom = "0".$dom;
|
||||
}
|
||||
$lastmonth = $lyear."-".$dolm."-01";
|
||||
$thismonth = $year."-".$dom."-01";
|
||||
|
||||
$sql2 = "and (start_stamp >= '" . $lastmonth . "' AND start_stamp < '" . $thismonth. "') ";
|
||||
|
||||
$sql = $sql1;
|
||||
$sql .= $sql2;
|
||||
$sql .= $sql3;
|
||||
$sql .= $callsort;
|
||||
//echo "<br>" . $sql . "<br>";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
unset ($prep_statement, $sql);
|
||||
$max = sizeof($result) -1;
|
||||
|
||||
$i=0;
|
||||
|
||||
|
||||
echo "<tr>";
|
||||
echo "<tr>";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'>".($i+1)."</td>\n";
|
||||
if ( $max > 0 ) {
|
||||
foreach($result as $row) {
|
||||
$result = $row['seconds'];
|
||||
$billtime_1 = intval($result/$bill_period);
|
||||
$billtime_2 = $result%$bill_period;
|
||||
if ($max > 0) {
|
||||
foreach ($result as $row) {
|
||||
$result = $row['seconds'];
|
||||
$billtime_1 = intval($result / $bill_period);
|
||||
$billtime_2 = $result % $bill_period;
|
||||
|
||||
if (($result%$bill_period) != 0 ) {
|
||||
//need to round up for billing period
|
||||
$billtime = $billtime + intval($result/$bill_period) + 1;
|
||||
//echo " mod worked ";
|
||||
}
|
||||
else {
|
||||
//no need to round up for billing period
|
||||
$billtime = $billtime + intval($result/$bill_period);
|
||||
}
|
||||
$tottime = $tottime + $result;
|
||||
}
|
||||
if (($result % $bill_period) != 0) {
|
||||
//need to round up for billing period
|
||||
$billtime = $billtime + intval($result / $bill_period) + 1;
|
||||
//echo " mod worked ";
|
||||
}
|
||||
else {
|
||||
//no need to round up for billing period
|
||||
$billtime = $billtime + intval($result / $bill_period);
|
||||
}
|
||||
$tottime = $tottime + $result;
|
||||
}
|
||||
|
||||
echo "<td valign='top' class='".$row_style[$c]."'>".$dolm."/".$lyear."</td>";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'>".$max."</td>";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'>".$tottime."</td>";
|
||||
$mintime = $tottime/$bill_period;
|
||||
echo "<td valign='top' class='".$row_style[$c]."'>".round($mintime,1)."</td>";
|
||||
$hourtime = $tottime/3600;
|
||||
echo "<td valign='top' class='".$row_style[$c]."'>".round($hourtime,1)."</td>";
|
||||
$tot_cost = $rate * $billtime ;
|
||||
echo "<td valign='top' class='".$row_style[$c]."'>".$billtime."</td>";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'>".$rate."</td>";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'>$".round($tot_cost,2)."</td>";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$dolm."/".$lyear."</td>";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$max."</td>";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$tottime."</td>";
|
||||
$mintime = $tottime / $bill_period;
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".round($mintime,1)."</td>";
|
||||
$hourtime = $tottime / 3600;
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".round($hourtime,1)."</td>";
|
||||
$tot_cost = $rate * $billtime ;
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$billtime."</td>";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$rate."</td>";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>$".round($tot_cost,2)."</td>";
|
||||
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
$c = $c ? 0 : 1;
|
||||
}
|
||||
echo "</tr>";
|
||||
|
||||
|
||||
}
|
||||
echo "</tr>";
|
||||
$max=0;
|
||||
$tottime=0;
|
||||
$hourtime=0;
|
||||
$billtime=0;
|
||||
$tot_cost=0;
|
||||
$mintime=0;
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<br>";
|
||||
$max = 0;
|
||||
$tottime = 0;
|
||||
$hourtime = 0;
|
||||
$billtime = 0;
|
||||
$tot_cost = 0;
|
||||
$mintime = 0;
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<br>";
|
||||
|
||||
}
|
||||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
|
|
@ -152,15 +152,13 @@
|
|||
echo " <input type='button' class='btn' value='".$text['button-archive']."' onclick=\"window.location='xml_cdr_archive.php?".escape($query_string)."';\">\n";
|
||||
}
|
||||
echo " <input type='button' class='btn' value='".$text['button-export']."' onclick=\"toggle_select('export_format');\">\n";
|
||||
echo " <input type='button' class='btn' value='".$text['button-refresh']."' onclick=\"document.location.href='xml_cdr.php';\" />\n";
|
||||
echo " </td>";
|
||||
echo " <td style='vertical-align: top;'>";
|
||||
echo " <select class='formfld' style='display: none; width: auto; margin-left: 3px;' name='export_format' id='export_format' onchange=\"display_message('".$text['message-preparing_download']."'); toggle_select('export_format'); document.getElementById('frm_export').submit();\">\n";
|
||||
echo " <option value=''>...</option>\n";
|
||||
echo " <option value='csv'>CSV</option>\n";
|
||||
echo " <option value='pdf'>PDF</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
echo " <input type='button' class='btn' value='".$text['button-refresh']."' onclick=\"document.location.href='xml_cdr.php';\" />\n";
|
||||
echo " </td>";
|
||||
echo " <td style='vertical-align: top; padding-left: 15px;'>".$paging_controls_mini."</td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
|
|
@ -449,8 +447,8 @@
|
|||
file_exists($theme_image_path."icon_cdr_local_failed.png")
|
||||
) ? true : false;
|
||||
|
||||
// loop through the results
|
||||
foreach($result as $index => $row) {
|
||||
//loop through the results
|
||||
foreach ($result as $index => $row) {
|
||||
//get the date and time
|
||||
$tmp_year = date("Y", strtotime($row['start_stamp']));
|
||||
$tmp_month = date("M", strtotime($row['start_stamp']));
|
||||
|
|
@ -464,7 +462,7 @@
|
|||
$hangup_cause = ucwords($hangup_cause);
|
||||
|
||||
//if call cancelled, show the ring time, not the bill time.
|
||||
$seconds = ($row['hangup_cause']=="ORIGINATOR_CANCEL") ? $row['duration'] : round(($row['billmsec'] / 1000), 0, PHP_ROUND_HALF_UP);
|
||||
$seconds = $row['hangup_cause'] == "ORIGINATOR_CANCEL" ? $row['duration'] : round(($row['billmsec'] / 1000), 0, PHP_ROUND_HALF_UP);
|
||||
|
||||
//determine recording properties
|
||||
if (permission_exists('recording_play') || permission_exists('recording_download')) {
|
||||
|
|
@ -685,16 +683,16 @@
|
|||
if ($row['leg'] == 'a') {
|
||||
echo $content;
|
||||
}
|
||||
elseif ($row['leg'] == 'b' && permission_exists('xml_cdr_b_leg')) {
|
||||
else if ($row['leg'] == 'b' && permission_exists('xml_cdr_b_leg')) {
|
||||
echo $content;
|
||||
}
|
||||
unset($content);
|
||||
|
||||
//toggle the color
|
||||
$c = ($c) ? 0 : 1;
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end foreach
|
||||
$c = $c ? 0 : 1;
|
||||
} //foreach
|
||||
} //if
|
||||
unset($sql, $result, $row_count);
|
||||
|
||||
//paging controls
|
||||
echo "<tr>\n";
|
||||
|
|
@ -721,4 +719,4 @@
|
|||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
@ -131,6 +131,7 @@
|
|||
echo " <table cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td style='vertical-align: top;'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='xml_cdr.php'\" value=\"".$text['button-back']."\">";
|
||||
if (permission_exists('xml_cdr_all')) {
|
||||
if ($_REQUEST['show'] != 'alll') {
|
||||
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='xml_cdr_archive.php?show=all';\">\n";
|
||||
|
|
@ -148,15 +149,12 @@
|
|||
}
|
||||
// echo " <input type='button' class='btn' value='".$text['button-statistics']."' onclick=\"document.location.href='xml_cdr_statistics.php';\">\n";
|
||||
echo " <input type='button' class='btn' value='".$text['button-export']."' onclick=\"toggle_select('export_format');\">\n";
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='xml_cdr.php'\" value='Back'>";
|
||||
echo " </td>";
|
||||
echo " <td style='vertical-align: top;'>";
|
||||
echo " <select class='formfld' style='display: none; width: auto; margin-left: 3px;' name='export_format' id='export_format' onchange=\"display_message('".$text['message-preparing_download']."'); toggle_select('export_format'); document.getElementById('frm_export').submit();\">\n";
|
||||
echo " <option value=''>...</option>\n";
|
||||
echo " <option value='csv'>CSV</option>\n";
|
||||
echo " <option value='pdf'>PDF</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
echo " </td>";
|
||||
echo " <td style='vertical-align: top; padding-left: 15px;'>".$paging_controls_mini."</td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
|
|
@ -724,4 +722,4 @@
|
|||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
@ -42,21 +42,13 @@
|
|||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get posted values, if any
|
||||
if (sizeof($_REQUEST) > 0) {
|
||||
$xml_cdr_uuids = $_REQUEST["id"];
|
||||
if (sizeof($xml_cdr_uuids) > 0) {
|
||||
foreach ($xml_cdr_uuids as $index => $xml_cdr_uuid) {
|
||||
if (is_uuid($xml_cdr_uuid)) {
|
||||
// delete record from v_xml_cdr
|
||||
$sql = "delete from v_xml_cdr ";
|
||||
$sql .= "where xml_cdr_uuid = :xml_cdr_uuid ";
|
||||
$parameters['xml_cdr_uuid'] = $xml_cdr_uuid;
|
||||
$database = new database;
|
||||
$database->execute($sql, $parameters);
|
||||
unset($sql, $parameters);
|
||||
|
||||
//get the call recordings
|
||||
//get posted values
|
||||
$xml_cdr_uuids = $_REQUEST["id"];
|
||||
if (is_array($xml_cdr_uuids) && @sizeof($xml_cdr_uuids) != 0) {
|
||||
$records_deleted = 0;
|
||||
foreach ($xml_cdr_uuids as $x => $xml_cdr_uuid) {
|
||||
if (is_uuid($xml_cdr_uuid)) {
|
||||
//get the call recordings
|
||||
$sql = "select * from v_call_recordings ";
|
||||
$sql .= "where call_recording_uuid = :xml_cdr_uuid ";
|
||||
$parameters['xml_cdr_uuid'] = $xml_cdr_uuid;
|
||||
|
|
@ -64,28 +56,41 @@
|
|||
$row = $database->select($sql, $parameters, 'row');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//delete the call recording
|
||||
//delete the call recording
|
||||
$call_recording_path = realpath($row['call_recording_path']);
|
||||
$call_recording_name = $row['call_recording_name'];
|
||||
if (file_exists($call_recording_path.'/'.$call_recording_name)) {
|
||||
@unlink($call_recording_path.'/'.$call_recording_name);
|
||||
}
|
||||
|
||||
//delete the call recording meta data
|
||||
$sql = "delete from v_call_recordings ";
|
||||
$sql .= "where call_recording_uuid = :xml_cdr_uuid ";
|
||||
$parameters['xml_cdr_uuid'] = $xml_cdr_uuid;
|
||||
$database = new database;
|
||||
$database->execute($sql, $parameters);
|
||||
unset($sql, $parameters);
|
||||
|
||||
}
|
||||
//build cdr delete array
|
||||
$array['xml_cdr'][$x]['xml_cdr_uuid'] = $xml_cdr_uuid;
|
||||
//build call recording delete array
|
||||
$array['call_recordings'][$x]['call_recording_uuid'] = $xml_cdr_uuid;
|
||||
//increment counter
|
||||
$records_deleted++;
|
||||
}
|
||||
}
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p->add('xml_cdr_delete', 'temp');
|
||||
$p->add('call_recording_delete', 'temp');
|
||||
//execute delete
|
||||
$database = new database;
|
||||
$database->app_name = 'xml_cdr';
|
||||
$database->app_uuid = '4a085c51-7635-ff03-f67b-86e834422848';
|
||||
$database->delete($array);
|
||||
unset($array);
|
||||
//revoke temporary permissions
|
||||
$p->delete('xml_cdr_delete', 'temp');
|
||||
$p->delete('call_recording_delete', 'temp');
|
||||
//set message
|
||||
$_SESSION["message"] = $text['message-delete'].": ".$records_deleted;
|
||||
}
|
||||
}
|
||||
|
||||
//set message and redirect the user
|
||||
$_SESSION["message"] = $text['message-delete'].": ".sizeof($xml_cdr_uuids);
|
||||
//redirect
|
||||
header("Location: xml_cdr.php");
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
@ -43,22 +43,29 @@
|
|||
$text = $language->get();
|
||||
|
||||
//get the http values and set them to a variable
|
||||
if (strlen($_REQUEST["id"]) > 0) {
|
||||
$uuid = trim($_REQUEST["id"]);
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
$uuid = $_REQUEST["id"];
|
||||
}
|
||||
|
||||
//get the cdr string from the database
|
||||
$sql = "select * from v_xml_cdr ";
|
||||
if (permission_exists('xml_cdr_all')) {
|
||||
$sql .= "where xml_cdr_uuid = '$uuid' ";
|
||||
} else {
|
||||
$sql .= "where xml_cdr_uuid = '$uuid' and domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "where xml_cdr_uuid = :xml_cdr_uuid ";
|
||||
}
|
||||
$row = $db->query($sql)->fetch();
|
||||
$start_stamp = trim($row["start_stamp"]);
|
||||
$xml_string = trim($row["xml"]);
|
||||
$json_string = trim($row["json"]);
|
||||
//print_r($row);
|
||||
else {
|
||||
$sql .= "where xml_cdr_uuid = :xml_cdr_uuid ";
|
||||
$sql .= "and domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
}
|
||||
$parameters['xml_cdr_uuid'] = $uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
$start_stamp = trim($row["start_stamp"]);
|
||||
$xml_string = trim($row["xml"]);
|
||||
$json_string = trim($row["json"]);
|
||||
}
|
||||
unset($sql, $parameters, $row);
|
||||
|
||||
//get the format
|
||||
if (strlen($xml_string) > 0) {
|
||||
|
|
@ -89,7 +96,7 @@
|
|||
try {
|
||||
if ($format == 'json') {
|
||||
$array = json_decode($json_string,true);
|
||||
if (is_null($array)){
|
||||
if (is_null($array)) {
|
||||
$j = stripslashes($json_string);
|
||||
$array = json_decode($j,true);
|
||||
}
|
||||
|
|
@ -98,7 +105,7 @@
|
|||
$array = json_decode(json_encode((array)simplexml_load_string($xml_string)),true);
|
||||
}
|
||||
}
|
||||
catch(Exception $e) {
|
||||
catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
|
|
@ -126,28 +133,28 @@
|
|||
|
||||
//detail summary
|
||||
//get the variables
|
||||
$xml_cdr_uuid = check_str(urldecode($array["variables"]["uuid"]));
|
||||
$direction = check_str(urldecode($array["channel_data"]["direction"]));
|
||||
$language = check_str(urldecode($array["variables"]["language"]));
|
||||
$start_epoch = check_str(urldecode($array["variables"]["start_epoch"]));
|
||||
$start_stamp = check_str(urldecode($array["variables"]["start_stamp"]));
|
||||
$start_uepoch = check_str(urldecode($array["variables"]["start_uepoch"]));
|
||||
$answer_stamp = check_str(urldecode($array["variables"]["answer_stamp"]));
|
||||
$answer_epoch = check_str(urldecode($array["variables"]["answer_epoch"]));
|
||||
$answer_uepoch = check_str(urldecode($array["variables"]["answer_uepoch"]));
|
||||
$end_epoch = check_str(urldecode($array["variables"]["end_epoch"]));
|
||||
$end_uepoch = check_str(urldecode($array["variables"]["end_uepoch"]));
|
||||
$end_stamp = check_str(urldecode($array["variables"]["end_stamp"]));
|
||||
$duration = check_str(urldecode($array["variables"]["duration"]));
|
||||
$mduration = check_str(urldecode($array["variables"]["mduration"]));
|
||||
$billsec = check_str(urldecode($array["variables"]["billsec"]));
|
||||
$billmsec = check_str(urldecode($array["variables"]["billmsec"]));
|
||||
$bridge_uuid = check_str(urldecode($array["variables"]["bridge_uuid"]));
|
||||
$read_codec = check_str(urldecode($array["variables"]["read_codec"]));
|
||||
$write_codec = check_str(urldecode($array["variables"]["write_codec"]));
|
||||
$remote_media_ip = check_str(urldecode($array["variables"]["remote_media_ip"]));
|
||||
$hangup_cause = check_str(urldecode($array["variables"]["hangup_cause"]));
|
||||
$hangup_cause_q850 = check_str(urldecode($array["variables"]["hangup_cause_q850"]));
|
||||
$xml_cdr_uuid = urldecode($array["variables"]["uuid"]);
|
||||
$direction = urldecode($array["channel_data"]["direction"]);
|
||||
$language = urldecode($array["variables"]["language"]);
|
||||
$start_epoch = urldecode($array["variables"]["start_epoch"]);
|
||||
$start_stamp = urldecode($array["variables"]["start_stamp"]);
|
||||
$start_uepoch = urldecode($array["variables"]["start_uepoch"]);
|
||||
$answer_stamp = urldecode($array["variables"]["answer_stamp"]);
|
||||
$answer_epoch = urldecode($array["variables"]["answer_epoch"]);
|
||||
$answer_uepoch = urldecode($array["variables"]["answer_uepoch"]);
|
||||
$end_epoch = urldecode($array["variables"]["end_epoch"]);
|
||||
$end_uepoch = urldecode($array["variables"]["end_uepoch"]);
|
||||
$end_stamp = urldecode($array["variables"]["end_stamp"]);
|
||||
$duration = urldecode($array["variables"]["duration"]);
|
||||
$mduration = urldecode($array["variables"]["mduration"]);
|
||||
$billsec = urldecode($array["variables"]["billsec"]);
|
||||
$billmsec = urldecode($array["variables"]["billmsec"]);
|
||||
$bridge_uuid = urldecode($array["variables"]["bridge_uuid"]);
|
||||
$read_codec = urldecode($array["variables"]["read_codec"]);
|
||||
$write_codec = urldecode($array["variables"]["write_codec"]);
|
||||
$remote_media_ip = urldecode($array["variables"]["remote_media_ip"]);
|
||||
$hangup_cause = urldecode($array["variables"]["hangup_cause"]);
|
||||
$hangup_cause_q850 = urldecode($array["variables"]["hangup_cause_q850"]);
|
||||
if (!isset($array["callflow"][0])) {
|
||||
$tmp = $array["callflow"];
|
||||
unset($array["callflow"]);
|
||||
|
|
@ -156,12 +163,12 @@
|
|||
$x = 0;
|
||||
if (is_array($array["callflow"])) foreach ($array["callflow"] as $row) {
|
||||
if ($x == 0) {
|
||||
$destination_number = check_str(urldecode($row["caller_profile"]["destination_number"]));
|
||||
$context = check_str(urldecode($row["caller_profile"]["context"]));
|
||||
$network_addr = check_str(urldecode($row["caller_profile"]["network_addr"]));
|
||||
$destination_number = urldecode($row["caller_profile"]["destination_number"]);
|
||||
$context = urldecode($row["caller_profile"]["context"]);
|
||||
$network_addr = urldecode($row["caller_profile"]["network_addr"]);
|
||||
}
|
||||
$caller_id_name = check_str(urldecode($row["caller_profile"]["caller_id_name"]));
|
||||
$caller_id_number = check_str(urldecode($row["caller_profile"]["caller_id_number"]));
|
||||
$caller_id_name = urldecode($row["caller_profile"]["caller_id_name"]);
|
||||
$caller_id_number = urldecode($row["caller_profile"]["caller_id_number"]);
|
||||
$x++;
|
||||
}
|
||||
unset($x);
|
||||
|
|
@ -253,7 +260,7 @@
|
|||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$key." </td>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($value,75,"<br />\n", TRUE)." </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
$c = $c ? 0 : 1;
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<br /><br />\n";
|
||||
|
|
@ -274,47 +281,49 @@
|
|||
echo "<th width='30%'>".$text['label-name']."</th>\n";
|
||||
echo "<th width='70%'>".$text['label-value']."</th>\n";
|
||||
echo "</tr>\n";
|
||||
if (is_array($array["variables"])) foreach($array["variables"] as $key => $value) {
|
||||
if (is_array($value)) { $value = implode($value); }
|
||||
$value = urldecode($value);
|
||||
if ($key != "digits_dialed" && $key != "dsn") {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$key."</td>\n";
|
||||
if ($key == "bridge_uuid" || $key == "signal_bond") {
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>\n";
|
||||
echo " <a href='xml_cdr_details.php?id=$value'>".$value."</a> \n";
|
||||
$tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
|
||||
$tmp_name = '';
|
||||
if (file_exists($tmp_dir.'/'.$value.'.wav')) {
|
||||
$tmp_name = $value.".wav";
|
||||
if (is_array($array["variables"])) {
|
||||
foreach($array["variables"] as $key => $value) {
|
||||
if (is_array($value)) { $value = implode($value); }
|
||||
$value = urldecode($value);
|
||||
if ($key != "digits_dialed" && $key != "dsn") {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$key."</td>\n";
|
||||
if ($key == "bridge_uuid" || $key == "signal_bond") {
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>\n";
|
||||
echo " <a href='xml_cdr_details.php?id=$value'>".$value."</a> \n";
|
||||
$tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
|
||||
$tmp_name = '';
|
||||
if (file_exists($tmp_dir.'/'.$value.'.wav')) {
|
||||
$tmp_name = $value.".wav";
|
||||
}
|
||||
else if (file_exists($tmp_dir.'/'.$value.'_1.wav')) {
|
||||
$tmp_name = $value."_1.wav";
|
||||
}
|
||||
else if (file_exists($tmp_dir.'/'.$value.'.mp3')) {
|
||||
$tmp_name = $value.".mp3";
|
||||
}
|
||||
else if (file_exists($tmp_dir.'/'.$value.'_1.mp3')) {
|
||||
$tmp_name = $value."_1.mp3";
|
||||
}
|
||||
if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) {
|
||||
echo " <a href=\"javascript:void(0);\" onclick=\"window.open('../recordings/recording_play.php?a=download&type=moh&filename=".base64_encode('archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)."', 'play',' width=420,height=150,menubar=no,status=no,toolbar=no')\">\n";
|
||||
echo " play";
|
||||
echo " </a> ";
|
||||
}
|
||||
if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) {
|
||||
echo " <a href=\"../recordings/recordings.php?a=download&type=rec&t=bin&filename=".base64_encode("archive/".$tmp_year."/".$tmp_month."/".$tmp_day."/".$tmp_name)."\">\n";
|
||||
echo " download";
|
||||
echo " </a>";
|
||||
}
|
||||
echo "</td>\n";
|
||||
}
|
||||
elseif (file_exists($tmp_dir.'/'.$value.'_1.wav')) {
|
||||
$tmp_name = $value."_1.wav";
|
||||
else {
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($value,75,"<br />\n", true)." </td>\n";
|
||||
}
|
||||
elseif (file_exists($tmp_dir.'/'.$value.'.mp3')) {
|
||||
$tmp_name = $value.".mp3";
|
||||
}
|
||||
elseif (file_exists($tmp_dir.'/'.$value.'_1.mp3')) {
|
||||
$tmp_name = $value."_1.mp3";
|
||||
}
|
||||
if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) {
|
||||
echo " <a href=\"javascript:void(0);\" onclick=\"window.open('../recordings/recording_play.php?a=download&type=moh&filename=".base64_encode('archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)."', 'play',' width=420,height=150,menubar=no,status=no,toolbar=no')\">\n";
|
||||
echo " play";
|
||||
echo " </a> ";
|
||||
}
|
||||
if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) {
|
||||
echo " <a href=\"../recordings/recordings.php?a=download&type=rec&t=bin&filename=".base64_encode("archive/".$tmp_year."/".$tmp_month."/".$tmp_day."/".$tmp_name)."\">\n";
|
||||
echo " download";
|
||||
echo " </a>";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
else {
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($value,75,"<br />\n", TRUE)." </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
$c = $c ? 0 : 1;
|
||||
}
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<br /><br />\n";
|
||||
|
|
@ -337,14 +346,16 @@
|
|||
echo "</tr>\n";
|
||||
|
||||
//foreach($array["variables"] as $key => $value) {
|
||||
if (is_array($array["app_log"]["application"])) foreach ($array["app_log"]["application"] as $row) {
|
||||
$app_name = $row["@attributes"]["app_name"];
|
||||
$app_data = urldecode($row["@attributes"]["app_data"]);
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$app_name." </td>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($app_data,75,"<br />\n", TRUE)." </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
if (is_array($array["app_log"]["application"])) {
|
||||
foreach ($array["app_log"]["application"] as $row) {
|
||||
$app_name = $row["@attributes"]["app_name"];
|
||||
$app_data = urldecode($row["@attributes"]["app_data"]);
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$app_name." </td>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($app_data,75,"<br />\n", true)." </td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = $c ? 0 : 1;
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<br /><br />\n";
|
||||
|
|
@ -353,173 +364,187 @@
|
|||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
if (is_array($array["callflow"])) foreach ($array["callflow"] as $row) {
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo " <td align='left'>\n";
|
||||
|
||||
//attributes
|
||||
echo " <table width='95%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td><b>".$text['label-call-flow']."</b> </td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
|
||||
if (is_array($array["callflow"])) {
|
||||
foreach ($array["callflow"] as $row) {
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <th width='30%'>".$text['label-name']."</th>\n";
|
||||
echo " <th width='70%'>".$text['label-value']."</th>\n";
|
||||
echo " </tr>\n";
|
||||
if (is_array($row["@attributes"])) foreach($row["@attributes"] as $key => $value) {
|
||||
$value = urldecode($value);
|
||||
echo "<tr>\n";
|
||||
echo " <td align='left'>\n";
|
||||
|
||||
//attributes
|
||||
echo " <table width='95%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$key." </td>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($value,75,"<br />\n", TRUE)." </td>\n";
|
||||
echo " <td><b>".$text['label-call-flow']."</b> </td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo " </tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
}
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2'><br /><br /></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo " </table>\n";
|
||||
|
||||
//extension attributes
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td><b>".$text['label-call-flow-2']."</b> </td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <th width='30%'>".$text['label-name']."</th>\n";
|
||||
echo " <th width='70%'>".$text['label-value']."</th>\n";
|
||||
echo " </tr>\n";
|
||||
if (is_array($row["extension"]["@attributes"])) foreach($row["extension"]["@attributes"] as $key => $value) {
|
||||
$value = urldecode($value);
|
||||
echo " <tr >\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$key." </td>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($value,75,"<br />\n", TRUE)." </td>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <th width='30%'>".$text['label-name']."</th>\n";
|
||||
echo " <th width='70%'>".$text['label-value']."</th>\n";
|
||||
echo " </tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
}
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2'><br /><br /></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//extension application
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td><b>".$text['label-call-flow-3']."</b> </td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <th width='30%'>".$text['label-name']."</th>\n";
|
||||
echo " <th width='70%'>".$text['label-data']."</th>\n";
|
||||
echo " </tr>\n";
|
||||
if (is_array($row["extension"]["application"])) foreach ($row["extension"]["application"] as $tmp_row) {
|
||||
$app_name = $tmp_row["@attributes"]["app_name"];
|
||||
$app_data = urldecode($tmp_row["@attributes"]["app_data"]);
|
||||
echo " <tr >\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$app_name." </td>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($app_data,75,"<br />\n", TRUE)." </td>\n";
|
||||
echo " </tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
}
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2'><br /><br /></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//caller profile
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td><b>".$text['label-call-flow-4']."</b> </td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <th width='30%'>".$text['label-name']."</th>\n";
|
||||
echo " <th width='70%'>".$text['label-value']."</th>\n";
|
||||
echo " </tr>\n";
|
||||
if (is_array($row["caller_profile"])) foreach($row["caller_profile"] as $key => $value) {
|
||||
if (is_array($value)) { $value = implode($value); }
|
||||
$value = urldecode($value);
|
||||
echo " <tr >\n";
|
||||
if ($key != "originatee") {
|
||||
if (is_array($value)) { $value = implode($value); }
|
||||
$value = urldecode($value);
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$key." </td>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($value,75,"<br />\n", TRUE)." </td>\n";
|
||||
if (is_array($row["@attributes"])) {
|
||||
foreach($row["@attributes"] as $key => $value) {
|
||||
$value = urldecode($value);
|
||||
echo " <tr>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$key." </td>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($value,75,"<br />\n", true)." </td>\n";
|
||||
echo " </tr>\n";
|
||||
$c = $c ? 0 : 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$key." </td>\n";
|
||||
echo " <td class='".$row_style[$c]."'>\n";
|
||||
echo " <table width='100%'>\n";
|
||||
if (isset($child["originatee_caller_profile"])) foreach($child["originatee_caller_profile"] as $key => $value) {
|
||||
//print_r($tmp_child);
|
||||
echo " <tr >\n";
|
||||
echo " <td valign='top' align='left' width='20%' class='".$row_style[$c]."'>".$key." </td>\n";
|
||||
if ($key != "uuid") {
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($value,75,"<br />\n", TRUE)." </td>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2'><br /><br /></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//extension attributes
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td><b>".$text['label-call-flow-2']."</b> </td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <th width='30%'>".$text['label-name']."</th>\n";
|
||||
echo " <th width='70%'>".$text['label-value']."</th>\n";
|
||||
echo " </tr>\n";
|
||||
if (is_array($row["extension"]["@attributes"])) {
|
||||
foreach($row["extension"]["@attributes"] as $key => $value) {
|
||||
$value = urldecode($value);
|
||||
echo " <tr >\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$key." </td>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($value,75,"<br />\n", true)." </td>\n";
|
||||
echo " </tr>\n";
|
||||
$c = $c ? 0 : 1;
|
||||
}
|
||||
}
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2'><br /><br /></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//extension application
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td><b>".$text['label-call-flow-3']."</b> </td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <th width='30%'>".$text['label-name']."</th>\n";
|
||||
echo " <th width='70%'>".$text['label-data']."</th>\n";
|
||||
echo " </tr>\n";
|
||||
if (is_array($row["extension"]["application"])) {
|
||||
foreach ($row["extension"]["application"] as $tmp_row) {
|
||||
$app_name = $tmp_row["@attributes"]["app_name"];
|
||||
$app_data = urldecode($tmp_row["@attributes"]["app_data"]);
|
||||
echo " <tr >\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$app_name." </td>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($app_data,75,"<br />\n", true)." </td>\n";
|
||||
echo " </tr>\n";
|
||||
$c = $c ? 0 : 1;
|
||||
}
|
||||
}
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2'><br /><br /></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//caller profile
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td><b>".$text['label-call-flow-4']."</b> </td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <th width='30%'>".$text['label-name']."</th>\n";
|
||||
echo " <th width='70%'>".$text['label-value']."</th>\n";
|
||||
echo " </tr>\n";
|
||||
if (is_array($row["caller_profile"])) {
|
||||
foreach($row["caller_profile"] as $key => $value) {
|
||||
if (is_array($value)) { $value = implode($value); }
|
||||
$value = urldecode($value);
|
||||
echo " <tr >\n";
|
||||
if ($key != "originatee") {
|
||||
if (is_array($value)) { $value = implode($value); }
|
||||
$value = urldecode($value);
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$key." </td>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($value,75,"<br />\n", true)." </td>\n";
|
||||
}
|
||||
else {
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'><a href='xml_cdr_details.php?id=$value'>".$value."</a> </td>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$key." </td>\n";
|
||||
echo " <td class='".$row_style[$c]."'>\n";
|
||||
echo " <table width='100%'>\n";
|
||||
if (isset($child["originatee_caller_profile"])) {
|
||||
foreach($child["originatee_caller_profile"] as $key => $value) {
|
||||
//print_r($tmp_child);
|
||||
echo " <tr >\n";
|
||||
echo " <td valign='top' align='left' width='20%' class='".$row_style[$c]."'>".$key." </td>\n";
|
||||
if ($key != "uuid") {
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($value,75,"<br />\n", true)." </td>\n";
|
||||
}
|
||||
else {
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'><a href='xml_cdr_details.php?id=$value'>".$value."</a> </td>\n";
|
||||
}
|
||||
echo " </tr>\n";
|
||||
}
|
||||
}
|
||||
echo " </table>\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " </tr>\n";
|
||||
echo "</tr>\n";
|
||||
$c = $c ? 0 : 1;
|
||||
}
|
||||
echo " </table>\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
}
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2'><br /><br /></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//times
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td><b>".$text['label-call-flow-5']."</b> </td>\n";
|
||||
echo " <td></td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <th width='30%'>".$text['label-name']."</th>\n";
|
||||
echo " <th width='70%'>".$text['label-value']."</th>\n";
|
||||
echo " </tr>\n";
|
||||
if (is_array($row["times"])) foreach($row["times"] as $key => $value) {
|
||||
$value = urldecode($value);
|
||||
echo " <tr >\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$key." </td>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($value,75,"<br />\n", TRUE)." </td>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2'><br /><br /></td>\n";
|
||||
echo " </tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
}
|
||||
echo "</table>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2'><br /><br /></td>\n";
|
||||
echo " </tr>\n";
|
||||
//times
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td><b>".$text['label-call-flow-5']."</b> </td>\n";
|
||||
echo " <td></td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
echo " </table>";
|
||||
echo " <br /><br />\n";
|
||||
echo " <tr>\n";
|
||||
echo " <th width='30%'>".$text['label-name']."</th>\n";
|
||||
echo " <th width='70%'>".$text['label-value']."</th>\n";
|
||||
echo " </tr>\n";
|
||||
if (is_array($row["times"])) {
|
||||
foreach($row["times"] as $key => $value) {
|
||||
$value = urldecode($value);
|
||||
echo " <tr >\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$key." </td>\n";
|
||||
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".wordwrap($value,75,"<br />\n", true)." </td>\n";
|
||||
echo " </tr>\n";
|
||||
$c = $c ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2'><br /><br /></td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
echo " </table>";
|
||||
echo " <br /><br />\n";
|
||||
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>";
|
||||
}
|
||||
}
|
||||
|
||||
//get the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
|
||||
?>
|
||||
|
|
@ -47,10 +47,10 @@
|
|||
require_once "xml_cdr_inc.php";
|
||||
|
||||
//get the format
|
||||
$export_format = check_str($_REQUEST['export_format']);
|
||||
$export_format = $_REQUEST['export_format'];
|
||||
|
||||
//get the format
|
||||
$showall = check_str($_REQUEST['showall']);
|
||||
$showall = $_REQUEST['showall'];
|
||||
|
||||
//exprot the csv
|
||||
if ($export_format == 'csv') {
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
|
||||
//set the csv headers
|
||||
$z = 0;
|
||||
foreach($result[0] as $key => $val) {
|
||||
foreach ($result[0] as $key => $val) {
|
||||
if ($key != "xml" && $key != "json") {
|
||||
if ($z == 0) {
|
||||
echo '"'.$key.'"';
|
||||
|
|
@ -84,9 +84,9 @@
|
|||
|
||||
//show the csv data
|
||||
$x=0;
|
||||
while(true) {
|
||||
while (true) {
|
||||
$z = 0;
|
||||
foreach($result[0] as $key => $val) {
|
||||
foreach ($result[0] as $key => $val) {
|
||||
if ($key != "xml" && $key != "json") {
|
||||
if ($z == 0) {
|
||||
echo '"'.$result[$x][$key].'"';
|
||||
|
|
@ -109,8 +109,8 @@
|
|||
if ($export_format == 'pdf') {
|
||||
|
||||
//load pdf libraries
|
||||
require_once("resources/tcpdf/tcpdf.php");
|
||||
require_once("resources/fpdi/fpdi.php");
|
||||
require_once "resources/tcpdf/tcpdf.php";
|
||||
require_once "resources/fpdi/fpdi.php";
|
||||
|
||||
//determine page size
|
||||
switch ($_SESSION['fax']['page_size']['text']) {
|
||||
|
|
@ -318,4 +318,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
@ -47,11 +47,11 @@
|
|||
require_once "resources/header.php";
|
||||
|
||||
//retrieve submitted data
|
||||
$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) ? 3 : $quick_select; //set default
|
||||
$quick_select = $_REQUEST['quick_select'];
|
||||
$start_stamp_begin = $_REQUEST['start_stamp_begin'];
|
||||
$start_stamp_end = $_REQUEST['start_stamp_end'];
|
||||
$include_internal = $_REQUEST['include_internal'];
|
||||
$quick_select = sizeof($_REQUEST) == 0 ? 3 : $quick_select; //set default
|
||||
|
||||
//get the summary
|
||||
$cdr = new xml_cdr;
|
||||
|
|
@ -112,7 +112,8 @@
|
|||
echo "onclick=\"window.location='xml_cdr_extension_summary.php?";
|
||||
if (strlen($_SERVER["QUERY_STRING"]) > 0) {
|
||||
echo $_SERVER["QUERY_STRING"]."&type=csv';\">\n";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
echo "type=csv';\">\n";
|
||||
}
|
||||
|
||||
|
|
@ -257,4 +258,4 @@
|
|||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
@ -48,4 +48,4 @@
|
|||
$cdr = new xml_cdr;
|
||||
$cdr->read_files();
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
@ -95,7 +95,8 @@
|
|||
case 'equal': $mos_comparison = "<"; break;
|
||||
case 'notequal': $mos_comparison = "<>"; break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$mos_comparison = '';
|
||||
}
|
||||
//$mos_comparison = $_REQUEST["mos_comparison"];
|
||||
|
|
@ -193,20 +194,13 @@
|
|||
//count the records in the database
|
||||
/*
|
||||
if ($_SESSION['cdr']['limit']['numeric'] == 0) {
|
||||
$sql = "select count(xml_cdr_uuid) as num_rows from v_xml_cdr ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ".$sql_where;
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
unset($prep_statement, $result);
|
||||
$sql = "select count(*) from v_xml_cdr ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= ".$sql_where;
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$database = new database;
|
||||
$num_rows = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
@ -246,7 +240,7 @@
|
|||
$sql .= "c.source_number, \n";
|
||||
$sql .= "c.destination_number, \n";
|
||||
$sql .= "c.leg, \n";
|
||||
$sql .= "(c.xml IS NOT NULL OR c.json IS NOT NULL) AS raw_data_exists, \n";
|
||||
$sql .= "(c.xml is not null or c.json is not null) as raw_data_exists, \n";
|
||||
$sql .= "c.json, \n";
|
||||
if (is_array($_SESSION['cdr']['field'])) {
|
||||
foreach ($_SESSION['cdr']['field'] as $field) {
|
||||
|
|
@ -277,8 +271,9 @@
|
|||
$sql .= "left join v_extensions as e on e.extension_uuid = c.extension_uuid \n";
|
||||
$sql .= "inner join v_domains as d on d.domain_uuid = c.domain_uuid \n";
|
||||
if ($_REQUEST['show'] == "all" && permission_exists('xml_cdr_all')) {
|
||||
$sql .= "where 1 = 1 ";
|
||||
} else {
|
||||
$sql .= "where true ";
|
||||
}
|
||||
else {
|
||||
$sql .= "where c.domain_uuid = :domain_uuid \n";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
}
|
||||
|
|
@ -290,7 +285,7 @@
|
|||
$sql .= "and missed_call = 1 \n";
|
||||
}
|
||||
if (strlen($start_epoch) > 0 && strlen($stop_epoch) > 0) {
|
||||
$sql .= "and start_epoch BETWEEN :start_epoch AND :stop_epoch \n";
|
||||
$sql .= "and start_epoch between :start_epoch and :stop_epoch \n";
|
||||
$parameters['start_epoch'] = $start_epoch;
|
||||
$parameters['stop_epoch'] = $stop_epoch;
|
||||
}
|
||||
|
|
@ -355,7 +350,7 @@
|
|||
}
|
||||
|
||||
if (strlen($start_stamp_begin) > 0 && strlen($start_stamp_end) > 0) {
|
||||
$sql .= "and start_stamp BETWEEN :start_stamp_begin AND :start_stamp_end ";
|
||||
$sql .= "and start_stamp between :start_stamp_begin and :start_stamp_end ";
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin.':00.000';
|
||||
$parameters['start_stamp_end'] = $start_stamp_end.':59.999';
|
||||
}
|
||||
|
|
@ -370,7 +365,7 @@
|
|||
}
|
||||
}
|
||||
if (strlen($answer_stamp_begin) > 0 && strlen($answer_stamp_end) > 0) {
|
||||
$sql .= "and answer_stamp BETWEEN :answer_stamp_begin AND :answer_stamp_end ";
|
||||
$sql .= "and answer_stamp between :answer_stamp_begin and :answer_stamp_end ";
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin.':00.000';
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end.':59.999';
|
||||
}
|
||||
|
|
@ -385,7 +380,7 @@
|
|||
}
|
||||
}
|
||||
if (strlen($end_stamp_begin) > 0 && strlen($end_stamp_end) > 0) {
|
||||
$sql .= "and end_stamp BETWEEN :end_stamp_begin AND :end_stamp_end ";
|
||||
$sql .= "and end_stamp between :end_stamp_begin and :end_stamp_end ";
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin.':00.000';
|
||||
$parameters['end_stamp_end'] = $end_stamp_end.':59.999';
|
||||
}
|
||||
|
|
@ -501,7 +496,6 @@
|
|||
}
|
||||
}
|
||||
$sql = str_replace(" ", " ", $sql);
|
||||
//$sql= str_replace("where and", "where", $sql);
|
||||
$database = new database;
|
||||
if ($archive_request == 'true') {
|
||||
if ($_SESSION['cdr']['archive_database']['boolean'] == 'true') {
|
||||
|
|
@ -527,4 +521,4 @@
|
|||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
@ -61,7 +61,8 @@
|
|||
//start the html form
|
||||
if (strlen(check_str($_GET['redirect'])) > 0) {
|
||||
echo "<form method='get' action='" . $_GET['redirect'] . ".php'>\n";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
echo "<form method='get' action='xml_cdr.php'>\n";
|
||||
}
|
||||
|
||||
|
|
@ -129,18 +130,18 @@
|
|||
echo " <select class='formfld' name='caller_extension_uuid' id='caller_extension_uuid'>\n";
|
||||
echo " <option value=''></option>";
|
||||
$sql = "select extension_uuid, extension, number_alias from v_extensions ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "order by ";
|
||||
$sql .= "extension asc ";
|
||||
$sql .= ", number_alias asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement -> execute();
|
||||
$result_e = $prep_statement -> fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result_e as &$row) {
|
||||
$selected = ($row['extension_uuid'] == $caller_extension_uuid) ? "selected" : null;
|
||||
echo " <option value='".escape($row['extension_uuid'])."' ".escape($selected).">".((is_numeric($row['extension'])) ? escape($row['extension']) : escape($row['number_alias'])." (".escape($row['extension']).")")."</option>";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "order by extension asc, number_alias asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$result_e = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($result_e) && @sizeof($result_e) != 0) {
|
||||
foreach ($result_e as &$row) {
|
||||
$selected = ($row['extension_uuid'] == $caller_extension_uuid) ? "selected" : null;
|
||||
echo " <option value='".escape($row['extension_uuid'])."' ".escape($selected).">".((is_numeric($row['extension'])) ? escape($row['extension']) : escape($row['number_alias'])." (".escape($row['extension']).")")."</option>";
|
||||
}
|
||||
}
|
||||
unset ($prep_statement);
|
||||
unset($sql, $parameters, $result_e, $row, $selected);
|
||||
echo " </select>\n";
|
||||
echo " <input type='text' class='formfld' style='display: none;' name='caller_id_number' id='caller_id_number' value='".escape($caller_id_number)."'>\n";
|
||||
echo " <input type='button' id='btn_toggle_source' class='btn' name='' alt='".$text['button-back']."' value='◁' onclick=\"toggle('source');\">\n";
|
||||
|
|
@ -293,4 +294,4 @@
|
|||
//include footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
@ -247,13 +247,15 @@
|
|||
},
|
||||
yaxis: { min: 0 },
|
||||
<?php
|
||||
if ($hours <= 48) {
|
||||
echo "xaxis: {mode: \"time\",timeformat: \"%d:%H\",minTickSize: [1, \"hour\"]}";
|
||||
} else if ($hours > 48 && $hours < 168) {
|
||||
echo "xaxis: {mode: \"time\",timeformat: \"%m:%d\",minTickSize: [1, \"day\"]}";
|
||||
} else {
|
||||
echo "xaxis: {mode: \"time\",timeformat: \"%m:%d\",minTickSize: [1, \"month\"]}";
|
||||
}
|
||||
if ($hours <= 48) {
|
||||
echo "xaxis: {mode: \"time\",timeformat: \"%d:%H\",minTickSize: [1, \"hour\"]}";
|
||||
}
|
||||
else if ($hours > 48 && $hours < 168) {
|
||||
echo "xaxis: {mode: \"time\",timeformat: \"%m:%d\",minTickSize: [1, \"day\"]}";
|
||||
}
|
||||
else {
|
||||
echo "xaxis: {mode: \"time\",timeformat: \"%m:%d\",minTickSize: [1, \"month\"]}";
|
||||
}
|
||||
?>
|
||||
});
|
||||
}
|
||||
|
|
@ -283,7 +285,7 @@
|
|||
if ($i <= $hours) {
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".($i+1)."</td>\n";
|
||||
}
|
||||
elseif ($i == $hours+1) {
|
||||
else if ($i == $hours+1) {
|
||||
echo " <br /><br />\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
|
|
@ -322,7 +324,7 @@
|
|||
echo " <td valign='top' class='".$row_style[$c]."'>".(round(escape($row['asr']),2))." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".(round(escape($row['aloc']),2))." </td>\n";
|
||||
echo "</tr >\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
$c = $c ? 0 : 1;
|
||||
$i++;
|
||||
}
|
||||
echo "</table>\n";
|
||||
|
|
@ -331,4 +333,4 @@
|
|||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
@ -43,7 +43,7 @@ else {
|
|||
|
||||
//show the column names on the first line
|
||||
$z = 0;
|
||||
foreach($stats[1] as $key => $val) {
|
||||
foreach ($stats[1] as $key => $val) {
|
||||
if ($z == 0) {
|
||||
echo '"'.$key.'"';
|
||||
}
|
||||
|
|
@ -56,9 +56,9 @@ else {
|
|||
|
||||
//add the values to the csv
|
||||
$x = 0;
|
||||
foreach($stats as $row) {
|
||||
foreach ($stats as $row) {
|
||||
$z = 0;
|
||||
foreach($row as $key => $val) {
|
||||
foreach ($row as $key => $val) {
|
||||
if ($z == 0) {
|
||||
echo '"'.$stats[$x][$key].'"';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,37 +76,37 @@
|
|||
|
||||
//get post or get variables from http
|
||||
if (count($_REQUEST) > 0) {
|
||||
$cdr_id = check_str($_REQUEST["cdr_id"]);
|
||||
$missed = check_str($_REQUEST["missed"]);
|
||||
$direction = check_str($_REQUEST["direction"]);
|
||||
$caller_id_name = check_str($_REQUEST["caller_id_name"]);
|
||||
$caller_id_number = check_str($_REQUEST["caller_id_number"]);
|
||||
$caller_extension_uuid = check_str($_REQUEST["caller_extension_uuid"]);
|
||||
$destination_number = check_str($_REQUEST["destination_number"]);
|
||||
$context = check_str($_REQUEST["context"]);
|
||||
$start_stamp_begin = check_str($_REQUEST["start_stamp_begin"]);
|
||||
$start_stamp_end = check_str($_REQUEST["start_stamp_end"]);
|
||||
$answer_stamp_begin = check_str($_REQUEST["answer_stamp_begin"]);
|
||||
$answer_stamp_end = check_str($_REQUEST["answer_stamp_end"]);
|
||||
$end_stamp_begin = check_str($_REQUEST["end_stamp_begin"]);
|
||||
$end_stamp_end = check_str($_REQUEST["end_stamp_end"]);
|
||||
$start_epoch = check_str($_REQUEST["start_epoch"]);
|
||||
$stop_epoch = check_str($_REQUEST["stop_epoch"]);
|
||||
$duration = check_str($_REQUEST["duration"]);
|
||||
$billsec = check_str($_REQUEST["billsec"]);
|
||||
$hangup_cause = check_str($_REQUEST["hangup_cause"]);
|
||||
$uuid = check_str($_REQUEST["uuid"]);
|
||||
$bleg_uuid = check_str($_REQUEST["bleg_uuid"]);
|
||||
$accountcode = check_str($_REQUEST["accountcode"]);
|
||||
$read_codec = check_str($_REQUEST["read_codec"]);
|
||||
$write_codec = check_str($_REQUEST["write_codec"]);
|
||||
$remote_media_ip = check_str($_REQUEST["remote_media_ip"]);
|
||||
$network_addr = check_str($_REQUEST["network_addr"]);
|
||||
$bridge_uuid = check_str($_REQUEST["network_addr"]);
|
||||
$order_by = check_str($_REQUEST["order_by"]);
|
||||
$order = check_str($_REQUEST["order"]);
|
||||
if (strlen(check_str($_REQUEST["mos_comparison"])) > 0) {
|
||||
switch(check_str($_REQUEST["mos_comparison"])) {
|
||||
$cdr_id = $_REQUEST["cdr_id"];
|
||||
$missed = $_REQUEST["missed"];
|
||||
$direction = $_REQUEST["direction"];
|
||||
$caller_id_name = $_REQUEST["caller_id_name"];
|
||||
$caller_id_number = $_REQUEST["caller_id_number"];
|
||||
$caller_extension_uuid = $_REQUEST["caller_extension_uuid"];
|
||||
$destination_number = $_REQUEST["destination_number"];
|
||||
$context = $_REQUEST["context"];
|
||||
$start_stamp_begin = $_REQUEST["start_stamp_begin"];
|
||||
$start_stamp_end = $_REQUEST["start_stamp_end"];
|
||||
$answer_stamp_begin = $_REQUEST["answer_stamp_begin"];
|
||||
$answer_stamp_end = $_REQUEST["answer_stamp_end"];
|
||||
$end_stamp_begin = $_REQUEST["end_stamp_begin"];
|
||||
$end_stamp_end = $_REQUEST["end_stamp_end"];
|
||||
$start_epoch = $_REQUEST["start_epoch"];
|
||||
$stop_epoch = $_REQUEST["stop_epoch"];
|
||||
$duration = $_REQUEST["duration"];
|
||||
$billsec = $_REQUEST["billsec"];
|
||||
$hangup_cause = $_REQUEST["hangup_cause"];
|
||||
$uuid = $_REQUEST["uuid"];
|
||||
$bleg_uuid = $_REQUEST["bleg_uuid"];
|
||||
$accountcode = $_REQUEST["accountcode"];
|
||||
$read_codec = $_REQUEST["read_codec"];
|
||||
$write_codec = $_REQUEST["write_codec"];
|
||||
$remote_media_ip = $_REQUEST["remote_media_ip"];
|
||||
$network_addr = $_REQUEST["network_addr"];
|
||||
$bridge_uuid = $_REQUEST["network_addr"];
|
||||
$order_by = $_REQUEST["order_by"];
|
||||
$order = $_REQUEST["order"];
|
||||
if (strlen($_REQUEST["mos_comparison"]) > 0) {
|
||||
switch($_REQUEST["mos_comparison"]) {
|
||||
case 'less':
|
||||
$mos_comparison = "<";
|
||||
break;
|
||||
|
|
@ -126,13 +126,14 @@
|
|||
$mos_comparison = "<>";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$mos_comparison = '';
|
||||
}
|
||||
//$mos_comparison = check_str($_REQUEST["mos_comparison"]);
|
||||
$mos_score = check_str($_REQUEST["mos_score"]);
|
||||
if(permission_exists('xml_cdr_b_leg')){
|
||||
$leg = check_str($_REQUEST["leg"]);
|
||||
else {
|
||||
unset($mos_comparison);
|
||||
}
|
||||
//$mos_comparison = $_REQUEST["mos_comparison"];
|
||||
$mos_score = $_REQUEST["mos_score"];
|
||||
if (permission_exists('xml_cdr_b_leg')) {
|
||||
$leg = $_REQUEST["leg"];
|
||||
}
|
||||
$show_all = permission_exists('xml_cdr_all') && ($_REQUEST['showall'] == 'true');
|
||||
}
|
||||
|
|
@ -142,65 +143,151 @@
|
|||
}
|
||||
|
||||
//if we do not see b-leg then use only a-leg to generate statistics
|
||||
if(!permission_exists('xml_cdr_b_leg')){
|
||||
if (!permission_exists('xml_cdr_b_leg')) {
|
||||
$leg = 'a';
|
||||
}
|
||||
|
||||
//build the sql where string
|
||||
if (!$show_all) {
|
||||
$sql_where_ands[] = "domain_uuid = '".$_SESSION['domain_uuid']."'";
|
||||
$sql_where_ands[] = "domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
}
|
||||
if ($missed == true) {
|
||||
$sql_where_ands[] = "billsec = '0'";
|
||||
}
|
||||
if (strlen($start_epoch) > 0 && strlen($stop_epoch) > 0) {
|
||||
$sql_where_ands[] = "start_epoch BETWEEN ".$start_epoch." AND ".$stop_epoch." ";
|
||||
$sql_where_ands[] = "start_epoch between :start_epoch and :stop_epoch";
|
||||
$parameters['start_epoch'] = $start_epoch;
|
||||
$parameters['stop_epoch'] = $stop_epoch;
|
||||
}
|
||||
if (strlen($cdr_id) > 0) {
|
||||
$sql_where_ands[] = "cdr_id like :cdr_id";
|
||||
$parameters['cdr_id'] = '%'.$cdr_id.'%';
|
||||
}
|
||||
if (strlen($direction) > 0) {
|
||||
$sql_where_ands[] = "direction = :direction";
|
||||
$parameters['direction'] = $direction;
|
||||
}
|
||||
if (strlen($cdr_id) > 0) { $sql_where_ands[] = "cdr_id like '%".$cdr_id."%'"; }
|
||||
if (strlen($direction) > 0) { $sql_where_ands[] = "direction = '".$direction."'"; }
|
||||
if (strlen($caller_id_name) > 0) {
|
||||
$mod_caller_id_name = str_replace("*", "%", $caller_id_name);
|
||||
$sql_where_ands[] = "caller_id_name like '".$mod_caller_id_name."'";
|
||||
$sql_where_ands[] = "caller_id_name like :mod_caller_id_name";
|
||||
$parameters['mod_caller_id_name'] = $mod_caller_id_name;
|
||||
}
|
||||
if (strlen($caller_extension_uuid) > 0) {
|
||||
$sql_where_ands[] = "extension_uuid = '".$caller_extension_uuid."'";
|
||||
$sql_where_ands[] = "extension_uuid = :caller_extension_uuid";
|
||||
$parameters['caller_extension_uuid'] = $caller_extension_uuid;
|
||||
}
|
||||
if (strlen($caller_id_number) > 0) {
|
||||
$mod_caller_id_number = str_replace("*", "%", $caller_id_number);
|
||||
$sql_where_ands[] = "caller_id_number like '".$mod_caller_id_number."'";
|
||||
$sql_where_ands[] = "caller_id_number like :mod_caller_id_number";
|
||||
$parameters['mod_caller_id_number'] = $mod_caller_id_number;
|
||||
}
|
||||
if (strlen($destination_number) > 0) {
|
||||
$mod_destination_number = str_replace("*", "%", $destination_number);
|
||||
$sql_where_ands[] = "destination_number like '".$mod_destination_number."'";
|
||||
$sql_where_ands[] = "destination_number like :mod_destination_number";
|
||||
$parameters['mod_destination_number'] = $mod_destination_number;
|
||||
}
|
||||
if (strlen($context) > 0) {
|
||||
$sql_where_ands[] = "context like :context";
|
||||
$parameters['context'] = '%'.$context.'%';
|
||||
}
|
||||
/*
|
||||
if (strlen($start_stamp_begin) > 0 && strlen($start_stamp_end) > 0) {
|
||||
$sql_where_ands[] = "start_stamp between :start_stamp_begin and :start_stamp_end";
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin.':00.000';
|
||||
$parameters['start_stamp_end'] = $start_stamp_end.':59.999';
|
||||
}
|
||||
else if (strlen($start_stamp_begin) > 0) {
|
||||
$sql_where_ands[] = "start_stamp >= :start_stamp_begin";
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin.':00.000';
|
||||
}
|
||||
else if (strlen($start_stamp_end) > 0) {
|
||||
$sql_where_ands[] = "start_stamp <= :start_stamp_end";
|
||||
$parameters['start_stamp_end'] = $start_stamp_end.':59.999';
|
||||
}
|
||||
*/
|
||||
if (strlen($answer_stamp_begin) > 0 && strlen($answer_stamp_end) > 0) {
|
||||
$sql_where_ands[] = "answer_stamp between :answer_stamp_begin and :answer_stamp_end";
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin.':00.000';
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end.':59.999';
|
||||
}
|
||||
else if (strlen($answer_stamp_begin) > 0) {
|
||||
$sql_where_ands[] = "answer_stamp >= :answer_stamp_begin";
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin.':00.000';
|
||||
}
|
||||
else if (strlen($answer_stamp_end) > 0) {
|
||||
$sql_where_ands[] = "answer_stamp <= :answer_stamp_end";
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end.':59.999';
|
||||
}
|
||||
if (strlen($end_stamp_begin) > 0 && strlen($end_stamp_end) > 0) {
|
||||
$sql_where_ands[] = "end_stamp between :end_stamp_begin and :end_stamp_end";
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin.':00.000';
|
||||
$parameters['end_stamp_end'] = $end_stamp_end.':59.999';
|
||||
}
|
||||
else if (strlen($end_stamp_begin) > 0) {
|
||||
$sql_where_ands[] = "end_stamp >= :end_stamp_begin";
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin.':00.000';
|
||||
}
|
||||
else if (strlen($end_stamp_end) > 0) {
|
||||
$sql_where_ands[] = "end_stamp <= :end_stamp_end";
|
||||
$parameters['end_stamp_end'] = $end_stamp_end.':59.999';
|
||||
}
|
||||
if (strlen($duration) > 0) {
|
||||
$sql_where_ands[] = "duration like :duration";
|
||||
$parameters['duration'] = '%'.$duration.'%';
|
||||
}
|
||||
if (strlen($billsec) > 0) {
|
||||
$sql_where_ands[] = "billsec like :billsec";
|
||||
$parameters['billsec'] = '%'.$billsec.'%';
|
||||
}
|
||||
if (strlen($hangup_cause) > 0) {
|
||||
$sql_where_ands[] = "hangup_cause like :hangup_cause";
|
||||
$parameters['hangup_cause'] = '%'.$hangup_cause.'%';
|
||||
}
|
||||
if (is_uuid($uuid)) {
|
||||
$sql_where_ands[] = "uuid = :uuid";
|
||||
$parameters['uuid'] = $uuid;
|
||||
}
|
||||
if (is_uuid($bleg_uuid)) {
|
||||
$sql_where_ands[] = "bleg_uuid = :bleg_uuid";
|
||||
$parameters['bleg_uuid'] = $bleg_uuid;
|
||||
}
|
||||
if (strlen($accountcode) > 0) {
|
||||
$sql_where_ands[] = "accountcode = :accountcode";
|
||||
$parameters['accountcode'] = $accountcode;
|
||||
}
|
||||
if (strlen($read_codec) > 0) {
|
||||
$sql_where_ands[] = "read_codec like :read_codec";
|
||||
$parameters['read_codec'] = '%'.$read_codec.'%';
|
||||
}
|
||||
if (strlen($write_codec) > 0) {
|
||||
$sql_where_ands[] = "write_codec like :write_codec";
|
||||
$parameters['write_codec'] = '%'.$write_codec.'%';
|
||||
}
|
||||
if (strlen($remote_media_ip) > 0) {
|
||||
$sql_where_ands[] = "remote_media_ip like :remote_media_ip";
|
||||
$parameters['remote_media_ip'] = '%'.$remote_media_ip.'%';
|
||||
}
|
||||
if (strlen($network_addr) > 0) {
|
||||
$sql_where_ands[] = "network_addr like :network_addr";
|
||||
$parameters['network_addr'] = '%'.$network_addr.'%';
|
||||
}
|
||||
if (strlen($mos_comparison) > 0 && strlen($mos_score) > 0 ) {
|
||||
$sql_where_ands[] = "rtp_audio_in_mos ".$mos_comparison." :mos_score";
|
||||
$parameters['mos_score'] = $mos_score;
|
||||
}
|
||||
if (strlen($leg) > 0) {
|
||||
$sql_where_ands[] = "leg = :leg";
|
||||
$parameters['leg'] = $leg;
|
||||
}
|
||||
if (strlen($context) > 0) { $sql_where_ands[] = "context like '%".$context."%'"; }
|
||||
// if (strlen($start_stamp_begin) > 0 && strlen($start_stamp_end) > 0) { $sql_where_ands[] = "start_stamp BETWEEN '".$start_stamp_begin.":00.000' AND '".$start_stamp_end.":59.999'"; }
|
||||
// else if (strlen($start_stamp_begin) > 0) { $sql_where_ands[] = "start_stamp >= '".$start_stamp_begin.":00.000'"; }
|
||||
// else if (strlen($start_stamp_end) > 0) { $sql_where_ands[] = "start_stamp <= '".$start_stamp_end.":59.999'"; }
|
||||
if (strlen($answer_stamp_begin) > 0 && strlen($answer_stamp_end) > 0) { $sql_where_ands[] = "answer_stamp BETWEEN '".$answer_stamp_begin.":00.000' AND '".$answer_stamp_end.":59.999'"; }
|
||||
else if (strlen($answer_stamp_begin) > 0) { $sql_where_ands[] = "answer_stamp >= '".$answer_stamp_begin.":00.000'"; }
|
||||
else if (strlen($answer_stamp_end) > 0) { $sql_where_ands[] = "answer_stamp <= '".$answer_stamp_end.":59.999'"; }
|
||||
if (strlen($end_stamp_begin) > 0 && strlen($end_stamp_end) > 0) { $sql_where_ands[] = "end_stamp BETWEEN '".$end_stamp_begin.":00.000' AND '".$end_stamp_end.":59.999'"; }
|
||||
else if (strlen($end_stamp_begin) > 0) { $sql_where_ands[] = "end_stamp >= '".$end_stamp_begin.":00.000'"; }
|
||||
else if (strlen($end_stamp_end) > 0) { $sql_where_ands[] = "end_stamp <= '".$end_stamp_end.":59.999'"; }
|
||||
if (strlen($duration) > 0) { $sql_where_ands[] = "duration like '%".$duration."%'"; }
|
||||
if (strlen($billsec) > 0) { $sql_where_ands[] = "billsec like '%".$billsec."%'"; }
|
||||
if (strlen($hangup_cause) > 0) { $sql_where_ands[] = "hangup_cause like '%".$hangup_cause."%'"; }
|
||||
if (strlen($uuid) > 0) { $sql_where_ands[] = "uuid = '".$uuid."'"; }
|
||||
if (strlen($bleg_uuid) > 0) { $sql_where_ands[] = "bleg_uuid = '".$bleg_uuid."'"; }
|
||||
if (strlen($accountcode) > 0) { $sql_where_ands[] = "accountcode = '".$accountcode."'"; }
|
||||
if (strlen($read_codec) > 0) { $sql_where_ands[] = "read_codec like '%".$read_codec."%'"; }
|
||||
if (strlen($write_codec) > 0) { $sql_where_ands[] = "write_codec like '%".$write_codec."%'"; }
|
||||
if (strlen($remote_media_ip) > 0) { $sql_where_ands[] = "remote_media_ip like '%".$remote_media_ip."%'"; }
|
||||
if (strlen($network_addr) > 0) { $sql_where_ands[] = "network_addr like '%".$network_addr."%'"; }
|
||||
if (strlen($mos_comparison) > 0 && strlen($mos_score) > 0 ) { $sql_where_ands[] = "rtp_audio_in_mos " . $mos_comparison . " ".$mos_score.""; }
|
||||
if (strlen($leg) > 0) { $sql_where_ands[] = "leg='$leg'"; }
|
||||
|
||||
//if not admin or superadmin, only show own calls
|
||||
if (!permission_exists('xml_cdr_domain')) {
|
||||
if (count($_SESSION['user']['extension']) > 0) { // extensions are assigned to this user
|
||||
// create simple user extension array
|
||||
foreach ($_SESSION['user']['extension'] as $row) { $user_extensions[] = $row['user']; }
|
||||
foreach ($_SESSION['user']['extension'] as $row) {
|
||||
$user_extensions[] = $row['user'];
|
||||
}
|
||||
// if both a source and destination are submitted, but neither are an assigned extension, restrict results
|
||||
if (
|
||||
$caller_id_number != '' &&
|
||||
|
|
@ -208,22 +295,29 @@
|
|||
array_search($caller_id_number, $user_extensions) === false &&
|
||||
array_search($destination_number, $user_extensions) === false
|
||||
) {
|
||||
$sql_where_ors[] = "caller_id_number like '".$user_extension."'";
|
||||
$sql_where_ors[] = "destination_number like '".$user_extension."'";
|
||||
$sql_where_ors[] = "destination_number like '*99".$user_extension."'";
|
||||
$sql_where_ors[] = "caller_id_number like :user_extension";
|
||||
$sql_where_ors[] = "destination_number like :user_extension";
|
||||
$sql_where_ors[] = "destination_number like :star_99_user_extension";
|
||||
$parameters['user_extension'] = $user_extension;
|
||||
$parameters['star_99_user_extension'] = '*99'.$user_extension;
|
||||
}
|
||||
// if source submitted is blank, implement restriction for assigned extension(s)
|
||||
if ($caller_id_number == '') { // if source criteria is blank, then restrict to assigned ext
|
||||
foreach ($user_extensions as $user_extension) {
|
||||
if (strlen($user_extension) > 0) { $sql_where_ors[] = "caller_id_number like '".$user_extension."'"; }
|
||||
if (strlen($user_extension) > 0) {
|
||||
$sql_where_ors[] = "caller_id_number like :user_extension";
|
||||
$parameters['user_extension'] = $user_extension;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if destination submitted is blank, implement restriction for assigned extension(s)
|
||||
if ($destination_number == '') {
|
||||
foreach ($user_extensions as $user_extension) {
|
||||
if (strlen($user_extension) > 0) {
|
||||
$sql_where_ors[] = "destination_number like '".$user_extension."'";
|
||||
$sql_where_ors[] = "destination_number like '*99".$user_extension."'";
|
||||
$sql_where_ors[] = "destination_number like :user_extension";
|
||||
$sql_where_ors[] = "destination_number like :star_99_user_extension";
|
||||
$parameters['user_extension'] = $user_extension;
|
||||
$parameters['star_99_user_extension'] = '*99'.$user_extension;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -250,28 +344,25 @@
|
|||
$seconds_month = $seconds_day * 30;
|
||||
|
||||
//get the call volume between a start end end time in seconds
|
||||
function get_call_volume_between($start, $end, $where) {
|
||||
global $db;
|
||||
function get_call_volume_between($start, $end, $where, $parameters) {
|
||||
$sql = "select count(*) as count, sum(billsec) as seconds from v_xml_cdr ";
|
||||
$sql .= $where;
|
||||
$sql .= " start_epoch BETWEEN ".$start." AND ".$end." ";
|
||||
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
unset ($prep_statement, $sql);
|
||||
if (count($result) > 0) {
|
||||
foreach ($result as $row) {
|
||||
return array(
|
||||
'volume' => $row['count'], 'seconds' => $row['seconds'],
|
||||
);
|
||||
}
|
||||
$sql .= $where." ";
|
||||
$sql .= "start_epoch between :start and :end ";
|
||||
$parameters['start'] = $start;
|
||||
$parameters['end'] = $end;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
return array(
|
||||
'volume' => $row['count'],
|
||||
'seconds' => $row['seconds'],
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function append_stats(&$stats, $hours, $start_epoch, $stop_epoch){
|
||||
global $db, $sql_where, $missed;
|
||||
function append_stats(&$stats, $hours, $start_epoch, $stop_epoch) {
|
||||
global $sql_where, $parameters, $missed;
|
||||
|
||||
$i = count($stats);
|
||||
|
||||
|
|
@ -280,45 +371,46 @@
|
|||
$stats[$i]['stop_stamp'] = date('Y-m-d h:n:s', $stop_epoch);
|
||||
$stats[$i]['start_epoch'] = $start_epoch;
|
||||
$stats[$i]['stop_epoch'] = $stop_epoch;
|
||||
$stat_range = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $sql_where);
|
||||
$stat_range = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $sql_where, $parameters);
|
||||
$stats[$i]['volume'] = $stat_range ? $stat_range['volume'] : 0;
|
||||
$stats[$i]['seconds'] = $stat_range ? $stat_range['seconds'] : 0;
|
||||
$stats[$i]['minutes'] = $stats[$i]['seconds'] / 60;
|
||||
$stats[$i]['avg_sec'] = ($stats[$i]['volume']==0) ? 0 : $stats[$i]['seconds'] / $stats[$i]['volume'];
|
||||
$stats[$i]['avg_sec'] = $stats[$i]['volume'] == 0 ? 0 : $stats[$i]['seconds'] / $stats[$i]['volume'];
|
||||
|
||||
if($missed) {
|
||||
// we select only missed calls at first plase. so there no reasons to select it again.
|
||||
if ($missed) {
|
||||
//we select only missed calls at first place - no reasons to select it again
|
||||
$stats[$i]['missed'] = $stats[$i]['volume'];
|
||||
}
|
||||
else {
|
||||
$where = $sql_where . "billsec = '0' and ";
|
||||
$stat_range = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where);
|
||||
$where = $sql_where."billsec = '0' and ";
|
||||
$stat_range = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where, $parameters);
|
||||
$stats[$i]['missed'] = $stat_range ? $stat_range['volume'] : 0;
|
||||
}
|
||||
|
||||
$delta_min = ($stop_epoch - $start_epoch) / 60;
|
||||
$success_volume = ($stats[$i]['volume']==0) ? 0 : ($stats[$i]['volume'] - $stats[$i]['missed']);
|
||||
$success_volume = $stats[$i]['volume'] == 0 ? 0 : ($stats[$i]['volume'] - $stats[$i]['missed']);
|
||||
|
||||
// Calls per minute (answered)
|
||||
//calls per minute (answered)
|
||||
$stats[$i]['cpm_ans'] = $success_volume / $delta_min;
|
||||
|
||||
// Calls per minute
|
||||
//calls per minute
|
||||
$stats[$i]['avg_min'] = $stats[$i]['volume'] / $delta_min;
|
||||
|
||||
//answer / seizure ratio
|
||||
$stats[$i]['asr'] = ($stats[$i]['volume']==0) ? 0 : ($success_volume / $stats[$i]['volume'] * 100);
|
||||
$stats[$i]['asr'] = $stats[$i]['volume'] == 0 ? 0 : ($success_volume / $stats[$i]['volume'] * 100);
|
||||
|
||||
//average length of call
|
||||
$stats[$i]['aloc'] = ($success_volume==0) ? 0 : $stats[$i]['minutes'] / $success_volume;
|
||||
$stats[$i]['aloc'] = $success_volume == 0 ? 0 : $stats[$i]['minutes'] / $success_volume;
|
||||
}
|
||||
|
||||
if (strlen(check_str($_GET['start_stamp_begin'])) > 0 && strlen(check_str($_GET['start_stamp_end'])) > 0 ) {
|
||||
$start_date = new DateTime(check_str($_GET['start_stamp_begin']));
|
||||
$end_date = new DateTime(check_str($_GET['start_stamp_end']));
|
||||
if (strlen($_GET['start_stamp_begin']) > 0 && strlen($_GET['start_stamp_end']) > 0 ) {
|
||||
$start_date = new DateTime($_GET['start_stamp_begin']);
|
||||
$end_date = new DateTime($_GET['start_stamp_end']);
|
||||
$time = $end_date->getTimestamp();
|
||||
$time = $time - $time % 3600;
|
||||
$hours = floor(($end_date->getTimestamp() - $start_date->getTimestamp()) / 3600);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
//round down to the nearest hour
|
||||
$time = time() - time() % 3600;
|
||||
$hours = 23;
|
||||
|
|
@ -342,25 +434,24 @@
|
|||
}
|
||||
|
||||
//call info for entire period
|
||||
if (strlen(check_str($_GET['start_stamp_begin'])) > 0 && strlen(check_str($_GET['start_stamp_end'])) > 0 ) {
|
||||
$start_epoch = new DateTime(check_str($_GET['start_stamp_begin']));
|
||||
$stop_epoch = new DateTime(check_str($_GET['start_stamp_end']));
|
||||
if (strlen($_GET['start_stamp_begin']) > 0 && strlen($_GET['start_stamp_end']) > 0 ) {
|
||||
$start_epoch = new DateTime($_GET['start_stamp_begin']);
|
||||
$stop_epoch = new DateTime($_GET['start_stamp_end']);
|
||||
$days = $start_epoch->diff($stop_epoch)->d;
|
||||
append_stats($stats, 24 * $days, $start_epoch->getTimestamp(), $stop_epoch->getTimestamp() );
|
||||
}
|
||||
else {
|
||||
$stop_epoch = time();
|
||||
append_stats($stats, 24, $stop_epoch - $seconds_day, $stop_epoch );
|
||||
append_stats($stats, 24 * 7, $stop_epoch - $seconds_week, $stop_epoch );
|
||||
append_stats($stats, 24, $stop_epoch - $seconds_day, $stop_epoch );
|
||||
append_stats($stats, 24 * 7, $stop_epoch - $seconds_week, $stop_epoch );
|
||||
append_stats($stats, 24 * 30, $stop_epoch - $seconds_month, $stop_epoch );
|
||||
}
|
||||
|
||||
//show the graph
|
||||
|
||||
$x = 0;
|
||||
foreach ($stats as $row) {
|
||||
$graph['volume'][$x][] = $row['start_epoch'] * 1000;
|
||||
$graph['volume'][$x][] = $row['volume']/1;
|
||||
$graph['volume'][$x][] = $row['volume'] / 1;
|
||||
if ($x == $hours) { break; }
|
||||
$x++;
|
||||
}
|
||||
|
|
@ -381,14 +472,14 @@
|
|||
$x = 0;
|
||||
foreach ($stats as $row) {
|
||||
$graph['missed'][$x][] = $row['start_epoch'] * 1000;
|
||||
$graph['missed'][$x][] = $row['missed']/1;
|
||||
$graph['missed'][$x][] = $row['missed'] / 1;
|
||||
if ($x == $hours) { break; }
|
||||
$x++;
|
||||
}
|
||||
$x = 0;
|
||||
foreach ($stats as $row) {
|
||||
$graph['asr'][$x][] = $row['start_epoch'] * 1000;
|
||||
$graph['asr'][$x][] = round($row['asr'],2)/100;
|
||||
$graph['asr'][$x][] = round($row['asr'],2) / 100;
|
||||
if ($x == $hours) { break; }
|
||||
$x++;
|
||||
}
|
||||
|
|
@ -399,4 +490,5 @@
|
|||
if ($x == $hours) { break; }
|
||||
$x++;
|
||||
}
|
||||
?>
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue