backup the schema for tables we don't need the data from. RT#85959
[freeside.git] / FS / FS / cdr / qwest.pm
1 package FS::cdr::qwest;
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 my %disposition = (
10   0 => 'ANSWERED',  #normal completed call
11   1 => 'ANSWERED',  #"treated call"
12   2 => 'NO ANSWER', #abandoned call
13   3 => 'ERROR',     #abnormal call
14   4 => 'ERROR',     #signaling system error
15   5 => 'ANSWERED',  #forced disconnect
16   6 => 'ANSWERED',  #off-net route advance
17   7 => 'NO ANSWER', #test call
18   8 => 'NO ANSWER', #recorded promotion
19   9 => 'ERROR',     #TCAP DCP response time-out
20   12=> 'ANSWERED',  #abnormal release
21   13=> 'ERROR',     #"completed answer CDR"(?)
22   15=> 'ERROR',     #"COS failure"(?)
23 );
24
25 my $startdate = _cdr_date_parser_maker('startdate');
26 my $enddate = _cdr_date_parser_maker('enddate');
27
28 %info = (
29   'name'          => 'Qwest (Standard Daily)',
30   'weight'        => 400,
31   'type'          => 'fixedlength',
32   'fixedlength_format' => [qw(
33     billing_cycle_id:6:1:6
34     discn_dt:8:7:14
35     anstype:6:15:20
36     pindigs:4:21:24
37     origtime:6:25:30
38     discn_time:6:31:36
39     time_chng:1:37:37
40     ani:15:38:52
41     infodig:2:53:54
42     calldur:11:55:65
43     univacc:10:66:75
44     compcode:6:76:81
45     dialedno:15:82:96
46     calledno:15:97:111
47     predig:1:112:112
48     seqnum:11:113:123
49     orig_dt:8:124:131
50     finsid:6:132:137
51     trtmtcd:6:138:143
52     anisuff:6:144:149
53     origgrp:6:150:155
54     origmem:6:156:161
55     termgrp:6:162:167
56     termmem:6:168:173
57     fintkgrp:6:174:179
58     billnum:24:180:203
59     acctcd:12:204:215
60     swid:6:216:221
61     orig_bill_file_id:11:222:232
62     orig_trunk_group_name:12:233:244
63     orig_trunk_time_bias_ind:6:245:250
64     term_trunk_group_name:12:251:262
65     final_trunk_group_name:12:263:274
66     orig_trunk_usage_ind:6:275:280
67     orig_pricing_npa:3:281:283
68     orig_pricing_nxx:3:284:286
69     term_pricing_npa:3:287:289
70     term_pricing_nxx:3:290:292
71     prcmp_id:6:293:298
72     component_group_cd:2:299:300
73     component_group_val:24:301:324
74     intra_lata_ind:1:325:325
75     carrsel:1:326:326
76     cic:6:327:332
77     origlrn:10:333:342
78     portedno:10:343:352
79     lnpcheck:1:353:353
80   )],
81   'import_fields' => [
82     '',                 # billing_cycle_id
83     sub {               # discn_dt
84       # hold onto this, combine it with discn_time later
85       # YYYYMMDD
86       my ($cdr, $data, $conf, $param) = @_;
87       $param->{'discn_dt'} = $data;
88       '';
89     },
90     '',                 # anstype
91     '',                 # pindigs
92     sub {               # orig_time
93       # and this
94       # hhmmss
95       my ($cdr, $data, $conf, $param) = @_;
96       $param->{'orig_time'} = $data;
97       '';
98     },
99     sub {               # discn_time
100       my ($cdr, $data, $conf, $param) = @_;
101       $data = $param->{'discn_dt'} . $data; #YYYYMMDDhhmmss
102       $enddate->($cdr, $data);
103     },
104     '',                 # time_chng
105     'src',              # ani (originating number)
106     '',                 # infodig
107     'billsec',          # calldur
108     '',                 # univacc
109     sub {               # compcode
110       my ($cdr, $data) = @_;
111       my $compcode = sprintf('%d', $data);
112       $cdr->disposition($disposition{$compcode});
113       # only those that map to ANSWERED are billable, but that should be 
114       # set in rating options, not enforced here
115       '';
116     },
117     'dst',              # dialedno
118     '',                 # calledno (physical terminating number)
119     '',                 # predig (0/1/011 prefix)
120     '',                 # seqnum
121     sub {               # orig_dt
122       # backward from the discn_ fields
123       my ($cdr, $data, $conf, $param) = @_;
124       $data .= $param->{'orig_time'};
125       $startdate->($cdr, $data);
126     },
127     '',                 # finsid
128     '',                 # trtmtcd
129     '',                 # anisuff
130     'channel',          # origgrp (orig. trunk group)
131     '',                 # origmem (belongs in channel?)
132     'dstchannel',       # termgrp (term. trunk group)
133     '',                 # termmem (same?)
134     '',                 # fintkgrp
135     'charged_party',    # billnum (empty for "normal" calls)
136     'accountcode',      # acctcd
137     '',                 # swid
138     '',                 # orig_bill_file_id
139     '',                 # orig_trunk_group_name
140     '',                 # orig_trunk_time_bias_ind
141     '',                 # term_trunk_group_name
142     '',                 # final_trunk_group_name
143     '',                 # orig_trunk_usage_ind
144     '',                 # orig_pricing_npa
145     '',                 # orig_pricing_nxx
146     '',                 # term_pricing_npa
147     '',                 # term_pricing_nxx
148     '',                 # prcmp_id
149     '',                 # component_group_cd
150     '',                 # component_group_val
151     '',                 # intra_lata_ind (or should we use this?)
152     '',                 # carrsel
153     '',                 # cic
154     '',                 # origlrn
155     '',                 # portedno
156     '',                 # lnpcheck
157   ],
158
159 );
160
161 1;