summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2016-06-29 14:29:45 -0700
committerIvan Kohler <ivan@freeside.biz>2016-06-29 14:29:45 -0700
commit5efc5f8abe54622a84f06da9a678c0a06e62b57c (patch)
tree4e3167a15a69054fd8e234a84bcb51669ac84a34
parent55f757667dadf2e16b1c91bfe4c456accf6f7999 (diff)
add skip_dcontext_suffix to skip CDRs with dcontext ending in a definable string, RT#71529
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index 24c4cf041..0ff4e5469 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -185,7 +185,10 @@ tie my %accountcode_tollfree_field, 'Tie::IxHash',
'skip_dst_prefix' => { 'name' => 'Do not charge for CDRs where the destination number starts with any of these values: ',
},
- 'skip_dcontext' => { 'name' => 'Do not charge for CDRs where the dcontext is set to any of these (comma-separated) values: ',
+ 'skip_dcontext' => { 'name' => 'Do not charge for CDRs where dcontext is set to any of these (comma-separated) values: ',
+ },
+
+ 'skip_dcontext_suffix' => { 'name' => 'Do not charge for CDRs where dcontext ends with: ',
},
'skip_dstchannel_prefix' => { 'name' => 'Do not charge for CDRs where the dstchannel starts with:',
@@ -588,6 +591,11 @@ sub check_chargable {
if $self->option_cacheable('skip_dcontext') =~ /\S/
&& grep { $cdr->dcontext eq $_ } split(/\s*,\s*/, $self->option_cacheable('skip_dcontext'));
+ my $len_suffix = length($self->option_cacheable('skip_dcontext_suffix'));
+ return "dcontext ends with ". $self->option_cacheable('skip_dcontext_suffix')
+ if $len_suffix
+ && substr($cdr->dcontext,-$len_suffix,$len_suffix) eq $self->option_cacheable('skip_dcontext_suffix');
+
my $len_prefix = length($self->option_cacheable('skip_dstchannel_prefix'));
return "dstchannel starts with ". $self->option_cacheable('skip_dstchannel_prefix')
if $len_prefix