From 878f48a562d28afe39cc86abaaad5aa3b738ed88 Mon Sep 17 00:00:00 2001 From: Daniel Grotti Date: Fri, 19 Aug 2022 11:20:38 +0200 Subject: [PATCH] TT#151207 Save CF destinations to fax2mail with new prefix 'fax=' When the "Ignore domain" billing profile option is set, billing fees will be matched against the 'destination_user_in' CDR field (Instead of 'destination_user_in@destination_domain'). As a consequence, NGCP services such as vsc, conference, voicebox, fax2mail cannot longer be charged by defining domain-based fee entries (e.g. \.local$, @vsc\.local$, @conference\.local$, @voicebox\.local$ and @fax2mail\.local$). Hence, these services need to be matched differently when "Ignore domain" is set, if an operator wants to charge for those services separately. Only fax2mail calls has not predefined prefix that distinguishes it. In order to normalize that and fix this issue the panel will create and save in DB the CD destination for fax2mail with a new prefix: 'fax='. Change-Id: I926909e46828b43e476c75f2b3e0c51e20a2a5b6 --- lib/NGCP/Panel/Utils/CallList.pm | 7 +++++++ lib/NGCP/Panel/Utils/Subscriber.pm | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/NGCP/Panel/Utils/CallList.pm b/lib/NGCP/Panel/Utils/CallList.pm index 517e2c021b..4a05433798 100644 --- a/lib/NGCP/Panel/Utils/CallList.pm +++ b/lib/NGCP/Panel/Utils/CallList.pm @@ -221,6 +221,13 @@ sub process_cdr_item { $other_normalize = 0; $other_skip_domain = 1; $resource->{direction} = "out"; + # rewrite cf to fax2mail to "fax2mail" + } elsif ($item->destination_user_in =~ /^fax=/ && + $item->destination_domain_in eq "fax2mail.local") { + $resource->{other_cli} = "fax2mail"; + $other_normalize = 0; + $other_skip_domain = 1; + $resource->{direction} = "out"; } else { # for intra pbx in calls, use extension as other cli if($intra && $src_sub && $src_sub->pbx_extension) { diff --git a/lib/NGCP/Panel/Utils/Subscriber.pm b/lib/NGCP/Panel/Utils/Subscriber.pm index 5cab5a6634..52ca6e4a81 100644 --- a/lib/NGCP/Panel/Utils/Subscriber.pm +++ b/lib/NGCP/Panel/Utils/Subscriber.pm @@ -1415,7 +1415,7 @@ sub update_subscriber_numbers { for my $cfset($prov_subs->voip_cf_destination_sets->all) { for my $cf($cfset->voip_cf_destinations->all) { if($cf->destination =~ /\@fax2mail\.local$/) { - $cf->update({ destination => 'sip:'.$cli.'@fax2mail.local' }); + $cf->update({ destination => 'sip:fax='.$cli.'@fax2mail.local' }); } elsif($cf->destination =~ /\@conference\.local$/) { $cf->update({ destination => 'sip:conf='.$cli.'@conference.local' }); } @@ -1844,7 +1844,7 @@ sub field_to_destination { if($d eq "voicebox") { $d = "sip:".$vm_prefix.$number."\@voicebox.local"; } elsif($d eq "fax2mail") { - $d = "sip:$number\@fax2mail.local"; + $d = "sip:fax=$number\@fax2mail.local"; } elsif($d eq "conference") { $d = "sip:conf=$number\@conference.local"; } elsif($d eq "callingcard") {