From 4b7a93d4a9f629f83ecb897ecd8161cd99df3942 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sun, 15 Oct 2023 02:20:22 -0600 Subject: [PATCH] Add CDR call summary status messages --- app/xml_cdr/xml_cdr_details.php | 68 ++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/app/xml_cdr/xml_cdr_details.php b/app/xml_cdr/xml_cdr_details.php index 229fbe00df..720b511c27 100644 --- a/app/xml_cdr/xml_cdr_details.php +++ b/app/xml_cdr/xml_cdr_details.php @@ -246,7 +246,7 @@ 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_seconds"] = round(((int) $array["callflow"][$i]["times"]["profile_end_time"])/1000000 - ((int) $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); } @@ -305,16 +305,71 @@ //get the application array $app = find_app($destination_array, urldecode($row["caller_profile"]["destination_number"])); - //add application details for valet park + //call centers + if ($app['application'] == 'call_centers') { + if (isset($row["caller_profile"]["transfer_source"])) { + $app['status'] = 'Answered'; //Out + } + else { + $app['status'] = 'Waited'; //In + } + } + + //conferences + if ($app['application'] == 'conferences') { + $app['status'] = 'Answered'; + } + + //destinations + if ($app['application'] == 'destinations') { + $app['status'] = 'Routed'; + } + + //extensions + if ($app['application'] == 'extensions') { + if ($billsec == 0) { + $app['status'] = 'Missed'; + } + else { + $app['status'] = 'Answered'; + } + } + + //outbound routes + if ($call_direction == 'outbound') { + $app['application'] = 'dialplans'; + $app['uuid'] = ''; + $app['status'] = ''; + $app['name'] = 'Outbound'; + $app['label'] = 'Outbound'; + } + + //ring groups + if ($app['application'] == 'ring_groups') { + $app['status'] = 'Waited'; + } + + //time conditions + if ($app['application'] == 'time_conditions') { + $app['status'] = 'Routed'; + } + + //valet park if (substr($row["caller_profile"]["destination_number"], 0, 4) == 'park' or (substr($row["caller_profile"]["destination_number"], 0, 3) == '*59' && strlen($row["caller_profile"]["destination_number"]) == 5)) { $app['application'] = 'dialplans'; $app['uuid'] = '46ae6d82-bb83-46a3-901d-33d0724347dd'; + $app['status'] = '---'; $app['name'] = 'Park'; $app['label'] = 'Park'; } + //voicemails + if ($app['application'] == 'voicemails') { + $app['status'] = 'Answered'; + } + //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"; @@ -334,6 +389,7 @@ $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_status"] = $app['status']; $call_flow_summary[$x]["destination_description"] = $app['description']; //$call_flow_summary[$x]["application"] = $app; @@ -345,7 +401,7 @@ $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); + unset($app); $x++; } } @@ -406,7 +462,7 @@ echo "\n"; echo "\n"; echo "\n"; - echo "".$text['description-details']." \n"; + echo " ".$text['description-details']."\n"; echo "\n"; echo "\n"; echo "\n"; @@ -451,7 +507,7 @@ echo "".$text['label-start']."\n"; echo "".$text['label-end']."\n"; echo "".$text['label-duration']."\n"; - echo "".$text['label-status']."\n"; + echo "".$text['label-status']."\n"; echo "".$text['label-hangup_cause']."\n"; echo "\n"; @@ -509,6 +565,7 @@ echo "".$text['label-name']."\n"; echo "".$text['label-start']."\n"; echo "".$text['label-end']."\n"; + echo "".$text['label-status']."\n"; echo "".$text['label-duration']."\n"; echo "\n"; @@ -521,6 +578,7 @@ echo " ".escape($row["destination_name"])."\n"; echo " ".escape($row["start_stamp"])."\n"; echo " ".escape($row["end_stamp"])."\n"; + echo " ".escape($row["destination_status"])."\n"; echo " ".escape($row["duration_formatted"])."\n"; echo "\n";