1b7a660e71d3b595f7beae85cdf9df6216e5247d
[freeside.git] / FS / FS / cdr / u4.pm
1 package FS::cdr::u4;
2
3 use strict;
4 use vars qw(@ISA %info);
5 use FS::cdr qw(_cdr_date_parser_maker);
6
7 @ISA = qw(FS::cdr);
8
9 %info = (
10   'name'          => 'U4',
11   'weight'        => 490,
12   'type'          => 'fixedlength',
13   'fixedlength_format' => [qw(
14     CDRType:3:1:3
15     MasterAccountID:12:4:15
16     SubAccountID:12:16:27
17     BillToNumber:18:28:45
18     AccountCode:12:46:57
19     CallDateStartTime:14:58:71
20     TimeOfDay:1:72:72
21     CalculatedSeconds:12:73:84
22     City:30:85:114
23     State:2:115:116
24     Country:40:117:156
25     Charges:21:157:177
26     CallDirection:1:178:178
27     CallIndicator:1:179:179
28     ReportIndicator:1:180:180
29     ANI:10:181:190
30     DNIS:10:191:200
31     PIN:16:201:216
32     OrigNumber:10:217:226
33     TermNumber:10:227:236
34     DialedNumber:18:237:254
35     DisplayNumber:18:255:272
36     RecordSource:1:273:273
37     LECInfoDigits:2:274:275
38     OrigNPA:4:276:279
39     OrigNXX:5:280:284
40     OrigLATA:3:285:287
41     OrigZone:1:288:288
42     OrigCircuit:12:289:300
43     OrigTrunkGroupCLLI:12:301:312
44     TermNPA:4:313:316
45     TermNXX:5:317:321
46     TermLATA:3:322:324
47     TermZone:1:325:325
48     TermCircuit:12:326:337
49     TermTrunkGroupCLLI:12:338:349
50     TermOCN:5:350:354
51   )],
52   # at least that's how they're defined in the spec we have.
53   # the real CDRs have several differences.
54   'import_fields' => [
55     '',               #CDRType (for now always 'V')
56     '',               #MasterAccountID
57     '',               #SubAccountID
58     'charged_party',  #BillToNumber
59     'accountcode',    #AccountCode
60     _cdr_date_parser_maker('startdate'),
61                       #CallDateTime
62     '',               #TimeOfDay (always 'S')
63     sub {             #CalculatedSeconds
64       my($cdr, $sec) = @_;
65       $cdr->duration($sec);
66       $cdr->billsec($sec);
67     },
68     '',               #City
69     '',               #State
70     '',               #Country
71     'upstream_price', #Charges
72     sub {             #CallDirection
73       my ($cdr, $dir) = @_;
74       $cdr->set('direction', $dir);
75       if ( $dir eq 'O' ) {
76         $cdr->set('src', $cdr->charged_party);
77       } elsif ( $dir eq 'I' ) {
78         $cdr->set('dst', $cdr->charged_party);
79       }
80     },
81     '',               #CallIndicator  #calltype?
82     '',               #ReportIndicator
83     sub {             #ANI
84       # it appears that it's the "other" number, not necessarily ANI.
85       my ($cdr, $number) = @_;
86       if ( $cdr->direction eq 'O' ) {
87         $cdr->set('dst', $number);
88       } elsif ( $cdr->direction eq 'I' ) {
89         $cdr->set('src', $number);
90       }
91     },
92     '',               #DNIS
93     '',               #PIN
94     '',               #OrigNumber
95     '',               #TermNumber
96     '',               #DialedNumber
97     '',               #DisplayNumber
98     '',               #RecordSource
99     '',               #LECInfoDigits
100     ('') x 13,
101   ],
102 );
103
104 1;