From f18e5788927ac0878a7ccf658b68313c57e21445 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 17 Apr 2020 12:51:49 -0600 Subject: [PATCH] Update v_xml_cdr_import.php --- app/xml_cdr/v_xml_cdr_import.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/xml_cdr/v_xml_cdr_import.php b/app/xml_cdr/v_xml_cdr_import.php index 37ad9b6eeb..58535cb6d5 100644 --- a/app/xml_cdr/v_xml_cdr_import.php +++ b/app/xml_cdr/v_xml_cdr_import.php @@ -230,11 +230,6 @@ if ($i == 0) { $context = urldecode($row->caller_profile->context); $destination_number = urldecode($row->caller_profile->destination_number); - if (isset($xml->variables->provider_prefix) && isset($destination_number)) { - $provider_prefix = $xml->variables->provider_prefix; - $destination_number = substr($destination_number, strlen($provider_prefix), strlen($destination_number)); - } - $database->fields['destination_number'] = $destination_number; $database->fields['context'] = $context; $database->fields['network_addr'] = urldecode($row->caller_profile->network_addr); } @@ -251,13 +246,19 @@ //if last_sent_callee_id_number is set use it for the destination_number if (($leg == 'a') && (strlen($xml->variables->last_sent_callee_id_number) > 0)) { $destination_number = urldecode($xml->variables->last_sent_callee_id_number); - if (isset($xml->variables->provider_prefix) && isset($destination_number)) { - $provider_prefix = $xml->variables->provider_prefix; + } + + //remove the provider prefix + if (isset($xml->variables->provider_prefix) && isset($destination_number)) { + $provider_prefix = $xml->variables->provider_prefix; + if ($provider_prefix == substr($destination_number, 0, strlen($provider_prefix))) { $destination_number = substr($destination_number, strlen($provider_prefix), strlen($destination_number)); } - $database->fields['destination_number'] = $destination_number; } + //store the destination_number + $database->fields['destination_number'] = $destination_number; + //store the call leg $database->fields['leg'] = $leg;