X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Fcdr-voipswitch.import;h=69d0636a7efeeebcc832df1915ca96d74ebc764b;hp=0392f6b37a8639a7a379f492c6fb26168b62d415;hb=HEAD;hpb=8e307f751bd744e784465e114437978c81a3c000 diff --git a/bin/cdr-voipswitch.import b/bin/cdr-voipswitch.import old mode 100644 new mode 100755 index 0392f6b37..69d0636a7 --- a/bin/cdr-voipswitch.import +++ b/bin/cdr-voipswitch.import @@ -50,11 +50,11 @@ else { } my @cols = (qw( - id_call id_client ip_number caller_id called_number call-start call_end + id_call id_client ip_number caller_id called_number call_start call_end route_type id_tariff cost duration tariff_prefix client_type id_route pdd costR1 costR2 costR3 costD id_reseller tariffdesc id_cc ratio client_pdd orig_call_id term_call_id id_callback_call id_cn dialing_plan_prefix - call_rate effective_duration dtmf call-data tariff_data id_dial_plan + call_rate effective_duration dtmf call_data tariff_data id_dial_plan )); #effective_duration/billsec appears from the documentation to be post-minimum time and granularity, calculated on the switch (see p4-5). would probably have weired effects if we then tried to do the same in freeside. @@ -121,11 +121,17 @@ my $imported = 0; my $row; while ( $row = $sth->fetchrow_hashref ) { + my $ip = $row->{ip_number}; + if ( $ip =~ /^([\d\.]+)\/([\d\.]*)/ ) { + $ip = $1; + #$nat_ip = $2; + } + my $cdr = FS::cdr->new({ cdrid => $row->{id_call}, charged_party => sprintf('%.2d', $row->{client_type}). $row->{id_client}, - src_ip_addr => $row->{ip_number}, + src_ip_addr => $ip, src => $row->{caller_id}, dst => $row->{called_number}, startdate => str2time($row->{call_start}), @@ -138,7 +144,7 @@ while ( $row = $sth->fetchrow_hashref ) { uniqueid => $row->{id_cc}, orig_call_id => $row->{clid}, billsec => $row->{effective_duration}, - lastdata => $row->{dtmf}, + #lastdata => $row->{dtmf}, disposition => $row->{call_data}, cdrbatchnum => $cdrbatchnum,