default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / FS / bin / freeside-cdr-evariste-import
index 0487ae5..a875d13 100755 (executable)
@@ -2,7 +2,7 @@
 
 use strict;
 
-use DBI;
+use FS::DBI;
 use Date::Format 'time2str';
 use Date::Parse 'str2time';
 use Getopt::Long;
@@ -65,8 +65,8 @@ if ($enddate) {
 }
 $enddate ||= time2str("%Y-%m-%d %H:%M:%S",$now);
 
-my $cdbh = DBI->connect("dbi:Pg:database=$db;host=$host", $username, $password) 
-  or die $DBI::errstr;
+my $cdbh = FS::DBI->connect("dbi:Pg:database=$db;host=$host", $username, $password) 
+  or die $FS::DBI::errstr;
 
 # selecting by end_time rather than start_time 
 # so we don't lose records between batches
@@ -100,7 +100,7 @@ while (my $row = $csth->fetchrow_hashref) {
     'cdrbatchnum'             => $cdr_batch->cdrbatchnum,
     'uniqueid'                => $row->{'id'},
     'src'                     => $row->{'src'},
-    'dst'                     => $row->{'dest'},
+    'dst'                     => $row->{'routing_target'} || $row->{'dest'}, # dest_orig? dest_trans?
     'startdate'               => int(str2time($row->{'start_time'})),
     'answerdate'              => int(str2time($row->{'answer_time'})),
     'enddate'                 => int(str2time($row->{'end_time'})),