1 package FS::cdr::taqua;
4 use vars qw(@ISA %info $da_rewrite);
5 use FS::cdr qw(_cdr_date_parser_maker);
13 'import_fields' => [ #some of these are kind arbitrary...
16 'cdrtypenum', #RecordType
17 sub { my($cdr, $field) = @_; }, #all10#RecordVersion
18 sub { my($cdr, $field) = @_; }, #OrigShelfNumber
19 sub { my($cdr, $field) = @_; }, #OrigCardNumber
20 sub { my($cdr, $field) = @_; }, #OrigCircuit
21 sub { my($cdr, $field) = @_; }, #OrigCircuitType
22 'uniqueid', #SequenceNumber
23 'accountcode', #SessionNumber
24 'src', #CallingPartyNumber
25 #'dst', #CalledPartyNumber
28 my( $cdr, $field, $conf ) = @_;
29 if ( $cdr->calltypenum == 6 && $cdr->cdrtypenum == 0 ) {
37 _cdr_date_parser_maker('startdate'), #CallArrivalTime
38 _cdr_date_parser_maker('enddate'), #CallCompletionTime
41 #sub { my($cdr, $d ) = @_; $cdr->disposition( $disposition{$d}): },
54 _cdr_date_parser_maker('answerdate'), #DispositionTime
55 sub { my($cdr, $field) = @_; }, #TCAP
56 sub { my($cdr, $field) = @_; }, #OutboundCarrierConnectTime
57 sub { my($cdr, $field) = @_; }, #OutboundCarrierDisconnectTime
60 #it appears channels are actually part of trunk groups, but this data
61 #is interesting and we need a source and destination place to put it
62 'dstchannel', #TermTrunkGroup
65 sub { my($cdr, $field) = @_; }, #TermShelfNumber
66 sub { my($cdr, $field) = @_; }, #TermCardNumber
69 sub { my($cdr, $field) = @_; }, #TermCircuit
70 sub { my($cdr, $field) = @_; }, #TermCircuitType
71 'carrierid', #OutboundCarrierId
76 my( $cdr, $field, $conf ) = @_;
78 #could be more efficient for the no config case, if anyone ever needs that
79 $da_rewrite ||= $conf->config('cdr-taqua-da_rewrite');
81 if ( $da_rewrite && $field =~ /\d/ ) {
82 my $rewrite = $da_rewrite;
84 my @rewrite = split(',', $conf->config('cdr-taqua-da_rewrite') );
85 if ( grep { $field eq $_ } @rewrite ) {
86 $cdr->charged_party( $cdr->src() );
87 $cdr->calltypenum(12);
91 $cdr->charged_party($field);
94 sub { my($cdr, $field) = @_; }, #SubscriberNumber
95 'lastapp', #ServiceName
96 sub { my($cdr, $field) = @_; }, #some weirdness #ChargeTime
97 'lastdata', #ServiceInformation
98 sub { my($cdr, $field) = @_; }, #FacilityInfo
99 sub { my($cdr, $field) = @_; }, #all 1900-01-01 0#CallTraceTime
102 sub { my($cdr, $field) = @_; }, #all-1#UniqueIndicator
103 sub { my($cdr, $field) = @_; }, #all-1#PresentationIndicator
104 sub { my($cdr, $field) = @_; }, #empty#Pin
105 'calltypenum', #CallType
107 #nothing below is used by QIS...
109 sub { my($cdr, $field) = @_; }, #Balt/empty #OrigRateCenter
110 sub { my($cdr, $field) = @_; }, #Balt/empty #TermRateCenter
113 #it appears channels are actually part of trunk groups, but this data
114 #is interesting and we need a source and destination place to put it
115 'channel', #OrigTrunkGroup
117 'userfield', #empty#UserDefined
118 sub { my($cdr, $field) = @_; }, #empty#PseudoDestinationNumber
119 sub { my($cdr, $field) = @_; }, #all-1#PseudoCarrierCode
122 sub { my($cdr, $field) = @_; }, #empty#PseudoANI
123 sub { my($cdr, $field) = @_; }, #all-1#PseudoFacilityInfo
124 sub { my($cdr, $field) = @_; }, #OrigDialedDigits
125 sub { my($cdr, $field) = @_; }, #all-1#OrigOutboundCarrier
126 sub { my($cdr, $field) = @_; }, #IncomingCarrierID
127 'dcontext', #JurisdictionInfo
128 sub { my($cdr, $field) = @_; }, #OrigDestDigits
129 sub { my($cdr, $field) = @_; }, #huh?#InsertTime
130 sub { my($cdr, $field) = @_; }, #key
131 sub { my($cdr, $field) = @_; }, #empty#AMALineNumber
134 sub { my($cdr, $field) = @_; }, #empty#AMAslpID
135 sub { my($cdr, $field) = @_; }, #empty#AMADigitsDialedWC
136 sub { my($cdr, $field) = @_; }, #OpxOffHook
137 sub { my($cdr, $field) = @_; }, #OpxOnHook
139 #acctid - primary key
140 #AUTO #calldate - Call timestamp (SQL timestamp)
141 #clid - Caller*ID with text
142 #XXX src - Caller*ID number / Source number
143 #XXX dst - Destination extension
144 #dcontext - Destination context
145 #channel - Channel used
146 #dstchannel - Destination channel if appropriate
147 #lastapp - Last application if appropriate
148 #lastdata - Last application data
149 #startdate - Start of call (UNIX-style integer timestamp)
150 #answerdate - Answer time of call (UNIX-style integer timestamp)
151 #enddate - End time of call (UNIX-style integer timestamp)
152 #HACK#duration - Total time in system, in seconds
153 #HACK#XXX billsec - Total time call is up, in seconds
154 #disposition - What happened to the call: ANSWERED, NO ANSWER, BUSY
155 #INT amaflags - What flags to use: BILL, IGNORE etc, specified on a per channel basis like accountcode.
156 #accountcode - CDR account number to use: account
158 #uniqueid - Unique channel identifier (Unitel/RSLCOM Event ID)
159 #userfield - CDR user-defined field
161 #X cdrtypenum - CDR type - see FS::cdr_type (Usage = 1, S&E = 7, OC&C = 8)
162 #XXX charged_party - Service number to be billed
163 #upstream_currency - Wholesale currency from upstream
164 #X upstream_price - Wholesale price from upstream
165 #upstream_rateplanid - Upstream rate plan ID
166 #rated_price - Rated (or re-rated) price
167 #distance - km (need units field?)
168 #islocal - Local - 1, Non Local = 0
169 #calltypenum - Type of call - see FS::cdr_calltype
170 #X description - Description (cdr_type 7&8 only) (used for cust_bill_pkg.itemdesc)
171 #quantity - Number of items (cdr_type 7&8 only)
172 #carrierid - Upstream Carrier ID (see FS::cdr_carrier)
173 #upstream_rateid - Upstream Rate ID
175 #svcnum - Link to customer service (see FS::cust_svc)
176 #freesidestatus - NULL, done (or something)