From 2cd382ec38f2a5ee1270fd05d0ca446db095f69e Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 23 Aug 2022 13:13:34 -0600 Subject: [PATCH] Get caller ID from the same call flow -> caller profile This is the same place we get caller ID from in the XML CDR Details page. --- app/xml_cdr/resources/classes/xml_cdr.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index e181dbd616..26a750e12c 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -298,11 +298,22 @@ if (!class_exists('xml_cdr')) { //process data if the call detail record is not a duplicate if ($duplicate_uuid == false && is_uuid($uuid)) { - //get the caller ID - if (isset($xml->variables->caller_id_name)) { + //get the caller ID from call flow caller profile + $i = 0; + foreach ($xml->callflow as $row) { + if ($i == 0) { + $caller_id_name = urldecode($row->caller_profile->caller_id_name); + $caller_id_number = urldecode($row->caller_profile->caller_id_number); + } + $i++; + } + unset($i); + + //get the caller ID from variables + if (!isset($caller_id_number) && isset($xml->variables->caller_id_name)) { $caller_id_name = urldecode($xml->variables->caller_id_name); } - if (isset($xml->variables->caller_id_number)) { + if (!isset($caller_id_number) && isset($xml->variables->caller_id_number)) { $caller_id_number = urldecode($xml->variables->caller_id_number); } if (!isset($caller_id_number) && isset($xml->variables->sip_from_user)) {