don't skip taqua acctcode ad-ons, RT#12181
[freeside.git] / FS / FS / cdr / telos_csv.pm
1 package FS::cdr::telos_csv;
2
3 use strict;
4 use vars qw( @ISA %info $tmp_mon $tmp_mday $tmp_year );
5 use Time::Local;
6 use FS::cdr qw(_cdr_min_parser_maker);
7
8 @ISA = qw(FS::cdr);
9
10 %info = (
11   'name'          => 'Telos (CSV)',
12   'weight'        => 535,
13   'header'        => 1,
14   'import_fields' => [
15
16     # Date (MM/DD/YY)
17     sub { my($cdr, $date) = @_;
18           $date =~ /^(\d{1,2})\/(\d{1,2})\/(\d\d(\d\d)?)$/
19             or die "unparsable date: $date";
20           ($tmp_mday, $tmp_mon, $tmp_year) = ( $2, $1-1, $3 );
21         },
22
23     # Time
24     sub { my($cdr, $time) = @_;
25           $time =~ /^(\d{1,2}):(\d{1,2}):(\d{1,2})$/
26             or die "unparsable time: $time";
27           $cdr->enddate(
28             timelocal($3, $2, $1 ,$tmp_mday, $tmp_mon, $tmp_year)
29           );
30         },
31     '', #RAS-Client
32     sub { #Record-Type
33       my($cdr, $rectype, $conf, $param) = @_;
34       $param->{skiprow} = 1 if lc($rectype) ne 'stop';
35     },
36     skip(24), #Full-Name, Auth-Type, User-Name, NAS-IP-Address, NAS-Port,
37               #Service-Type, Framed-Protocol, Framed-IP-Address, 
38               #Framed-IP-Netmask, Framed-Routing, Filter-ID, Framed-MTU,
39               #Framed-Compression, Login-IP-Host, Login-Service, Login-TCP-Port,
40               #Callback-Number, Callback-ID, Framed-Route, Framed-IPX-Network,
41               #Class, Session-Timeout, Idle-Timeout, Termination-Action
42               #I told you it was a RADIUS log
43     'dst', # Called-Station-ID, always 'X' in sample data
44     'src', # Calling-Station-ID
45     skip(8), #NAS-Identifier, Proxy-State, Acct-Status-Type, Acct-Delay-Time,
46              #Acct-Input-Octets, Acct-Output-Octets, Acct-Session-Id, 
47              #Acct-Authentic
48     sub { 
49       my ($cdr, $sec) = @_; 
50       $cdr->duration($sec); 
51       $cdr->billsec($sec);
52       $cdr->startdate($cdr->enddate - $sec);
53     },
54     skip(75), #everything else
55   ],
56 );
57
58 sub skip { map {''} (1..$_[0]) }
59
60 1;