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
25 skip(5), #Destination customer, Destination type
27 #Destination group ID, Destination group name,
28 \&in_calling_type, #Inbound calling type,
29 \&in_calling_num, #Inbound calling number,
30 '', #Inbound called type,
31 \&in_called_num, #Inbound called number,
33 #Inbound destination type, Inbound destination number,
34 #Outbound calling type, Outbound calling number,
35 #Outbound called type, Outbound called number,
36 #Outbound destination type, Outbound destination number,
37 #Internal calling type, Internal calling number,
38 #Internal called type, Internal called number,
39 #Internal destination type, Internal destination number
40 'duration', #Total seconds
41 skip(1), #Ring seconds
42 'billsec', #Billable seconds
43 'upstream_price', #Cost
44 'accountcode', #Billing customer
45 skip(3), #Billing customer name, Billing type, Billing reference
49 sub skip { map {''} (1..$_[0]) }
51 #create CDR types with names matching in_calling_type valuesj - 'none'
52 # (without the quotes) for blank
55 my ($record, $data) = @_;
59 my $cdr_type = exists($cdr_type{$data})
61 : qsearchs('cdr_type', { 'cdrtypename' => $data } );
63 $cdr_type{$data} = $cdr_type;
65 $record->set('in_calling_type', $data); #for below
66 $record->set('cdrtypenum', $cdr_type->cdrtypenum) if $cdr_type;
71 my ($record, $data) = @_;
72 $record->src($data) if ( ($record->in_calling_type || '') eq 'external' );
76 my ($record, $data) = @_;
77 $record->dst($data) if ( ($record->in_calling_type || '') eq 'external' );