This commit was generated by cvs2svn to compensate for changes in r11022,
[freeside.git] / FS / FS / cdr / bell_west.pm
1 package FS::cdr::bell_west;
2
3 use strict;
4 use base qw( FS::cdr );
5 use vars qw( %info $tmp_mon $tmp_mday $tmp_year );
6 use Time::Local;
7 #use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
8
9 %info = (
10   'name'          => 'Bell West',
11   'weight'        => 210,
12   'header'        => 1,
13   'type'          => 'xls',
14
15   'import_fields' => [
16
17     # CDR FIELD / REQUIRED / Notes
18
19     # CHG TYPE / No / Internal Code only (no need to import)
20     sub {},
21
22     # ACCOUNT # / No / Internal Number only (no need to import)
23     sub {},
24
25     # DATE / Yes / "DATE"   Excel date format MM/DD/YYYY
26     # XXX false laziness w/troop.pm
27     sub { my($cdr, $date) = @_;
28
29           my $datetime = DateTime::Format::Excel->parse_datetime( $date );
30           $tmp_mon  = $datetime->mon_0;
31           $tmp_mday = $datetime->mday;
32           $tmp_year = $datetime->year;
33         },
34
35     # CUST NO / Yes / "TIME"    "075959" Text based time
36     # Note: This is really the start time but Bell header says "Cust No" which
37     #       is wrong
38     sub { my($cdr, $time) = @_;
39           #my($sec, $min, $hour, $mday, $mon, $year)= localtime($cdr->startdate);
40           $time =~ /^(\d{2})(\d{2})(\d{2})$/
41             or die "unparsable time: $time"; #maybe we shouldn't die...
42           #$cdr->startdate( timelocal($3, $2, $1 ,$mday, $mon, $year) );
43           $cdr->startdate(
44             timelocal($3, $2, $1 ,$tmp_mday, $tmp_mon, $tmp_year)
45           );
46         },
47
48     # BTN / Yes / Main billing number but not DID or real number
49     # (put in SRC field)
50     'src',
51
52     # ORIG CITY / No / We will use your Freeside rating and description name
53     'channel',
54
55     # TERM / YES / All calls should be billed, however all calls are
56     #              missing "1+" and "011+" & DIR ASST = "411"
57     'dst',
58
59     # TERM CITY / No / We will use your Freeside rating and description name
60     'dstchannel',
61
62     # WTN / Yes / Bill to number (put in "charged_party")
63     'charged_party',
64
65     # CODE / Yes / Account Code (security) and we need on invoice
66     'accountcode',
67
68     # PROV/COUNTRY / No / We will use your Freeside rating and description name
69     # (but use this to add "011" for "International" calls)
70     sub { my( $cdr, $prov ) = @_;
71           my $pre = ( $prov =~ /^\s*International\s*/i ) ? '011' : '1';
72           $cdr->dst( $pre. $cdr->dst ) unless $cdr->dst =~ /^$pre/;
73         },
74
75     # CALL TYPE / Possibly / Not sure if you need this to determine correct
76     #                        billing method ?
77     # DDD normal call (Direct Dial Dsomething? ="LD"?)
78     # TF  Toll Free
79     #     (toll free dst# should be sufficient to rate)
80     # DAT Directory AssisTance
81     #     (dst# 411 "area code" should be sufficient to rate)
82     # DNS (Another sort of directory assistance?... only one record with
83     #      "8195551212" in the dst#)
84     'dcontext', #probably don't need... map to cdr_type?  calltypenum?
85
86     # DURATION  Yes     Units = seconds
87     'billsec', #need to trim .00 ?
88
89     # AMOUNT CHARGED    No      Will use Freeside rating and description name
90     sub { my( $cdr, $amount) = @_;
91           $amount =~ s/^\$//;
92           $cdr->upstream_price( $amount );
93         },
94
95   ],
96
97 );
98
99 1;
100
101 __END__
102
103 CHG TYPE        (unused)
104 ACCOUNT #       (unused)
105
106 DATE            startdate (+ CUST NO)
107 CUST NO         (startdate time)
108                 - Start of call (UNIX-style integer timestamp)
109
110 BTN            *src - Caller*ID number / Source number
111 ORIG CITY       channel - Channel used
112 TERM #         *dst - Destination extension
113 TERM CITY       dstchannel - Destination channel if appropriate
114 WTN            *charged_party - Service number to be billed
115 CODE           *accountcode - CDR account number to use: account
116
117 PROV/COUNTRY    (used to prefix TERM # w/ 1 or 011)
118
119 CALL TYPE       dcontext - Destination context
120 DURATION       *billsec - Total time call is up, in seconds
121 AMOUNT CHARGED *upstream_price - Wholesale price from upstream
122