summaryrefslogtreecommitdiff
path: root/FS/FS/cdr/orcon.pm
blob: 66b045fd5f85c46024896a737ec1785da3ab7bfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package FS::cdr::orcon;

use strict;
use vars qw( @ISA %info);
use FS::cdr;
use Date::Parse;

@ISA = qw(FS::cdr);

%info = (
  'name'          => 'Orcon',
  'weight'        => 120,
  'header'        => 1,
  'import_fields' => [

	skip(1)      ,  #id
        skip(1)      ,  #billing period
        'accountcode',  #account number
        skip(2),        #username
                        #service id
        sub { my ($cdr, $calldate, $param) = @_;
        
         	$cdr->set('calldate', $calldate);

                if ($calldate =~ /^(\d{4})-(\d{2})-(\d{2})\s*(\d{2}):(\d{2}):(\d{2})$/){

                my $tmp_date = "$2/$3/$1 $4:$5:$6";

                $tmp_date = str2time($tmp_date);
                $cdr->set('startdate', $tmp_date);
	
		} else {

			$param->{skiprow} = 1
		}
                  },    #date
        skip(1),        #tariff region
        'src',          #originating number
        'dst',          #terminating number
        'duration',      #duration actual
        'billsec',	#duration billed
        skip(1),        #discount
        'upstream_price',#charge

  ],
);

sub skip { map {''} (1..$_[0]) }

1;