summaryrefslogtreecommitdiff
path: root/FS/FS/cdr/ispphone.pm
diff options
context:
space:
mode:
authorJeremy Davis <jeremyd@freeside.biz>2015-03-30 10:04:48 -0400
committerJeremy Davis <jeremyd@freeside.biz>2015-03-30 10:04:48 -0400
commit7035b1184a6c8dae4c3ea3c5dc34173725b714ec (patch)
tree07f22012796fdf58608307ce3329c80db4756dfb /FS/FS/cdr/ispphone.pm
parente96b1f2c3826361a4a133f347508d46fbc317764 (diff)
Ticket #33459 ISPPhone CDR format
Diffstat (limited to 'FS/FS/cdr/ispphone.pm')
-rw-r--r--FS/FS/cdr/ispphone.pm51
1 files changed, 51 insertions, 0 deletions
diff --git a/FS/FS/cdr/ispphone.pm b/FS/FS/cdr/ispphone.pm
new file mode 100644
index 0000000..49d1b07
--- /dev/null
+++ b/FS/FS/cdr/ispphone.pm
@@ -0,0 +1,51 @@
+package FS::cdr::ispphone;
+
+use strict;
+use vars qw( @ISA %info $tmp_mon $tmp_mday $tmp_year );
+use Time::Local;
+use FS::cdr;
+use Date::Parse;
+
+@ISA = qw(FS::cdr);
+
+%info = (
+ 'name' => 'ISPPhone',
+ 'weight' => 123,
+ 'header' => 2,
+ 'import_fields' => [
+
+ 'src', # Form
+ 'dst', # To
+ 'upstream_dst_regionname', # Country
+ 'dcontext', # Description
+
+ sub { my ($cdr, $calldate) = @_;
+ $cdr->set('calldate', $calldate);
+
+ my $tmp_date;
+
+ if ($calldate =~ /^(\d{2})\/(\d{2})\/(\d{2})\s*(\d{1,2}):(\d{2})$/){
+
+ $tmp_date = "$2/$1/$3 $4:$5:$6";
+
+ } else { $tmp_date = $calldate; }
+
+ $tmp_date = str2time($tmp_date);
+ $cdr->set('startdate', $tmp_date);
+
+ }, #DateTime
+
+ sub { my ($cdr, $duration) = @_;
+ my ($min,$sec) = split(/:/, $duration);
+ my $billsec = $sec + $min * 60;
+ $cdr->set('billsec', $billsec);
+
+ }, #Charged time, min:sec
+
+ 'upstream_price', # Amount ( upstream price )
+],
+
+);
+
+1;
+