1 package FS::cdr::taqua;
4 use vars qw(@ISA %info $da_rewrite);
5 use FS::cdr qw(_cdr_date_parser_maker);
10 'name' => 'Taqua v6.0',
13 'import_fields' => [ #some of these are kind arbitrary...
18 my($cdr, $field, $conf, $hashref) = @_;
19 $hashref->{skiprow} = 1
20 unless ($field == 0 && $cdr->disposition == 100 ) #regular CDR
21 || ($field == 1 && $cdr->lastapp eq 'acctcode'); #accountcode
22 $cdr->cdrtypenum($field);
25 sub { my($cdr, $field) = @_; }, #all10#RecordVersion
26 sub { my($cdr, $field) = @_; }, #OrigShelfNumber
27 sub { my($cdr, $field) = @_; }, #OrigCardNumber
28 sub { my($cdr, $field) = @_; }, #OrigCircuit
29 sub { my($cdr, $field) = @_; }, #OrigCircuitType
30 'uniqueid', #SequenceNumber
31 'sessionnum', #SessionNumber
32 'src', #CallingPartyNumber
33 #'dst', #CalledPartyNumber
36 my( $cdr, $field, $conf ) = @_;
37 if ( $cdr->calltypenum == 6 && $cdr->cdrtypenum == 0 ) {
45 _cdr_date_parser_maker('startdate', 'gmt' => 1), #CallArrivalTime
46 _cdr_date_parser_maker('enddate', 'gmt' => 1), #CallCompletionTime
49 #sub { my($cdr, $d ) = @_; $cdr->disposition( $disposition{$d}): },
53 # 100 => '', #regular cdr
62 _cdr_date_parser_maker('answerdate', 'gmt' => 1), #DispositionTime
63 sub { my($cdr, $field) = @_; }, #TCAP
64 sub { my($cdr, $field) = @_; }, #OutboundCarrierConnectTime
65 sub { my($cdr, $field) = @_; }, #OutboundCarrierDisconnectTime
68 #it appears channels are actually part of trunk groups, but this data
69 #is interesting and we need a source and destination place to put it
70 'dstchannel', #TermTrunkGroup
73 sub { my($cdr, $field) = @_; }, #TermShelfNumber
74 sub { my($cdr, $field) = @_; }, #TermCardNumber
77 sub { my($cdr, $field) = @_; }, #TermCircuit
78 sub { my($cdr, $field) = @_; }, #TermCircuitType
79 'carrierid', #OutboundCarrierId
84 my( $cdr, $field, $conf ) = @_;
86 #could be more efficient for the no config case, if anyone ever needs that
87 $da_rewrite ||= $conf->config('cdr-taqua-da_rewrite');
89 if ( $da_rewrite && $field =~ /\d/ ) {
90 my $rewrite = $da_rewrite;
92 my @rewrite = split(',', $conf->config('cdr-taqua-da_rewrite') );
93 if ( grep { $field eq $_ } @rewrite ) {
94 $cdr->charged_party( $cdr->src() );
95 $cdr->calltypenum(12);
99 if ( $cdr->is_tollfree ) { # thankfully this is already available
100 $cdr->charged_party($cdr->dst); # and this
102 $cdr->charged_party($field);
106 'subscriber', #SubscriberNumber
107 'lastapp', #ServiceName
108 sub { my($cdr, $field) = @_; }, #some weirdness #ChargeTime
109 'lastdata', #ServiceInformation
110 sub { my($cdr, $field) = @_; }, #FacilityInfo
111 sub { my($cdr, $field) = @_; }, #all 1900-01-01 0#CallTraceTime
114 sub { my($cdr, $field) = @_; }, #all-1#UniqueIndicator
115 sub { my($cdr, $field) = @_; }, #all-1#PresentationIndicator
116 sub { my($cdr, $field) = @_; }, #empty#Pin
117 'calltypenum', #CallType
119 #nothing below is used by QIS...
121 sub { my($cdr, $field) = @_; }, #Balt/empty #OrigRateCenter
122 sub { my($cdr, $field) = @_; }, #Balt/empty #TermRateCenter
125 #it appears channels are actually part of trunk groups, but this data
126 #is interesting and we need a source and destination place to put it
127 'channel', #OrigTrunkGroup
129 'userfield', #empty#UserDefined
130 sub { my($cdr, $field) = @_; }, #empty#PseudoDestinationNumber
131 sub { my($cdr, $field) = @_; }, #all-1#PseudoCarrierCode
134 sub { my($cdr, $field) = @_; }, #empty#PseudoANI
135 sub { my($cdr, $field) = @_; }, #all-1#PseudoFacilityInfo
136 sub { my($cdr, $field) = @_; }, #OrigDialedDigits
137 sub { my($cdr, $field) = @_; }, #all-1#OrigOutboundCarrier
138 sub { my($cdr, $field) = @_; }, #IncomingCarrierID
139 'dcontext', #JurisdictionInfo
140 sub { my($cdr, $field) = @_; }, #OrigDestDigits
141 sub { my($cdr, $field) = @_; }, #huh?#InsertTime
142 sub { my($cdr, $field) = @_; }, #key
143 sub { my($cdr, $field) = @_; }, #empty#AMALineNumber
146 sub { my($cdr, $field) = @_; }, #empty#AMAslpID
147 sub { my($cdr, $field) = @_; }, #empty#AMADigitsDialedWC
148 sub { my($cdr, $field) = @_; }, #OpxOffHook
149 sub { my($cdr, $field) = @_; }, #OpxOnHook
151 #acctid - primary key
152 #AUTO #calldate - Call timestamp (SQL timestamp)
153 #clid - Caller*ID with text
154 #XXX src - Caller*ID number / Source number
155 #XXX dst - Destination extension
156 #dcontext - Destination context
157 #channel - Channel used
158 #dstchannel - Destination channel if appropriate
159 #lastapp - Last application if appropriate
160 #lastdata - Last application data
161 #startdate - Start of call (UNIX-style integer timestamp)
162 #answerdate - Answer time of call (UNIX-style integer timestamp)
163 #enddate - End time of call (UNIX-style integer timestamp)
164 #HACK#duration - Total time in system, in seconds
165 #HACK#XXX billsec - Total time call is up, in seconds
166 #disposition - What happened to the call: ANSWERED, NO ANSWER, BUSY
167 #INT amaflags - What flags to use: BILL, IGNORE etc, specified on a per channel basis like accountcode.
168 #accountcode - CDR account number to use: account
170 #uniqueid - Unique channel identifier (Unitel/RSLCOM Event ID)
171 #userfield - CDR user-defined field
173 #X cdrtypenum - CDR type - see FS::cdr_type (Usage = 1, S&E = 7, OC&C = 8)
174 #XXX charged_party - Service number to be billed
175 #upstream_currency - Wholesale currency from upstream
176 #X upstream_price - Wholesale price from upstream
177 #upstream_rateplanid - Upstream rate plan ID
178 #rated_price - Rated (or re-rated) price
179 #distance - km (need units field?)
180 #islocal - Local - 1, Non Local = 0
181 #calltypenum - Type of call - see FS::cdr_calltype
182 #X description - Description (cdr_type 7&8 only) (used for cust_bill_pkg.itemdesc)
183 #quantity - Number of items (cdr_type 7&8 only)
184 #carrierid - Upstream Carrier ID (see FS::cdr_carrier)
185 #upstream_rateid - Upstream Rate ID
187 #svcnum - Link to customer service (see FS::cust_svc)
188 #freesidestatus - NULL, done (or something)