1 package FS::cdr::broadsoft;
5 FS::cdr::broadsoft - CDR parse module for Broadsoft
9 Ref: BW-AccountingCDRInterfaceSpec-R22.pdf
14 use base qw( FS::cdr );
16 use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
28 #try to deal with broadsoft's awful non-standard CSV escaping :/
29 $line =~ s/\\,/ /g; # \, becomes just a space... not entirely accurate,
30 # but better than skewing data into the wrong fields
31 $line =~ s/\\\\/\\/g; # undo double backslashes? none in my test data
43 my ( $cdr, $data, $conf, $param ) = @_;
45 if lc($data) ne 'normal';
59 # 8: callingPresentationINdicator
66 _cdr_date_parser_maker('startdate'),
73 my( $cdr, $data ) = @_;
74 $cdr->disposition( $data =~ /^yes/i ? 'ANSWERED' : 'NO ANSWER');
78 _cdr_date_parser_maker('answerdate'),
81 _cdr_date_parser_maker('enddate'),
83 # 15: terminationCause
85 # 17: carrierIdentificationCode
89 # 21: networkTranslatedNumber
90 # 22: networkTranslatedGroup
99 # 27: accessDeviceAddress
102 # 30: failoverCorrelationId
111 # 35: authorizationCode
112 # 36: originalCalledNumber
113 # 37: originalCalledPresentationIndicator
114 # 38: originalCalledReason
115 # 39: redirectingNumber
116 # 40: redirectingPresentationIndicator
117 # 41: redirectingReason
118 # 42: chargeIndicator
120 # 44: voicePortalCalling.invocationTime
123 # 47: callingPartyCategory
125 # Also... cols 48 - 448 see Broadsoft documentation
126 skip(87), #35-121 inclusive
131 #123: otherPartyNamePresentationIndicator
133 my( $cdr, $data ) = @_;
134 $cdr->clid( $data ) unless $data =~ /^Public$/i;
137 skip(22), #124-145 inclusive
147 my $fieldname = shift;
149 my($cdr, $data) = @_;
151 $cdr->$fieldname($data);
157 map { undef } (1..$_[0]);
164 list of freeside CDR fields, useful ones marked with *
167 *[1] calldate - Call timestamp (SQL timestamp)
168 clid - Caller*ID with text
169 7 * src - Caller*ID number / Source number
170 9 * dst - Destination extension
171 dcontext - Destination context
172 channel - Channel used
173 dstchannel - Destination channel if appropriate
174 lastapp - Last application if appropriate
175 lastdata - Last application data
176 10 * startdate - Start of call (UNIX-style integer timestamp)
177 13 answerdate - Answer time of call (UNIX-style integer timestamp)
178 14 * enddate - End time of call (UNIX-style integer timestamp)
179 * duration - Total time in system, in seconds
180 * billsec - Total time call is up, in seconds
181 12 *[2] disposition - What happened to the call: ANSWERED, NO ANSWER, BUSY
182 amaflags - What flags to use: BILL, IGNORE etc, specified on a per
183 channel basis like accountcode.
184 4 *[3] accountcode - CDR account number to use: account
185 uniqueid - Unique channel identifier
186 userfield - CDR user-defined field
187 cdr_type - CDR type - see FS::cdr_type (Usage = 1, S&E = 7, OC&C = 8)
188 *[4] charged_party - Service number to be billed
189 upstream_currency - Wholesale currency from upstream
190 *[5] upstream_price - Wholesale price from upstream
191 upstream_rateplanid - Upstream rate plan ID
192 rated_price - Rated (or re-rated) price
193 distance - km (need units field?)
194 islocal - Local - 1, Non Local = 0
195 *[6] calltypenum - Type of call - see FS::cdr_calltype
196 description - Description (cdr_type 7&8 only) (used for
197 cust_bill_pkg.itemdesc)
198 quantity - Number of items (cdr_type 7&8 only)
199 carrierid - Upstream Carrier ID (see FS::cdr_carrier)
200 upstream_rateid - Upstream Rate ID
201 svcnum - Link to customer service (see FS::cust_svc)
202 freesidestatus - NULL, done (or something)
204 [1] Auto-populated from startdate if not present
205 [2] Package options available to ignore calls without a specific disposition
206 [3] When using 'cdr-charged_party-accountcode' config
207 [4] Auto-populated from src (normal calls) or dst (toll free calls) if not present
208 [5] When using 'upstream_simple' rating method.
209 [6] Set to usage class classnum when using pre-rated CDRs and usage class-based
210 taxation (local/intrastate/interstate/international)