Add missed calls to CDR and CDR statistics.

This commit is contained in:
Mark Crane
2013-01-17 18:32:16 +00:00
parent bc2f56ba4b
commit f3581a860e
5 changed files with 44 additions and 28 deletions

View File

@@ -61,8 +61,11 @@
$text['label-download']['en-us'] = 'Download';
$text['label-download']['pt-pt'] = '';
$text['label-statistics']['en-us'] = 'Statistics';
$text['label-statistics']['pt-pt'] = 'Estatisticas';
$text['button-statistics']['en-us'] = 'Statistics';
$text['button-statistics']['pt-pt'] = 'Estatisticas';
$text['button-missed']['en-us'] = 'Missed Calls';
$text['button-statistics']['pt-pt'] = 'Chamadas Perdidas';
//xml_cdr_details
$text['title2']['en-us'] = 'Call Details';

View File

@@ -76,7 +76,8 @@ else {
echo "<table>\n";
echo "<tr>\n";
echo "<td>\n";
echo " <input type='button' class='btn' value='".$text['label-statistics']."' onclick=\"document.location.href='xml_cdr_statistics.php';\">\n";
echo " <input type='button' class='btn' value='".$text['button-missed']."' onclick=\"document.location.href='xml_cdr.php?missed=true';\">\n";
echo " <input type='button' class='btn' value='".$text['button-statistics']."' onclick=\"document.location.href='xml_cdr_statistics.php';\">\n";
echo "</td>\n";
echo "<form method='post' action='xml_cdr_csv.php'>";
echo "<td>\n";

View File

@@ -45,32 +45,41 @@ else {
//get post or get variables from http
if (count($_REQUEST)>0) {
$order_by = $_REQUEST["order_by"];
$order = $_REQUEST["order"];
$cdr_id = $_REQUEST["cdr_id"];
$direction = $_REQUEST["direction"];
$caller_id_name = $_REQUEST["caller_id_name"];
$caller_id_number = $_REQUEST["caller_id_number"];
$destination_number = $_REQUEST["destination_number"];
$context = $_REQUEST["context"];
$start_stamp = $_REQUEST["start_stamp"];
$answer_stamp = $_REQUEST["answer_stamp"];
$end_stamp = $_REQUEST["end_stamp"];
$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"];
$order_by = check_str($_REQUEST["order_by"]);
$order = check_str($_REQUEST["order"]);
$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"]);
$destination_number = check_str($_REQUEST["destination_number"]);
$context = check_str($_REQUEST["context"]);
$start_stamp = check_str($_REQUEST["start_stamp"]);
$answer_stamp = check_str($_REQUEST["answer_stamp"]);
$end_stamp = check_str($_REQUEST["end_stamp"]);
$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"]);
}
//build the sql where string
if ($missed == true) {
$sql_where .= "and billsec = '0' ";
}
if (strlen($start_epoch) > 0 && strlen($stop_epoch) > 0) {
$sql_where .= "and start_epoch BETWEEN ".$start_epoch." AND ".$stop_epoch." ";
}
if (strlen($cdr_id) > 0) { $sql_where .= "and cdr_id like '%$cdr_id%' "; }
if (strlen($direction) > 0) { $sql_where .= "and direction like '%$direction%' "; }
if (strlen($direction) > 0) { $sql_where .= "and direction = '$direction' "; }
if (strlen($caller_id_name) > 0) { $sql_where .= "and caller_id_name like '%$caller_id_name%' "; }
if (strlen($caller_id_number) > 0 && strlen($destination_number) > 0) {
$sql_where .= "and (";
@@ -137,6 +146,7 @@ else {
//set the param variable which is used with paging
$param = "";
$param .= "&missed=$missed";
$param .= "&caller_id_name=$caller_id_name";
$param .= "&start_stamp=$start_stamp";
$param .= "&hangup_cause=$hangup_cause";
@@ -145,6 +155,8 @@ else {
$param .= "&context=$context";
$param .= "&answer_stamp=$answer_stamp";
$param .= "&end_stamp=$end_stamp";
$param .= "&start_epoch=$start_epoch";
$param .= "&stop_epoch=$stop_epoch";
$param .= "&duration=$duration";
$param .= "&billsec=$billsec";
$param .= "&uuid=$uuid";

View File

@@ -211,7 +211,7 @@ else {
echo " <td valign='top' class='".$row_style[$c]."'>".$row['volume']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".(round($row['minutes'],2))."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".(round($row['avg_min'],2))."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['missed']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href=\"xml_cdr.php?missed=true&direction=inbound&start_epoch=".$row['start_epoch']."&stop_epoch=".$row['stop_epoch']."\">".$row['missed']."</a>&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".(round($row['asr'],2))."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".(round($row['aloc'],2))."&nbsp;</td>\n";
echo "</tr >\n";

View File

@@ -61,8 +61,8 @@ else {
}
//create the sql query to get the xml cdr records
if (strlen($order_by) == 0) { $order_by = "start_epoch"; }
if (strlen($order) == 0) { $order = "desc"; }
if (strlen($order_by) == 0) { $order_by = "start_epoch"; }
if (strlen($order) == 0) { $order = "desc"; }
//calculate the seconds in different time frames
$seconds_hour = 3600;