summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-11-26 14:53:41 -0800
committerMark Wells <mark@freeside.biz>2014-11-26 14:53:41 -0800
commitd51f9090afefa9e29200fc1df6e88e8c24a55657 (patch)
treefa7cb1bd60758dedc3dbe991f3f44b43fc4e0488 /FS
parentbe2bcc10c35d7762178b245cd38382047a7e270d (diff)
Thinktel CDR format and download script, #32088
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cdr/thinktel.pm42
1 files changed, 42 insertions, 0 deletions
diff --git a/FS/FS/cdr/thinktel.pm b/FS/FS/cdr/thinktel.pm
new file mode 100644
index 000000000..ddb2127a6
--- /dev/null
+++ b/FS/FS/cdr/thinktel.pm
@@ -0,0 +1,42 @@
+package FS::cdr::thinktel;
+
+use strict;
+use base qw( FS::cdr );
+use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
+
+our %info = (
+ 'name' => 'Thinktel',
+ 'weight' => 541,
+ 'header' => 1, #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 ,
+ 'disabled' => 0, #0 default, set to 1 to disable
+
+ #listref of what to do with each field from the CDR, in order
+ 'import_fields' => [
+ 'charged_party',
+ 'src',
+ 'dst',
+ _cdr_date_parser_maker('startdate'),
+ 'billsec', # rounded call duration
+ 'dcontext', # Usage Type: 'Local', 'Canada', 'Incoming', ...
+ 'upstream_price',
+ 'upstream_src_regionname',
+ 'upstream_dst_regionname',
+ '', # upstream rate per minute
+ '', # "Label"
+ # raw seconds, to one decimal place
+ sub { my ($cdr, $sec) = @_;
+ $cdr->set('duration', sprintf('%.0f', $sec));
+ },
+ # newly added fields of unclear meaning:
+ # Subscription (UUID, seems to correspond to charged_party)
+ # Call Type (always "Normal" thus far)
+ # Carrier (always empty)
+ # Alt Destination Name (always empty)
+ ],
+);
+
+1;
+