diff --git a/app/xml_cdr/xml_cdr_details.php b/app/xml_cdr/xml_cdr_details.php
index 22baee4f12..3aa153838d 100644
--- a/app/xml_cdr/xml_cdr_details.php
+++ b/app/xml_cdr/xml_cdr_details.php
@@ -135,12 +135,13 @@
$caller_destination = trim($row["caller_destination"]);
$destination_number = trim($row["destination_number"]);
$duration = trim($row["billsec"]);
+ $missed_call = trim($row["missed_call"]);
$start_stamp = trim($row["start_stamp"]);
$xml_string = trim($row["xml"] ?? '');
$json_string = trim($row["json"]);
$direction = trim($row["direction"]);
$call_direction = trim($row["direction"]);
- //$status = trim($row["status"]);
+ $status = trim($row["status"]);
}
unset($sql, $parameters, $row);
@@ -186,26 +187,6 @@
echo $e->getMessage();
}
-//get the header
- require_once "resources/header.php";
-
-//page title and description
- echo "
\n";
- echo "
\n";
- echo "
\n";
-
//get the variables
$xml_cdr_uuid = urldecode($array["variables"]["uuid"]);
$language = urldecode($array["variables"]["language"] ?? '');
@@ -239,9 +220,40 @@
$array["callflow"][0] = $tmp;
}
+//set the time zone
+ if (isset($_SESSION['domain']['time_zone']['name'])) {
+ date_default_timezone_set($_SESSION['domain']['time_zone']['name']);
+ }
+
//reverse the array to put events in chronological order
$array["callflow"] = array_reverse($array["callflow"]);
+//add the profile end time to the call flow array
+ $i = 0;
+ foreach ($array["callflow"] as $row) {
+ //set the profile end time
+ if (isset($array["callflow"][$i+1]["times"]["profile_created_time"])) {
+ $array["callflow"][$i]["times"]["profile_end_time"] = $array["callflow"][$i+1]["times"]["profile_created_time"];
+ }
+ else {
+ $array["callflow"][$i]["times"]["profile_end_time"] = $end_epoch * 1000000;
+ }
+ $i++;
+ }
+
+//format the times in the call flow array and add the profile duration
+ $i = 0;
+ foreach ($array["callflow"] as $row) {
+ foreach ($row["times"] as $name => $value) {
+ if ($value > 0) {
+ $array["callflow"][$i]["times"]["profile_duration_seconds"] = round($array["callflow"][$i]["times"]["profile_end_time"]/1000000 - $array["callflow"][$i]["times"]["profile_created_time"]/1000000);
+ $array["callflow"][$i]["times"]["profile_duration_formatted"] = gmdate("G:i:s", (int) $array["callflow"][$i]["times"]["profile_duration_seconds"]);
+ $array["callflow"][$i]["times"][$name.'stamp'] = date("Y-m-d H:i:s", (int) $value/1000000);
+ }
+ }
+ $i++;
+ }
+
//debug information
if (isset($_REQUEST['debug']) && $_REQUEST['debug'] == 'true') {
view_array($array["callflow"], false);
@@ -259,6 +271,7 @@
//when last destination is not voicemail *99ext
//count the array $i-1 finds the last record
//count the array $i is the next record
+ /*
if ($call_direction == 'inbound') {
//count the array
$i = $callflow_count;
@@ -277,68 +290,57 @@
$array["callflow"][$i]["caller_profile"]["network_addr"] = $network_address;
$array["callflow"][$i]["caller_profile"]["caller_id_name"] = $caller_id_name;
$array["callflow"][$i]["caller_profile"]["caller_id_number"] = $caller_id_number;
- $array["callflow"][$i]["times"]["profile_created_time"] = ($end_epoch - $duration) * 1000000;
+ //$array["callflow"][$i]["times"]["profile_created_time"] = ($end_epoch - $duration) * 1000000;
$array["callflow"][$i]["times"]["end_stamp"] = $end_epoch * 1000000;
$array["callflow"][$i]["times"]["hangup_time"] = $end_epoch * 1000000;
+ $callflow_count++;
}
}
+ */
//build the call summary array
$x = 0;
- if (!empty($array["callflow"])) foreach ($array["callflow"] as $row) {
- if ($x == 0) {
- $context = urldecode($row["caller_profile"]["context"]);
- $network_addr = urldecode($row["caller_profile"]["network_addr"]);
- }
- $caller_id_name = urldecode($row["caller_profile"]["caller_id_name"]);
- $caller_id_number = urldecode($row["caller_profile"]["caller_id_number"]);
- $call_flow_destination_number = urldecode($row["caller_profile"]["destination_number"]);
- $call_flow_summary[$x]["destination_number"] = $call_flow_destination_number;
- if (isset($call_flow_summary[$x-1]["end_epoch"])) {
- $tmp_start_stamp = $call_flow_summary[$x-1]["end_epoch"];
- }
- elseif (isset($row["times"]["created_time"])) {
- $tmp_start_stamp = urldecode($row["times"]["created_time"]) / 1000000;
- }
+ if (!empty($array["callflow"])) {
+ foreach ($array["callflow"] as $row) {
+ //get the application array
+ $app = find_app($destination_array, urldecode($row["caller_profile"]["destination_number"]));
- $tmp_end_stamp_formatted = '';
- if (isset($array["callflow"][$x]["times"]["transfer_time"]) && $array["callflow"][$x]["times"]["transfer_time"] > 0) {
- $tmp_end_stamp = urldecode($array["callflow"][$x]["times"]["transfer_time"]) / 1000000;
- $tmp_end_stamp_formatted = date("Y-m-d H:i:s", (int) $tmp_end_stamp);
- }
- elseif (isset($array["callflow"][$x]["times"]["bridged_time"]) && $array["callflow"][$x]["times"]["bridged_time"] > 0) {
- $tmp_end_stamp = urldecode($array["callflow"][$x]["times"]["bridged_time"]) / 1000000;
- $tmp_end_stamp_formatted = date("Y-m-d H:i:s", (int) $tmp_end_stamp);
- }
- elseif (isset($array["callflow"][$x+1]["times"]["created_time"])) {
- $tmp_end_stamp = urldecode($array["callflow"][$x+1]["times"]["created_time"]) / 1000000;
- $tmp_end_stamp_formatted = date("Y-m-d H:i:s", (int) $tmp_end_stamp);
- }
- elseif (isset($row["times"]["hangup_time"])) {
- $tmp_end_stamp = urldecode($row["times"]["hangup_time"]) / 1000000;
- $tmp_end_stamp_formatted = date("Y-m-d H:i:s", (int) $tmp_end_stamp);
- }
- $call_flow_summary[$x]["start_epoch"] = $tmp_start_stamp;
- $call_flow_summary[$x]["end_epoch"] = $tmp_end_stamp;
- $call_flow_summary[$x]["start_stamp"] = date("Y-m-d H:i:s", (int) $tmp_start_stamp);
- $call_flow_summary[$x]["end_stamp"] = $tmp_end_stamp_formatted;
- $call_flow_summary[$x]["duration"] = gmdate("G:i:s", (int) $tmp_end_stamp - (int) $tmp_start_stamp);
+ //build the application urls
+ $destination_url = "/app/".$app['application']."/".$destination->singular($app['application'])."_edit.php?id=".$app["uuid"];
+ $application_url = "/app/".$app['application']."/".$app['application'].".php";
+ if ($app['application'] == 'call_centers') {
+ $destination_url = "/app/".$app['application']."/".$destination->singular($app['application'])."_queue_edit.php?id=".$app['uuid'];
+ $application_url = "/app/".$app['application']."/".$destination->singular($app['application'])."_queues.php";
+ }
- unset($tmp_end_stamp, $tmp_start_stamp, $tmp_end_stamp_formatted);
- $x++;
+ //add the application and destination details
+ $language2 = new text;
+ $text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$app['application']);
+ $call_flow_summary[$x]["application_name"] = $app['application'];
+ $call_flow_summary[$x]["application_label"] = trim($text2['title-'.$app['application']]);
+ $call_flow_summary[$x]["application_url"] = $application_url;
+ $call_flow_summary[$x]["destination_uuid"] = $app['uuid'];
+ $call_flow_summary[$x]["destination_name"] = $app['name'];
+ $call_flow_summary[$x]["destination_url"] = $destination_url;
+ $call_flow_summary[$x]["destination_number"] = $row["caller_profile"]["destination_number"];
+ $call_flow_summary[$x]["destination_label"] = $app['label'];
+ $call_flow_summary[$x]["destination_description"] = $app['description'];
+ //$call_flow_summary[$x]["application"] = $app;
+
+ //add the call flow times
+ $call_flow_summary[$x]["start_epoch"] = round($row['times']['profile_created_time'] / 1000000);
+ $call_flow_summary[$x]["end_epoch"] = round($row['times']['profile_end_time'] / 1000000);
+ $call_flow_summary[$x]["start_stamp"] = $row['times']['profile_created_timestamp'];
+ $call_flow_summary[$x]["end_stamp"] = $row['times']['profile_end_timestamp'];
+ $call_flow_summary[$x]["duration_seconds"] = $row['times']['profile_duration_seconds'];
+ $call_flow_summary[$x]["duration_formatted"] = $row['times']['profile_duration_formatted'];
+
+ unset($tmp_end_stamp, $tmp_start_stamp, $tmp_end_stamp_formatted);
+ $x++;
+ }
}
unset($x);
-//call flow summary with one row use start_epoch and end_epoch
- if ($callflow_count == 1) {
- $call_flow_summary[0]["destination_number"] = urldecode($row["caller_profile"]["destination_number"]);
- $call_flow_summary[0]["start_epoch"] = $start_epoch;
- $call_flow_summary[0]["end_epoch"] = $end_epoch;
- $call_flow_summary[0]["start_stamp"] = date("Y-m-d H:i:s", (int) $start_epoch);
- $call_flow_summary[0]["end_stamp"] = date("Y-m-d H:i:s", (int) $end_epoch);
- $call_flow_summary[0]["duration"] = gmdate("G:i:s", (int) $end_epoch - (int) $start_epoch);
- }
-
//set the year, month and date
$tmp_year = date("Y", strtotime($start_stamp));
$tmp_month = date("M", strtotime($start_stamp));
@@ -349,6 +351,17 @@
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
+//set the status
+ if ($billsec > 0) {
+ $status = 'Answered';
+ }
+ if ($missed_call == '1') {
+ $status = 'Missed';
+ }
+ if (substr($destination_number, 0, 3) == '*99') {
+ $status = 'Voicemail';
+ }
+
//build the summary array
$summary_array = array();
$summary_array['direction'] = escape($direction);
@@ -363,11 +376,33 @@
$summary_array['start'] = escape($start_stamp);
$summary_array['end'] = escape($end_stamp);
$summary_array['duration'] = escape(gmdate("G:i:s", (int)$duration));
- //$summary_array['status'] = escape($status);
+ if (isset($status)) {
+ $summary_array['status'] = escape($status);
+ }
if (permission_exists('xml_cdr_hangup_cause')) {
$summary_array['hangup_cause'] = escape($hangup_cause);
}
+//get the header
+ require_once "resources/header.php";
+
+//page title and description
+ echo "\n";
+ echo "
\n";
+ echo "
\n";
+
//show the content
echo "\n";
echo "\n";
@@ -407,8 +442,9 @@
echo "| ".$text['label-end']." | \n";
echo "".$text['label-duration']." | \n";
echo "".$text['label-status']." | \n";
+ echo "".$text['label-hangup_cause']." | \n";
echo "
\n";
-
+
echo "\n";
echo " | ".escape($direction)." | \n";
//echo " ".$language." | \n";
@@ -417,7 +453,7 @@
if (file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')) {
//echo " \n";
//echo " ";
-
+
echo " \n";
//$tmp_file_array = explode("\.",$file);
echo $caller_id_name.' ';
@@ -438,9 +474,10 @@
}
echo " \n";
echo " ".escape($destination_number)." | \n";
- echo " ".escape($start_stamp)." | \n";
- echo " ".escape($end_stamp)." | \n";
+ echo " ".escape(date("Y-m-d H:i:s", (int) $start_epoch))." | \n";
+ echo " ".escape(date("Y-m-d H:i:s", (int) $end_epoch))." | \n";
echo " ".escape(gmdate("G:i:s", (int)$duration))." | \n";
+ echo " ".escape($status)." | \n";
echo " ".escape($hangup_cause)." | \n";
echo "
";
echo "
\n";
@@ -457,37 +494,31 @@
echo "";
echo "
\n";