1 package FS::cdr::broadsoft;
4 use base qw( FS::cdr );
6 use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
11 'header' => 1, #0 default, set to 1 to ignore the first line, or
12 # to higher numbers to ignore that number of lines
13 'type' => 'csv', #csv (default), fixedlength or xls
14 'sep_char' => ',', #for csv, defaults to ,
15 'disabled' => 0, #0 default, set to 1 to disable
17 #listref of what to do with each field from the CDR, in order
21 sub { my($cdr, $data, $conf, $param) = @_;
22 $param->{skiprow} = 1 if lc($data) ne 'normal';
26 'dcontext', # 6: direction
27 trim('src'), # 7: callingNumber
29 trim('dst'), # 9: calledNumber
31 _cdr_date_parser_maker('startdate'), # 10: startTime
33 sub { my($cdr, $data) = @_;
36 'ANSWERED' : 'NO ANSWER') }, # 12: answerIndicator
37 _cdr_date_parser_maker('answerdate'), # 13: answerTime
38 _cdr_date_parser_maker('enddate'), # 14: releaseTime
40 sub { my($cdr, $accountcode) = @_;
41 if ($cdr->is_tollfree){
42 $cdr->set('accountcode', $cdr->dst);
44 $cdr->set('accountcode', $accountcode);
51 my $fieldname = shift;
55 $cdr->$fieldname($data);
61 map { undef } (1..$_[0]);
68 list of freeside CDR fields, useful ones marked with *
71 *[1] calldate - Call timestamp (SQL timestamp)
72 clid - Caller*ID with text
73 7 * src - Caller*ID number / Source number
74 9 * dst - Destination extension
75 dcontext - Destination context
76 channel - Channel used
77 dstchannel - Destination channel if appropriate
78 lastapp - Last application if appropriate
79 lastdata - Last application data
80 10 * startdate - Start of call (UNIX-style integer timestamp)
81 13 answerdate - Answer time of call (UNIX-style integer timestamp)
82 14 * enddate - End time of call (UNIX-style integer timestamp)
83 * duration - Total time in system, in seconds
84 * billsec - Total time call is up, in seconds
85 12 *[2] disposition - What happened to the call: ANSWERED, NO ANSWER, BUSY
86 amaflags - What flags to use: BILL, IGNORE etc, specified on a per
87 channel basis like accountcode.
88 4 *[3] accountcode - CDR account number to use: account
89 uniqueid - Unique channel identifier
90 userfield - CDR user-defined field
91 cdr_type - CDR type - see FS::cdr_type (Usage = 1, S&E = 7, OC&C = 8)
92 *[4] charged_party - Service number to be billed
93 upstream_currency - Wholesale currency from upstream
94 *[5] upstream_price - Wholesale price from upstream
95 upstream_rateplanid - Upstream rate plan ID
96 rated_price - Rated (or re-rated) price
97 distance - km (need units field?)
98 islocal - Local - 1, Non Local = 0
99 *[6] calltypenum - Type of call - see FS::cdr_calltype
100 description - Description (cdr_type 7&8 only) (used for
101 cust_bill_pkg.itemdesc)
102 quantity - Number of items (cdr_type 7&8 only)
103 carrierid - Upstream Carrier ID (see FS::cdr_carrier)
104 upstream_rateid - Upstream Rate ID
105 svcnum - Link to customer service (see FS::cust_svc)
106 freesidestatus - NULL, done (or something)
108 [1] Auto-populated from startdate if not present
109 [2] Package options available to ignore calls without a specific disposition
110 [3] When using 'cdr-charged_party-accountcode' config
111 [4] Auto-populated from src (normal calls) or dst (toll free calls) if not present
112 [5] When using 'upstream_simple' rating method.
113 [6] Set to usage class classnum when using pre-rated CDRs and usage class-based
114 taxation (local/intrastate/interstate/international)