1 package FS::cdr::enswitch;
2 use base qw( FS::cdr );
5 use vars qw( %info $tmp_mon $tmp_mday $tmp_year );
6 use FS::Record qw( qsearchs );
16 'startdate', #Start, already a unix timestamp
17 skip(2), #Start date, Start time
19 skip(4), #End date, End time
20 #Calling customer, Calling type
21 'src', #Calling number
24 sub { my ($cdr, $dst) = @_;
26 $cdr->set('dst', $dst);
29 skip(14), #Destination customer, Destination type
31 #Destination group ID, Destination group name,
32 #Inbound calling type,
33 #Inbound calling number,
35 #Inbound called number,
36 #Inbound destination type, Inbound destination number,
37 'disposition', #Outbound calling type,
38 skip(11), #Outbound calling number,
39 #Outbound called type, Outbound called number,
40 #Outbound destination type, Outbound destination number,
41 #Internal calling type, Internal calling number,
42 #Internal called type, Internal called number,
43 #Internal destination type, Internal destination number
44 'duration', #Total seconds
45 skip(1), #Ring seconds
46 'billsec', #Billable seconds
49 'accountcode', #Billing customer
50 skip(3), #Billing customer name, Billing type, Billing reference
54 sub skip { map {''} (1..$_[0]) }
56 #create CDR types with names matching in_calling_type valuesj - 'none'
57 # (without the quotes) for blank
60 my ($record, $data) = @_;
64 my $cdr_type = exists($cdr_type{$data})
66 : qsearchs('cdr_type', { 'cdrtypename' => $data } );
68 $cdr_type{$data} = $cdr_type;
70 $record->set('in_calling_type', $data); #for below
71 $record->set('cdrtypenum', $cdr_type->cdrtypenum) if $cdr_type;