summaryrefslogtreecommitdiff
path: root/FS/FS/part_pkg
diff options
context:
space:
mode:
authormark <mark>2010-07-15 20:34:46 +0000
committermark <mark>2010-07-15 20:34:46 +0000
commit24893d30ecc52b457e37214a598a07c5a0800c23 (patch)
treeda9e2da0ae6548a64b9aef8301e97ae76c3aac2f /FS/FS/part_pkg
parent99305e66f7e7a5cc16a35694f57a6adb49691625 (diff)
add skip_dst_prefix option, RT#3288
Diffstat (limited to 'FS/FS/part_pkg')
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm14
1 files changed, 12 insertions, 2 deletions
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index 003a3f3a9..1d2f6733c 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -149,6 +149,9 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
'use_cdrtypenum' => { 'name' => 'Do not charge for CDRs where the CDR Type is not set to: ',
},
+ '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:',
},
@@ -248,8 +251,9 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
disable_tollfree
use_amaflags use_disposition
use_disposition_taqua use_carrierid use_cdrtypenum
- skip_dcontext skip_dstchannel_prefix
- skip_src_length_more noskip_src_length_accountcode_tollfree
+ skip_dcontext skip_dst_prefix
+ skip_dstchannel_prefix skip_src_length_more
+ noskip_src_length_accountcode_tollfree
accountcode_tollfree_ratenum
skip_dst_length_less skip_lastapp
use_duration
@@ -819,6 +823,7 @@ sub check_chargable {
use_disposition_taqua
use_carrierid
use_cdrtypenum
+ skip_dst_prefix
skip_dcontext
skip_dstchannel_prefix
skip_src_length_more noskip_src_length_accountcode_tollfree
@@ -848,6 +853,11 @@ sub check_chargable {
if length($opt{'use_cdrtypenum'})
&& $cdr->cdrtypenum ne $opt{'use_cdrtypenum'}; #ne otherwise 0 matches ''
+ foreach(split(',',$opt{'skip_dst_prefix'})) {
+ return "dst starts with '$_'"
+ if length($_) && substr($cdr->dst,0,length($_)) eq $_;
+ }
+
return "dcontext IN ( $opt{'skip_dcontext'} )"
if $opt{'skip_dcontext'} =~ /\S/
&& grep { $cdr->dcontext eq $_ } split(/\s*,\s*/, $opt{'skip_dcontext'});