diff options
| author | mark <mark> | 2011-06-06 23:44:26 +0000 | 
|---|---|---|
| committer | mark <mark> | 2011-06-06 23:44:26 +0000 | 
| commit | eb60190cfee653ba20c92ad3d3e49e84de9ca859 (patch) | |
| tree | a1727b3c3485718f3e59eaa387da2acfc2c55856 | |
| parent | 528da7cf5c2c72cc062fc92bfa7ef37eb163f8bd (diff) | |
Sonus CDR format, #13053
| -rw-r--r-- | FS/FS/Schema.pm | 2 | ||||
| -rw-r--r-- | FS/FS/cdr/sonus.pm | 31 | 
2 files changed, 32 insertions, 1 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 819fae9f5..9d03ce39d 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -2817,7 +2817,7 @@ sub tables_hashref {          'charged_party',       'varchar', 'NULL', $char_d, '', '',          'upstream_currency',      'char', 'NULL',       3, '', '', -        'upstream_price',      'decimal', 'NULL',  '10,2', '', '',  +        'upstream_price',      'decimal', 'NULL',  '10,4', '', '',           'upstream_rateplanid',     'int', 'NULL',      '', '', '', #?          # how it was rated internally... diff --git a/FS/FS/cdr/sonus.pm b/FS/FS/cdr/sonus.pm new file mode 100644 index 000000000..f21923999 --- /dev/null +++ b/FS/FS/cdr/sonus.pm @@ -0,0 +1,31 @@ +package FS::cdr::sonus; + +use strict; +use base qw( FS::cdr ); +use vars qw( %info ); +use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker ); + +%info = ( +  'name'          => 'Sonus', +  'weight'        => 525, +  'header'        => 0,     #0 default, set to 1 to ignore the first line, or +                            # to higher numbers to ignore that number of lines +  'type'          => 'csv', #csv (default), fixedlength or xls +  'sep_char'      => ',',   #for csv, defaults to , +  'import_fields' => [ +    'src', # also customer id +    'dst', +    _cdr_date_parser_maker('startdate'), +    _cdr_date_parser_maker('enddate'), +    _cdr_min_parser_maker, +    skip(12), +    sub { #rate +      my ($cdr, $rate) = @_; +      $cdr->upstream_price(sprintf("%.4f", $rate * $cdr->duration / 60)); +    } +  ], +); + +sub skip { map {''} (1..$_[0]) } + +1;  | 
