7bdba93a6c817ab1504f213a14bef6d60ee2e1e6
[freeside.git] / FS / FS / cdr / orcon.pm
1 package FS::cdr::orcon;
2
3 use strict;
4 use vars qw( @ISA %info);
5 use FS::cdr;
6
7 @ISA = qw(FS::cdr);
8
9 %info = (
10   'name'          => 'Orcon',
11   'weight'        => 120,
12   'header'        => 1,
13   'import_fields' => [
14
15         skip(2),        #id
16                         #billing period
17         'accountcode',  #account number
18         skip(2),        #username
19                         #service id
20         sub { my ($cdr, $calldate) = @_;
21                 $cdr->set('calldate', $calldate);
22
23                 $calldate =~ /^(\d{4})\/(\d{2})\/(\d{4})\s*(\d{2}):(\d{2}):(\d{2})$/
24                                or die "unparseable date: $calldate";
25                 my $tmp_date = "$2/$1/$3 $4:$5:$6";
26
27                 $tmp_date = str2time($tmp_date);
28                 $cdr->set('startdate', $tmp_date);
29                   },    #date
30         skip(1),        #tariff region
31         'src',          #originating number
32         'dst',          #terminating number
33         'duration',      #duration actual
34         'billsec',      #duration billed
35         skip(1),        #discount
36         'upstream_price',#charge
37
38   ],
39 );
40
41 sub skip { map {''} (1..$_[0]) }
42
43 1;
44