[freeside-commits] freeside/FS/FS/part_pkg voip_cdr.pm,1.57,1.58

Ivan,,, ivan at wavetail.420.am
Tue Mar 31 20:44:37 PDT 2009


Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv25099

Modified Files:
	voip_cdr.pm 
Log Message:
add options to skip CDRs under a defined length and with specific lastapp

Index: voip_cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/voip_cdr.pm,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- voip_cdr.pm	31 Mar 2009 19:47:35 -0000	1.57
+++ voip_cdr.pm	1 Apr 2009 03:44:34 -0000	1.58
@@ -119,6 +119,12 @@
     'skip_dstchannel_prefix' => { 'name' => 'Do not charge for CDRs where the dstchannel starts with:',
                                 },
 
+    'skip_dst_length_less' => { 'name' => 'Do not charge for CDRs where the destination is less than this many digits:',
+                              },
+
+    'skip_lastapp' => { 'name' => 'Do not charge for CDRs where the lastapp matches this value',
+                      },
+
     'use_duration'   => { 'name' => 'Calculate usage based on the duration field instead of the billsec field',
                           'type' => 'checkbox',
                         },
@@ -555,7 +561,9 @@
     use_carrierid
     use_cdrtypenum
     skip_dcontext
-    skip_dstchannel_prefix;
+    skip_dstchannel_prefix
+    skip_dst_length_less
+    skip_lastapp
   );
   foreach my $opt (grep !exists($flags{option_cache}->{$_}), @opt ) {
     $flags{option_cache}->{$opt} = $self->option($opt);
@@ -584,10 +592,17 @@
     if $opt{'skip_dcontext'} =~ /\S/
     && grep { $cdr->dcontext eq $_ } split(/\s*,\s*/, $opt{'skip_dcontext'});
 
-  my $len = length($opt{'skip_dstchannel_prefix'});
+  my $len_prefix = length($opt{'skip_dstchannel_prefix'});
   return "dstchannel starts with $opt{'skip_dstchannel_prefix'}"
-    if $len
-    && substr($cdr->dstchannel, 0, $len) eq $opt{'skip_dstchannel_prefix'};
+    if $len_prefix
+    && substr($cdr->dstchannel,0,$len_prefix) eq $opt{'skip_dstchannel_prefix'};
+
+  my $dst_length = $opt{'skip_dst_length_less'};
+  return "destination less than $dst_length digits"
+    if $dst_length && length($cdr->dst) < $dst_length;
+
+  return "lastapp is $opt{'skip_lastapp'}"
+    if length($opt{'skip_lastapp'}) && $cdr->lastapp eq $opt{'skip_lastapp'};
 
   #all right then, rate it
   '';



More information about the freeside-commits mailing list