X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2Fbin%2Ffreeside-cdr-evariste-import;h=a875d1365e0c4a9b1fc79bdd07f8297e0bccbb23;hb=dc83512c36dc6bea2585abada4f88d714c600e55;hp=f61d9d51c3aae3ae2815233fea56dcdcfa949128;hpb=1115692072f22567e4f4359920fff947eed5df4e;p=freeside.git diff --git a/FS/bin/freeside-cdr-evariste-import b/FS/bin/freeside-cdr-evariste-import index f61d9d51c..a875d1365 100755 --- a/FS/bin/freeside-cdr-evariste-import +++ b/FS/bin/freeside-cdr-evariste-import @@ -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 @@ -98,14 +98,16 @@ while (my $row = $csth->fetchrow_hashref) { my $cdr = FS::cdr->new ({ # from cdr table 'cdrbatchnum' => $cdr_batch->cdrbatchnum, - 'uniqueid' => $row->{'cdr_id'}, + 'uniqueid' => $row->{'id'}, 'src' => $row->{'src'}, - 'dst' => $row->{'dest'}, - 'startdate' => str2time($row->{'start_time'}), - 'answerdate' => str2time($row->{'answer_time'}), - 'enddate' => str2time($row->{'end_time'}), + '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'})), 'duration' => $row->{'duration_sec'}, 'accountcode' => $row->{'customer_id'}, + 'src_ip_addr' => $row->{'src_ip'}, + 'dst_ip_addr' => $row->{'dest_ip'}, # from cdr_rate_postproc table 'billsec' => $row->{'rate_bill_sec'}, 'upstream_price' => $row->{'rate_cost_net'},