From cdc11c5d1671f796e4c4b693759d2e6a297dc72e Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 22 Feb 2024 09:19:57 -0700 Subject: [PATCH] Fix duration if null set to 0 If gmdate gets a null it uses the system time. This affected canceled calls. --- app/xml_cdr/xml_cdr.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index b63f8ffbf7..f59dcaba48 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -751,8 +751,8 @@ $hangup_cause = strtolower($hangup_cause); $hangup_cause = ucwords($hangup_cause); - //if call cancelled, show the ring time, not the bill time. - $seconds = $row['hangup_cause'] == "ORIGINATOR_CANCEL" ? $row['duration'] : round(($row['billmsec'] / 1000), 0, PHP_ROUND_HALF_UP); + //get the duration if null use 0 + $duration = $row['duration'] ?? 0; //determine recording properties if (!empty($row['record_path']) && !empty($row['record_name']) && permission_exists('xml_cdr_recording') && (permission_exists('xml_cdr_recording_play') || permission_exists('xml_cdr_recording_download'))) { @@ -914,7 +914,7 @@ } //duration if (permission_exists('xml_cdr_duration')) { - $content .= " ".gmdate("G:i:s", $seconds)."\n"; + $content .= " ".gmdate("G:i:s", $duration)."\n"; } //call result/status if (permission_exists("xml_cdr_status")) {