From bbb71439d0ec714adda0e3b536aeb8ab64e5ffeb Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 6 Feb 2024 15:24:46 -0700 Subject: [PATCH] Bug Fix: missed_call handling and voicemail status Call going to voicemail for an extension was showing status answered instead of voicemail and missed call --- app/xml_cdr/resources/classes/xml_cdr.php | 28 ++++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index 7fd98d7800..1dc8197e64 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -479,6 +479,14 @@ if (!class_exists('xml_cdr')) { //marked as missed $missed_call = $xml->variables->missed_call; } + if (isset($xml->variables->billsec) && $xml->variables->billsec > 0) { + //answered call + $missed_call = 'false'; + } + if (isset($xml->variables->cc_side) && $xml->variables->cc_side == 'agent') { + //call center + $missed_call = 'false'; + } if (isset($xml->variables->fax_success)) { //fax server $missed_call = 'false'; @@ -495,18 +503,10 @@ if (!class_exists('xml_cdr')) { //voicemail $missed_call = 'true'; } - if (isset($xml->variables->voicemail_message) && $xml->variables->voicemail_message == true) { + if (isset($xml->variables->voicemail_answer_stamp) && !empty($xml->variables->voicemail_answer_stamp)) { //voicemail $missed_call = 'true'; } - if (isset($xml->variables->billsec) && $xml->variables->billsec > 0) { - //answered call - $missed_call = 'false'; - } - if (isset($xml->variables->cc_side) && $xml->variables->cc_side == 'agent') { - //call center - $missed_call = 'false'; - } if (isset($xml->variables->cc_side) && $xml->variables->cc_side == 'member' && isset($xml->variables->cc_cause) && $xml->variables->cc_cause == 'cancel') { //call center @@ -571,6 +571,12 @@ if (!class_exists('xml_cdr')) { if (substr($destination_number, 0, 3) == '*99') { $status = 'voicemail'; } + if (isset($xml->variables->voicemail_answer_stamp)) { + $status = 'voicemail'; + } + if (isset($xml->variables->voicemail_id)) { + $status = 'voicemail'; + } if ($xml->variables->hangup_cause == 'ORIGINATOR_CANCEL') { $status = 'cancelled'; } @@ -675,7 +681,7 @@ if (!class_exists('xml_cdr')) { $this->array[$key]['last_arg'] = urldecode($xml->variables->last_arg); //voicemail message success - if ($xml->variables->voicemail_action == "save" && $xml->variables->voicemail_message_seconds > 0){ + if (!empty($xml->variables->voicemail_answer_stamp) && $xml->variables->voicemail_message_seconds > 0){ $this->array[$key]['voicemail_message'] = "true"; } else { //if ($xml->variables->voicemail_action == "save") { @@ -1221,7 +1227,7 @@ if (!class_exists('xml_cdr')) { //voicemails if ($app['application'] == 'voicemails') { - $app['status'] = 'answered'; + $app['status'] = 'voicemail'; } //debug - add the callee_id_number to the end of the status