Add missed calls to CDR and CDR statistics.

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

View File

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

View File

@ -76,7 +76,8 @@ else {
echo "<table>\n"; echo "<table>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td>\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 "</td>\n";
echo "<form method='post' action='xml_cdr_csv.php'>"; echo "<form method='post' action='xml_cdr_csv.php'>";
echo "<td>\n"; echo "<td>\n";

View File

@ -45,32 +45,41 @@ else {
//get post or get variables from http //get post or get variables from http
if (count($_REQUEST)>0) { if (count($_REQUEST)>0) {
$order_by = $_REQUEST["order_by"]; $order_by = check_str($_REQUEST["order_by"]);
$order = $_REQUEST["order"]; $order = check_str($_REQUEST["order"]);
$cdr_id = $_REQUEST["cdr_id"]; $cdr_id = check_str($_REQUEST["cdr_id"]);
$direction = $_REQUEST["direction"]; $missed = check_str($_REQUEST["missed"]);
$caller_id_name = $_REQUEST["caller_id_name"]; $direction = check_str($_REQUEST["direction"]);
$caller_id_number = $_REQUEST["caller_id_number"]; $caller_id_name = check_str($_REQUEST["caller_id_name"]);
$destination_number = $_REQUEST["destination_number"]; $caller_id_number = check_str($_REQUEST["caller_id_number"]);
$context = $_REQUEST["context"]; $destination_number = check_str($_REQUEST["destination_number"]);
$start_stamp = $_REQUEST["start_stamp"]; $context = check_str($_REQUEST["context"]);
$answer_stamp = $_REQUEST["answer_stamp"]; $start_stamp = check_str($_REQUEST["start_stamp"]);
$end_stamp = $_REQUEST["end_stamp"]; $answer_stamp = check_str($_REQUEST["answer_stamp"]);
$duration = $_REQUEST["duration"]; $end_stamp = check_str($_REQUEST["end_stamp"]);
$billsec = $_REQUEST["billsec"]; $start_epoch = check_str($_REQUEST["start_epoch"]);
$hangup_cause = $_REQUEST["hangup_cause"]; $stop_epoch = check_str($_REQUEST["stop_epoch"]);
$uuid = $_REQUEST["uuid"]; $duration = check_str($_REQUEST["duration"]);
$bleg_uuid = $_REQUEST["bleg_uuid"]; $billsec = check_str($_REQUEST["billsec"]);
$accountcode = $_REQUEST["accountcode"]; $hangup_cause = check_str($_REQUEST["hangup_cause"]);
$read_codec = $_REQUEST["read_codec"]; $uuid = check_str($_REQUEST["uuid"]);
$write_codec = $_REQUEST["write_codec"]; $bleg_uuid = check_str($_REQUEST["bleg_uuid"]);
$remote_media_ip = $_REQUEST["remote_media_ip"]; $accountcode = check_str($_REQUEST["accountcode"]);
$network_addr = $_REQUEST["network_addr"]; $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 //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($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_name) > 0) { $sql_where .= "and caller_id_name like '%$caller_id_name%' "; }
if (strlen($caller_id_number) > 0 && strlen($destination_number) > 0) { if (strlen($caller_id_number) > 0 && strlen($destination_number) > 0) {
$sql_where .= "and ("; $sql_where .= "and (";
@ -137,6 +146,7 @@ else {
//set the param variable which is used with paging //set the param variable which is used with paging
$param = ""; $param = "";
$param .= "&missed=$missed";
$param .= "&caller_id_name=$caller_id_name"; $param .= "&caller_id_name=$caller_id_name";
$param .= "&start_stamp=$start_stamp"; $param .= "&start_stamp=$start_stamp";
$param .= "&hangup_cause=$hangup_cause"; $param .= "&hangup_cause=$hangup_cause";
@ -145,6 +155,8 @@ else {
$param .= "&context=$context"; $param .= "&context=$context";
$param .= "&answer_stamp=$answer_stamp"; $param .= "&answer_stamp=$answer_stamp";
$param .= "&end_stamp=$end_stamp"; $param .= "&end_stamp=$end_stamp";
$param .= "&start_epoch=$start_epoch";
$param .= "&stop_epoch=$stop_epoch";
$param .= "&duration=$duration"; $param .= "&duration=$duration";
$param .= "&billsec=$billsec"; $param .= "&billsec=$billsec";
$param .= "&uuid=$uuid"; $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]."'>".$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['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]."'>".(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['asr'],2))."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".(round($row['aloc'],2))."&nbsp;</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".(round($row['aloc'],2))."&nbsp;</td>\n";
echo "</tr >\n"; echo "</tr >\n";

View File

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