[freeside-commits] branch FREESIDE_3_BRANCH updated. 4d29332953549ff3f44cacfe296dee4b09458ad3
Mark Wells
mark at 420.am
Tue Mar 25 15:20:38 PDT 2014
The branch, FREESIDE_3_BRANCH has been updated
via 4d29332953549ff3f44cacfe296dee4b09458ad3 (commit)
from f7ca5f86edf89333bb657343c3b3c03df2d17f5b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4d29332953549ff3f44cacfe296dee4b09458ad3
Author: Mark Wells <mark at freeside.biz>
Date: Tue Mar 25 15:20:02 2014 -0700
Amcom CDR format, #27946
diff --git a/FS/FS/cdr/amcom.pm b/FS/FS/cdr/amcom.pm
new file mode 100644
index 0000000..5967d7b
--- /dev/null
+++ b/FS/FS/cdr/amcom.pm
@@ -0,0 +1,65 @@
+package FS::cdr::amcom;
+
+use strict;
+use base qw( FS::cdr );
+use vars qw( %info );
+use DateTime;
+
+my ($tmp_mday, $tmp_mon, $tmp_year);
+
+%info = (
+ 'name' => 'Amcom',
+ 'weight' => 500,
+ 'header' => 1,
+ 'type' => 'csv',
+ 'sep_char' => ',',
+ 'disabled' => 0,
+
+ #listref of what to do with each field from the CDR, in order
+ 'import_fields' => [
+
+ sub { # 1. Field Type (must be "DCR", yes, "DCR")
+ my ($cdr, $field, $conf, $hashref) = @_;
+ $hashref->{skiprow} = 1 unless $field eq 'DCR';
+ },
+ '', # 2. BWGroupID (centrex group)
+ '', # 3. BWGroupNumber
+ 'uniqueid', # 4. Record ID
+ 'dcontext', # 5. Call Category (LOCAL, NATIONAL, FREECALL, MOBILE)
+ sub { # 6. Start Date (DDMMYYYY
+ my ($cdr, $date) = @_;
+ $date =~ /^(\d{2})(\d{2})(\d{4})$/
+ or die "unparseable date: $date";
+ ($tmp_mday, $tmp_mon, $tmp_year) = ($1, $2-1, $3);
+ },
+ sub { # 7. Start Time (HHMMSS)
+ my ($cdr, $time) = @_;
+ $time =~ /^(\d{2})(\d{2})(\d{2})$/
+ or die "unparseable time: $time";
+ my $dt = DateTime->new(
+ year => $tmp_year,
+ month => $tmp_mon,
+ day => $tmp_mday,
+ hour => $1,
+ minute => $2,
+ second => $3,
+ );
+ $cdr->set('startdate', $dt->epoch);
+ },
+ sub { # 8. Duration (seconds, 3 decimals)
+ my ($cdr, $seconds) = @_;
+ $cdr->set('duration', sprintf('%.0f', $seconds));
+ $cdr->set('billsec', sprintf('%.0f', $seconds));
+ },
+ 'src', # 9. Calling Number
+ 'dst', # 10. Called Number
+ 'upstream_src_regionname', # 11. Calling Party Zone
+ 'upstream_dst_regionname', # 12. Called Party Zone
+ 'upstream_price', # 13. Call Cost
+ '', # 14. Call Cost 2 (seems to be the same?)
+ '', # 15. Service Provider ID
+ ('') x 4, # 16-20. Reserved fields
+ ],
+);
+
+1;
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cdr/amcom.pm | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 65 insertions(+), 0 deletions(-)
create mode 100644 FS/FS/cdr/amcom.pm
More information about the freeside-commits
mailing list