1 package FS::cdr::bell_west;
4 use base qw( FS::cdr );
5 use vars qw( %info $tmp_mon $tmp_mday $tmp_year );
7 use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
10 'name' => 'Bell West',
12 'header' => 1, #0 default, set to 1 to ignore the first line
13 'type' => 'xls', #csv (default), fixedlength or xls
17 # CDR FIELD / REQUIRED / Notes
19 # CHG TYPE / No / Internal Code only (no need to import)
22 # ACCOUNT # / No / Internal Number only (no need to import)
25 # DATE / Yes / "DATE" Excel date format MM/DD/YYYY
26 sub { my($cdr, $date) = @_;
27 $date =~ /^(\d{1,2})\/(\d{1,2})\/(\d\d(\d\d)?)$/
28 or die "unparsable date: $date"; #maybe we shouldn't die...
29 #$cdr->startdate( timelocal(0, 0, 0 ,$2, $1-1, $3) );
30 ($tmp_mday, $tmp_mon, $tmp_year) = ( $2, $1-1, $3 );
33 # CUST NO / Yes / "TIME" "075959" Text based time
34 # Note: This is really the start time but Bell header says "Cust No" which
36 sub { my($cdr, $time) = @_;
37 #my($sec, $min, $hour, $mday, $mon, $year)= localtime($cdr->startdate);
38 $time =~ /^(\d{1,2}):(\d{1,2}):(\d{1,2})$/
39 or die "unparsable time: $time"; #maybe we shouldn't die...
40 #$cdr->startdate( timelocal($3, $2, $1 ,$mday, $mon, $year) );
42 timelocal($3, $2, $1 ,$tmp_mday, $tmp_mon, $tmp_year)
46 # BTN / Yes / Main billing number but not DID or real number (I guess put in SRC field)
49 # ORIG CITY / No / We will use your Freeside rating and description name
52 # TERM / YES / All calls should be billed, however all calls are missing "1+" and "011+" & DIR ASST = "411"
55 # TERM CITY / No / We will use your Freeside rating and description name
58 # WTN / Yes / Bill to number (I guess put in "charged_party")
61 # CODE / Yes / Account Code (security) and we need on invoice (suggestions ?)
64 # PROV/COUNTRY / No / We will use your Freeside rating and description name
65 # (but use this to add "011" for "International" calls)
66 sub { my( $cdr, $prov ) = @_;
67 my $pre = ( $prov =~ /^\s*International\s*/i ) ? '011' : '1';
68 $cdr->dst( $pre. $cdr->dst ) unless $cdr->dst =~ /^$pre/;
71 # CALL TYPE / Possibly / Not sure if you need this to determine correct billing method ?
72 # DDD normal call (Direct Dial Dsomething? ="LD"?)
74 # (toll free dst# should be sufficient to rate)
75 # DAT Directory AssisTance
76 # (dst# 411 "area code" should be sufficient to rate)
77 # DNS (Another sort of directory assistance?... only one record with
78 # "8195551212" in the dst#)
79 'dcontext', #probably don't need... map to cdr_type? calltypenum?
81 # DURATION Yes Units = seconds
82 'billsec', #need to trim .00 ?
84 # AMOUNT CHARGED No Will use Freeside rating and description name
85 sub { my( $cdr, $amount) = @_;
87 $cdr->upstream_price( $amount );
101 DATE startdate (+ CUST NO)
102 CUST NO (startdate time)
103 - Start of call (UNIX-style integer timestamp)
105 BTN *src - Caller*ID number / Source number
106 ORIG CITY channel - Channel used
107 TERM # *dst - Destination extension
108 TERM CITY dstchannel - Destination channel if appropriate
109 WTN *charged_party - Service number to be billed
110 CODE *accountcode - CDR account number to use: account
112 PROV/COUNTRY (used to prefix TERM # w/ 1 or 011)
114 CALL TYPE dcontext - Destination context
115 DURATION *billsec - Total time call is up, in seconds
116 AMOUNT CHARGED *upstream_price - Wholesale price from upstream