fix TeleAPI import (what kind of crack was Christopher smoking that he couldn't fix...
[freeside.git] / FS / FS / cdr / windstream.pm
1 package FS::cdr::windstream;
2
3 use strict;
4 use vars qw( @ISA %info %calltypes );
5 use FS::cdr qw(_cdr_date_parser_maker);
6
7 @ISA = qw(FS::cdr);
8
9 %calltypes = (
10   # numbers are arbitrary
11   'IntraLata Calling' =>                              1 ,
12   'Intrastate Calling' =>                             2  ,
13   'Interstate Calling' =>                             3  ,
14   'International Calling' =>                          4  ,
15   'Intrastate Toll Free' =>                           5  ,
16   'Interstate Toll Free' =>                           6  ,
17   'Toll Free Canada' =>                               7  ,
18   'Toll Free NANP' =>                                 8  ,
19   'IntraLata Directory Assistance' =>                 9  ,
20   'LD Directory Assistance' =>                        10 ,
21   'Message Local Usage' =>                            11 ,
22   'Operator Assistance' =>                            12 ,
23   'Operator Services' =>                              13 ,
24   'O- Assistance (Minus)' =>                          14 ,
25   'O+ Assistance (Plus)' =>                           15 ,
26   'IntraLata Toll 3rd Party' =>                       16 ,
27   'IntraLata Toll Collect' =>                         17 ,
28   'Third Number Billing' =>                           18 ,
29   'Third Number Billing - Assisted' =>                19 ,
30   'Three Way Calling (per use)' =>                    20 ,
31   'Busy Connect (per use)' =>                         21 ,
32   'Busy Line Interrupt (per use)' =>                  22 ,
33   'Busy Line Verification (per use)' =>               23 ,
34   'Call Forwarding Variable per access' =>            24 ,
35   'Call Return (*69 per use)' =>                      25 ,
36   'Call Trace (*per use)' =>                          26 ,
37   'Conference Calling Feature' =>                     27 ,
38   'Directory Assistance Call Completion (per use)' => 28 ,
39 );
40
41 $_ = lc($_) for keys(%calltypes);
42
43 %info = (
44   'name'          => 'Windstream',
45   'weight'        => 520,
46   'header'        => 0,
47   'sep_char'      => "\t",
48   'import_fields' => [
49
50     'accountcode',                        # Account Number
51     'uniqueid',                           # Reference Number
52     '',                                   # Call Type (see Service Type below)
53     _cdr_date_parser_maker('answerdate'), # Answer Date
54     '',                                   # Account Code--unused?
55     '',                                   # CPN_DID
56     'src',                                # From Number
57     'upstream_src_regionname',            # From Location
58     '',                                   # From Country
59     'dst',                                # To Number
60     'upstream_dst_regionname',            # To Location
61     '',                                   # To Country Code
62     '',                                   # Units
63     'upstream_price',                     # Amount
64     sub {                                 # Service Type
65       my ($cdr, $field) = @_;
66       $cdr->calltypenum($calltypes{$field} || '')
67     },
68     '',                                   # Payphone Indicator
69     sub {                                 # TF Service Number
70       # replace the To Number with this, if there is one
71       my ($cdr, $field) = @_;
72       $cdr->dst($field) if ( $field );
73     },
74   ],
75 );
76
77 1;