From a1751207033b47832ff42b8a41db5f8791496da1 Mon Sep 17 00:00:00 2001 From: Kirill Solomko Date: Mon, 6 Jul 2015 15:03:25 +0200 Subject: [PATCH] MT#13847 - CallLists: preserve cli if no rewrite rules are found Change-Id: I1dd50f34815b1e046b9f0197a86c6e0385edae6f --- lib/NGCP/Panel/Role/API/CallLists.pm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/NGCP/Panel/Role/API/CallLists.pm b/lib/NGCP/Panel/Role/API/CallLists.pm index 190213c380..5190f6123f 100644 --- a/lib/NGCP/Panel/Role/API/CallLists.pm +++ b/lib/NGCP/Panel/Role/API/CallLists.pm @@ -227,10 +227,11 @@ sub resource_from_item { if($resource->{own_cli} !~ /^\d+$/) { $resource->{own_cli} .= '@'.$own_domain; } elsif($own_normalize) { - $resource->{own_cli} = NGCP::Panel::Utils::Subscriber::apply_rewrite( - c => $c, subscriber => $sub // $own_sub, - number => $resource->{own_cli}, direction => "caller_out" - ); + if (my $normalized_cli = NGCP::Panel::Utils::Subscriber::apply_rewrite( + c => $c, subscriber => $sub // $own_sub, + number => $resource->{own_cli}, direction => "caller_out")) { + $resource->{own_cli} = $normalized_cli; + } } if($resource->{direction} eq "in" && $item->source_clir) { @@ -238,10 +239,11 @@ sub resource_from_item { } elsif(!$other_skip_domain && $resource->{other_cli} !~ /^\d+$/) { $resource->{other_cli} .= '@'.$other_domain; } elsif($other_normalize) { - $resource->{other_cli} = NGCP::Panel::Utils::Subscriber::apply_rewrite( - c => $c, subscriber => $sub // $own_sub, - number => $resource->{other_cli}, direction => "caller_out" - ); + if (my $normalized_cli = NGCP::Panel::Utils::Subscriber::apply_rewrite( + c => $c, subscriber => $sub // $own_sub, + number => $resource->{other_cli}, direction => "caller_out")) { + $resource->{other_cli} = $normalized_cli; + } } if ( (!($sub // $own_sub)) || (($sub // $own_sub)->status eq "terminated") ) { $resource->{own_cli} .= " (terminated)";