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 );
15 'disposition', #Status
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
22 'dcontext', #Called type
24 skip(26), #Destination customer, Destination type
26 #Destination group ID, Destination group name,
27 #Inbound calling type,
28 #Inbound calling number,
30 #Inbound called number,
31 #Inbound destination type, Inbound destination number,
32 #Outbound calling type, Outbound calling number,
33 #Outbound called type, Outbound called number,
34 #Outbound destination type, Outbound destination number,
35 #Internal calling type, Internal calling number,
36 #Internal called type, Internal called number,
37 #Internal destination type, Internal destination number
38 'duration', #Total seconds
39 skip(1), #Ring seconds
40 'billsec', #Billable seconds
43 'accountcode', #Billing customer
44 skip(3), #Billing customer name, Billing type, Billing reference
48 sub skip { map {''} (1..$_[0]) }
50 #create CDR types with names matching in_calling_type valuesj - 'none'
51 # (without the quotes) for blank
54 my ($record, $data) = @_;
58 my $cdr_type = exists($cdr_type{$data})
60 : qsearchs('cdr_type', { 'cdrtypename' => $data } );
62 $cdr_type{$data} = $cdr_type;
64 $record->set('in_calling_type', $data); #for below
65 $record->set('cdrtypenum', $cdr_type->cdrtypenum) if $cdr_type;