From a35de4aba37b1b44f00f958da49f5c94244d8b37 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 13 Oct 2023 01:52:09 -0600 Subject: [PATCH] Call Summary fix voicemails name and extra row --- app/voicemails/app_config.php | 2 +- app/xml_cdr/xml_cdr_details.php | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/voicemails/app_config.php b/app/voicemails/app_config.php index a140635c1d..4c1c1d9441 100644 --- a/app/voicemails/app_config.php +++ b/app/voicemails/app_config.php @@ -34,7 +34,7 @@ $apps[$x]['destinations'][$y]['type'] = "sql"; $apps[$x]['destinations'][$y]['label'] = "voicemails"; $apps[$x]['destinations'][$y]['name'] = "voicemails"; - $apps[$x]['destinations'][$y]['sql'] = "select voicemail_uuid, voicemail_uuid as uuid, voicemail_id as destination, '*99' || voicemail_id as extension, voicemail_description as description from v_voicemails"; + $apps[$x]['destinations'][$y]['sql'] = "select voicemail_uuid, voicemail_uuid as uuid, voicemail_id as destination, '*99' || voicemail_id as extension, voicemail_description as description, voicemail_description as name from v_voicemails"; $apps[$x]['destinations'][$y]['where'] = "where domain_uuid = '\${domain_uuid}' and voicemail_enabled = 'true' "; $apps[$x]['destinations'][$y]['order_by'] = "voicemail_id asc "; $apps[$x]['destinations'][$y]['field']['uuid'] = "voicemail_uuid"; diff --git a/app/xml_cdr/xml_cdr_details.php b/app/xml_cdr/xml_cdr_details.php index ebbf1b781c..20022e9b62 100644 --- a/app/xml_cdr/xml_cdr_details.php +++ b/app/xml_cdr/xml_cdr_details.php @@ -243,16 +243,23 @@ $array["callflow"] = array_reverse($array["callflow"]); //add the final call flow destination to the call flow array - if ($call_direction == 'inbound' || $call_direction == 'local') { + //when call_direction is inbound + //when destination_number is not same as the last row + //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') { $i = count($array["callflow"]); - if (!empty($array["callflow"]) && $array["callflow"][$i-1]["destination_number"] != $destination_number) { - $array["callflow"][$i]["caller_profile"]["destination_number"] = $destination_number; - $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"]["end_stamp"] = $end_epoch * 1000000; - $array["callflow"][$i]["times"]["hangup_time"] = $end_epoch * 1000000; + if (!empty($array["callflow"]) + && $array["callflow"][$i-1]["destination_number"] != $destination_number + && substr($array["callflow"][$i-1]["caller_profile"]["destination_number"], 0, 3) != '*99') { + $array["callflow"][$i]["caller_profile"]["destination_number"] = $destination_number; + $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"]["end_stamp"] = $end_epoch * 1000000; + $array["callflow"][$i]["times"]["hangup_time"] = $end_epoch * 1000000; } }