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 _cdr_date_parser_maker('startdate'), #CallArrivalTime
29 _cdr_date_parser_maker('enddate'), #CallCompletionTime
32 #sub { my($cdr, $d ) = @_; $cdr->disposition( $disposition{$d}): },
45 _cdr_date_parser_maker('answerdate'), #DispositionTime
46 sub { my($cdr, $field) = @_; }, #TCAP
47 sub { my($cdr, $field) = @_; }, #OutboundCarrierConnectTime
48 sub { my($cdr, $field) = @_; }, #OutboundCarrierDisconnectTime
51 #it appears channels are actually part of trunk groups, but this data
52 #is interesting and we need a source and destination place to put it
53 'dstchannel', #TermTrunkGroup
56 sub { my($cdr, $field) = @_; }, #TermShelfNumber
57 sub { my($cdr, $field) = @_; }, #TermCardNumber
60 sub { my($cdr, $field) = @_; }, #TermCircuit
61 sub { my($cdr, $field) = @_; }, #TermCircuitType
62 'carrierid', #OutboundCarrierId
67 my( $cdr, $field, $conf ) = @_;
69 #could be more efficient for the no config case, if anyone ever needs that
70 $da_rewrite ||= $conf->config('cdr-taqua-da_rewrite');
72 if ( $da_rewrite && $field =~ /\d/ ) {
73 my $rewrite = $da_rewrite;
75 my @rewrite = split(',', $conf->config('cdr-taqua-da_rewrite') );
76 if ( grep { $field eq $_ } @rewrite ) {
77 $cdr->charged_party( $cdr->src() );
78 $cdr->calltypenum(12);
82 $cdr->charged_party($field);
85 sub { my($cdr, $field) = @_; }, #SubscriberNumber
86 'lastapp', #ServiceName
87 sub { my($cdr, $field) = @_; }, #some weirdness #ChargeTime
88 'lastdata', #ServiceInformation
89 sub { my($cdr, $field) = @_; }, #FacilityInfo
90 sub { my($cdr, $field) = @_; }, #all 1900-01-01 0#CallTraceTime
93 sub { my($cdr, $field) = @_; }, #all-1#UniqueIndicator
94 sub { my($cdr, $field) = @_; }, #all-1#PresentationIndicator
95 sub { my($cdr, $field) = @_; }, #empty#Pin
96 'calltypenum', #CallType
98 #nothing below is used by QIS...
100 sub { my($cdr, $field) = @_; }, #Balt/empty #OrigRateCenter
101 sub { my($cdr, $field) = @_; }, #Balt/empty #TermRateCenter
104 #it appears channels are actually part of trunk groups, but this data
105 #is interesting and we need a source and destination place to put it
106 'channel', #OrigTrunkGroup
108 'userfield', #empty#UserDefined
109 sub { my($cdr, $field) = @_; }, #empty#PseudoDestinationNumber
110 sub { my($cdr, $field) = @_; }, #all-1#PseudoCarrierCode
113 sub { my($cdr, $field) = @_; }, #empty#PseudoANI
114 sub { my($cdr, $field) = @_; }, #all-1#PseudoFacilityInfo
115 sub { my($cdr, $field) = @_; }, #OrigDialedDigits
116 sub { my($cdr, $field) = @_; }, #all-1#OrigOutboundCarrier
117 sub { my($cdr, $field) = @_; }, #IncomingCarrierID
118 'dcontext', #JurisdictionInfo
119 sub { my($cdr, $field) = @_; }, #OrigDestDigits
120 sub { my($cdr, $field) = @_; }, #huh?#InsertTime
121 sub { my($cdr, $field) = @_; }, #key
122 sub { my($cdr, $field) = @_; }, #empty#AMALineNumber
125 sub { my($cdr, $field) = @_; }, #empty#AMAslpID
126 sub { my($cdr, $field) = @_; }, #empty#AMADigitsDialedWC
127 sub { my($cdr, $field) = @_; }, #OpxOffHook
128 sub { my($cdr, $field) = @_; }, #OpxOnHook
130 #acctid - primary key
131 #AUTO #calldate - Call timestamp (SQL timestamp)
132 #clid - Caller*ID with text
133 #XXX src - Caller*ID number / Source number
134 #XXX dst - Destination extension
135 #dcontext - Destination context
136 #channel - Channel used
137 #dstchannel - Destination channel if appropriate
138 #lastapp - Last application if appropriate
139 #lastdata - Last application data
140 #startdate - Start of call (UNIX-style integer timestamp)
141 #answerdate - Answer time of call (UNIX-style integer timestamp)
142 #enddate - End time of call (UNIX-style integer timestamp)
143 #HACK#duration - Total time in system, in seconds
144 #HACK#XXX billsec - Total time call is up, in seconds
145 #disposition - What happened to the call: ANSWERED, NO ANSWER, BUSY
146 #INT amaflags - What flags to use: BILL, IGNORE etc, specified on a per channel basis like accountcode.
147 #accountcode - CDR account number to use: account
149 #uniqueid - Unique channel identifier (Unitel/RSLCOM Event ID)
150 #userfield - CDR user-defined field
152 #X cdrtypenum - CDR type - see FS::cdr_type (Usage = 1, S&E = 7, OC&C = 8)
153 #XXX charged_party - Service number to be billed
154 #upstream_currency - Wholesale currency from upstream
155 #X upstream_price - Wholesale price from upstream
156 #upstream_rateplanid - Upstream rate plan ID
157 #rated_price - Rated (or re-rated) price
158 #distance - km (need units field?)
159 #islocal - Local - 1, Non Local = 0
160 #calltypenum - Type of call - see FS::cdr_calltype
161 #X description - Description (cdr_type 7&8 only) (used for cust_bill_pkg.itemdesc)
162 #quantity - Number of items (cdr_type 7&8 only)
163 #carrierid - Upstream Carrier ID (see FS::cdr_carrier)
164 #upstream_rateid - Upstream Rate ID
166 #svcnum - Link to customer service (see FS::cust_svc)
167 #freesidestatus - NULL, done (or something)