[freeside-commits] branch FREESIDE_4_BRANCH updated. ebbd08ba62328743bf0d5d0b47f2e9a192288a74

Ivan ivan at 420.am
Mon Nov 7 12:11:17 PST 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  ebbd08ba62328743bf0d5d0b47f2e9a192288a74 (commit)
      from  9f0cf3c4adeb541827d1620576db11e99599bca6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ebbd08ba62328743bf0d5d0b47f2e9a192288a74
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Nov 7 12:11:15 2016 -0800

    add option to only charge for CDRs starting with a disposition prefix, RT#73195

diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index 9ecdba6..df97286 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -182,7 +182,10 @@ tie my %accountcode_tollfree_field, 'Tie::IxHash',
     'disposition_in' => { 'name' => 'Only charge for CDRs where the Disposition is set to any of these (comma-separated) values: ',
                          },
 
-    'skip_dst_prefix' => { 'name' => 'Do not charge for CDRs where the destination number starts with any of these values: ',
+    'disposition_prefix' => { 'name' => 'Only charge for CDRs where the Disposition starts with: ',
+                         },
+
+    'skip_dst_prefix' => { 'name' => 'Do not charge for CDRs where the destination number starts with 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: ',
@@ -332,7 +335,7 @@ tie my %accountcode_tollfree_field, 'Tie::IxHash',
                        use_carrierid 
                        use_cdrtypenum ignore_cdrtypenum
                        use_calltypenum ignore_calltypenum
-                       ignore_disposition disposition_in
+                       ignore_disposition disposition_in disposition_prefix
                        skip_dcontext skip_dcontext_suffix skip_dst_prefix 
                        skip_dstchannel_prefix skip_src_length_more 
                        noskip_src_length_accountcode_tollfree
@@ -562,7 +565,13 @@ sub check_chargable {
   return "disposition NOT IN ( ". $self->option_cacheable('disposition_in')." )"
     if $self->option_cacheable('disposition_in') =~ /\S/
     && !grep { $cdr->disposition eq $_ } split(/\s*,\s*/, $self->option_cacheable('disposition_in'));
-  
+
+  my $disposition_prefix = $self->option_cacheable('disposition_prefix');
+  my $len_dis_prefix = length($disposition_prefix);
+  return "disposition does not start with $disposition_prefix"
+    if $len_dis_prefix
+    && substr($cdr->disposition, 0, $len_dis_prefix) ne $disposition_prefix;
+
   return "disposition IN ( ". $self->option_cacheable('ignore_disposition')." )"
     if $self->option_cacheable('ignore_disposition') =~ /\S/
     && grep { $cdr->disposition eq $_ } split(/\s*,\s*/, $self->option_cacheable('ignore_disposition'));

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_pkg/voip_cdr.pm |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)




More information about the freeside-commits mailing list