[freeside-commits] branch FREESIDE_3_BRANCH updated. f974755f8ea10a94436bbac5707e79044d6c8aa2

Ivan ivan at 420.am
Mon Oct 27 10:29:59 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  f974755f8ea10a94436bbac5707e79044d6c8aa2 (commit)
      from  3e7e006eb5c83439a7647d94e4fd3c94f326be18 (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 f974755f8ea10a94436bbac5707e79044d6c8aa2
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Oct 27 10:29:56 2014 -0700

    Vitelity API: Use new getcdr command, RT#31037

diff --git a/bin/cdr-vitelity.import b/bin/cdr-vitelity.import
index 39c0361..55eb8cc 100755
--- a/bin/cdr-vitelity.import
+++ b/bin/cdr-vitelity.import
@@ -73,11 +73,20 @@ foreach my $export (@part_exports) {
   print "Downloading to ".$temp->filename."\n" if $opt{'v'};
 
   print "Sending API request..." if $opt{'v'};
-  my @records = eval { $export->vitelity_command('getcdr') };
+
+  my $s = time2str('%m-%d-%Y', $start);
+  my $e = time2str('%m-%d-%Y', $end);
+
+  my @records = eval { $export->vitelity_command('getcdr',
+                                                   'startdate' => $s,
+                                                   'enddate'   => $e,
+                                                );
+                     };
   if ( $@ ) {
     print "download error: $@\n";
     exit(-1);
   }
+
   print "received ".scalar(@records)." records\n" if $opt{'v'};
   if ( !@records ) {
     print "No records to process.\n" if $opt{'v'};
@@ -86,19 +95,10 @@ foreach my $export (@part_exports) {
 
   print $temp "Date,Source,Destination,Seconds,CallerID,Disposition,Cost\n";
 
-  my $regex = qr/^(\d{4})-(\d{2})-(\d{2})/;
-  my $s = time2str('%m-%d-%Y', $start);
-  my $e = time2str('%m-%d-%Y', $end);
-  my $count = 0;
   while (my $rec = shift @records) {
-    my $date = substr($rec, 0, 10);
-    next if ($start and $s gt $date);
-    next if ($end and $e le $date);
     print $temp $rec, "\n";
-    $count++;
   }
   close $temp;
-  print "Selected $count records in date range." if $opt{'v'};
 
   my $format = 'vitelity';
   my $batchname = "vitelity-$exportnum-".time2str('%Y/%m/%d-%T',time);

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

Summary of changes:
 bin/cdr-vitelity.import |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)




More information about the freeside-commits mailing list