RT# 73421 Add allow messages flag message_dest to contact_email
[freeside.git] / FS / FS / cdr / conexiant.pm
1 package FS::cdr::conexiant;
2 use base qw( FS::cdr );
3
4 use strict;
5 use vars qw( %info );
6 use FS::Record qw( qsearchs );
7 use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
8
9 %info = (
10   'name'          => 'Conexiant',
11   'weight'        => 600,
12   'header'        => 1,
13   'type'          => 'csv',
14   'import_fields' => [
15     skip(3),               #LookupError,Direction,LegType
16     sub {                  #CallId
17       my($cdr,$value,$conf,$param) = @_;
18       #filter out already-imported cdrs here
19       if (qsearchs('cdr',{'uniqueid' => $value})) {
20         $param->{'skiprow'} = 1;
21         $param->{'unique_skip'} = 1; #tell batch_import why we're skipping
22       } else {
23         $cdr->uniqueid($value);
24       }
25     },
26     'upstream_rateplanid', #ClientRateSheetId
27     skip(1),               #ClientRouteId
28     'src',                 #SourceNumber
29     skip(1),               #RawNumber
30     'dst',                 #DestNumber
31     skip(1),               #DestLRN
32     _cdr_date_parser_maker('startdate'),  #CreatedOn
33     _cdr_date_parser_maker('answerdate'), #AnsweredOn
34     _cdr_date_parser_maker('enddate'),    #HangupOn
35     skip(4),               #CallCause,SipCode,Price,USFCharge
36     'upstream_price',      #TotalPrice
37     _cdr_min_parser_maker('billsec'),     #PriceDurationMins
38     skip(2),               #SipEndpointId, SipEndpointName
39   ],
40 );
41
42 sub skip { map {''} (1..$_[0]) }
43
44 1;