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) = @_;
28 #$date =~ /^(\d{1,2})\/(\d{1,2})\/(\d\d(\d\d)?)$/
29 # or die "unparsable date: $date"; #maybe we shouldn't die...
30 ##$cdr->startdate( timelocal(0, 0, 0 ,$2, $1-1, $3) );
31 #($tmp_mday, $tmp_mon, $tmp_year) = ( $2, $1-1, $3 );
33 my $datetime = DateTime::Format::Excel->parse_datetime( $date );
34 $tmp_mon = $datetime->mon_0;
35 $tmp_mday = $datetime->mday;
36 $tmp_year = $datetime->year;
39 # CUST NO / Yes / "TIME" "075959" Text based time
40 # Note: This is really the start time but Bell header says "Cust No" which
42 sub { my($cdr, $time) = @_;
43 #my($sec, $min, $hour, $mday, $mon, $year)= localtime($cdr->startdate);
44 $time =~ /^(\d{2})(\d{2})(\d{2})$/
45 or die "unparsable time: $time"; #maybe we shouldn't die...
46 #$cdr->startdate( timelocal($3, $2, $1 ,$mday, $mon, $year) );
48 timelocal($3, $2, $1 ,$tmp_mday, $tmp_mon, $tmp_year)
52 # BTN / Yes / Main billing number but not DID or real number (I guess put in SRC field)
55 # ORIG CITY / No / We will use your Freeside rating and description name
58 # TERM / YES / All calls should be billed, however all calls are missing "1+" and "011+" & DIR ASST = "411"
61 # TERM CITY / No / We will use your Freeside rating and description name
64 # WTN / Yes / Bill to number (I guess put in "charged_party")
67 # CODE / Yes / Account Code (security) and we need on invoice (suggestions ?)
70 # PROV/COUNTRY / No / We will use your Freeside rating and description name
71 # (but use this to add "011" for "International" calls)
72 sub { my( $cdr, $prov ) = @_;
73 my $pre = ( $prov =~ /^\s*International\s*/i ) ? '011' : '1';
74 $cdr->dst( $pre. $cdr->dst ) unless $cdr->dst =~ /^$pre/;
77 # CALL TYPE / Possibly / Not sure if you need this to determine correct billing method ?
78 # DDD normal call (Direct Dial Dsomething? ="LD"?)
80 # (toll free dst# should be sufficient to rate)
81 # DAT Directory AssisTance
82 # (dst# 411 "area code" should be sufficient to rate)
83 # DNS (Another sort of directory assistance?... only one record with
84 # "8195551212" in the dst#)
85 'dcontext', #probably don't need... map to cdr_type? calltypenum?
87 # DURATION Yes Units = seconds
88 'billsec', #need to trim .00 ?
90 # AMOUNT CHARGED No Will use Freeside rating and description name
91 sub { my( $cdr, $amount) = @_;
93 $cdr->upstream_price( $amount );
107 DATE startdate (+ CUST NO)
108 CUST NO (startdate time)
109 - Start of call (UNIX-style integer timestamp)
111 BTN *src - Caller*ID number / Source number
112 ORIG CITY channel - Channel used
113 TERM # *dst - Destination extension
114 TERM CITY dstchannel - Destination channel if appropriate
115 WTN *charged_party - Service number to be billed
116 CODE *accountcode - CDR account number to use: account
118 PROV/COUNTRY (used to prefix TERM # w/ 1 or 011)
120 CALL TYPE dcontext - Destination context
121 DURATION *billsec - Total time call is up, in seconds
122 AMOUNT CHARGED *upstream_price - Wholesale price from upstream