summaryrefslogtreecommitdiff
path: root/FS/FS/cdr/orcon.pm
blob: 7bdba93a6c817ab1504f213a14bef6d60ee2e1e6 (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
package FS::cdr::orcon;

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

@ISA = qw(FS::cdr);

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

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

                $calldate =~ /^(\d{4})\/(\d{2})\/(\d{4})\s*(\d{2}):(\d{2}):(\d{2})$/
                               or die "unparseable date: $calldate";
                my $tmp_date = "$2/$1/$3 $4:$5:$6";

                $tmp_date = str2time($tmp_date);
                $cdr->set('startdate', $tmp_date);
                  },    #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;