1 package FS::cdr::callplus;
2 use base qw( FS::cdr );
6 use FS::Record qw( qsearchs );
7 use Time::Local 'timelocal';
9 # Date format in the Date/Time col: "13/07/2016 2:40:32 p.m."
10 # d/m/y H:M:S, leading zeroes stripped, 12-hour with "a.m." or "p.m.".
11 # There are also separate d/m/y and 24-hour time columns, but parsing
12 # those separately is hard (DST issues).
21 '', # Billing Group (charged_party?)
22 'src', # Origin Number
23 'dst', # Destination Number
24 '', # Description (seems to be dest caller id?)
30 # this format overlaps one of the existing parser cases, so give it
31 # its own special parser
32 my ($cdr, $value) = @_;
33 $value =~ m[^(\d{1,2})/(\d{1,2})/(\d{4}) (\d{1,2}):(\d{2}):(\d{2}) (a\.m\.|p\.m\.)$]
34 or die "unparseable date: $value";
35 my ($day, $mon, $year, $hour, $min, $sec) = ( $1, $2, $3, $4, $5, $6 );
40 $cdr->set('startdate',
41 timelocal($sec, $min, $hour, $day, $mon-1, $year)
44 sub { # Call Length (seconds)
45 my ($cdr, $value) = @_;
46 $cdr->set('duration', $value);
47 $cdr->set('billsec', $value);
49 sub { # Call Cost (NZD)
50 my ($cdr,$value) = @_;
52 $cdr->upstream_price($value);
54 skip(2), # Smartcode, Smartcode Description
55 sub { # Type. "I" = international, which matters.
56 my ($cdr, $value) = @_;
58 $cdr->set('dst', '+' . $cdr->dst);
59 } # else leave it alone
65 sub skip { map {''} (1..$_[0]) }