[freeside-commits] freeside/FS/FS/cdr troop.pm, 1.1, 1.2 bell_west.pm, 1.2, 1.3
Ivan,,,
ivan at wavetail.420.am
Fri Jan 2 14:04:00 PST 2009
- Previous message: [freeside-commits] freeside/bin cdr.import, 1.2, 1.3 cdr.sftp_and_import, 1.1, 1.2
- Next message: [freeside-commits] freeside/bin cdr.http_and_import, NONE, 1.1 cdr.import, 1.3, 1.4 cdr.sftp_and_import, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS/cdr
In directory wavetail.420.am:/tmp/cvs-serv27550/FS/FS/cdr
Modified Files:
troop.pm bell_west.pm
Log Message:
add troop CDRs, RT#4413
Index: troop.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cdr/troop.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- troop.pm 2 Jan 2009 17:58:43 -0000 1.1
+++ troop.pm 2 Jan 2009 22:03:58 -0000 1.2
@@ -1,96 +1,128 @@
-package FS::cdr::cdr_template;
+package FS::cdr::troop;
use strict;
use base qw( FS::cdr );
-use vars qw( %info );
-use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
+use vars qw( %info $tmp_mon $tmp_mday $tmp_year );
+use Time::Local;
+#use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
%info = (
'name' => 'Troop',
'weight' => 220,
- 'header' => 0, #0 default, set to 1 to ignore the first line
- 'type' => 'csv', #csv (default), fixedlength or xls
- 'sep_char' => ',', #for csv, defaults to ,
- 'disabled' => 0, #0 default, set to 1 to disable
+ 'header' => 2,
+ 'type' => 'xls',
- #listref of what to do with each field from the CDR, in order
'import_fields' => [
-
- #place data directly in the specified field
- 'freeside_cdr_fieldname',
- #subroutine reference
- sub { my($cdr, $field_data) = @_;
- #do something to $field_data
- $cdr->fieldname($field_data);
+ # CDR FIELD / REQUIRED / Notes
+
+ # / No / CDR sequence number
+ sub {},
+
+ # WTN / Yes
+ 'charged_party',
+
+ # Account Code / Yes / Account Code (security) and we need on invoice
+ 'accountcode',
+
+ # DT / Yes / "DATE" Excel
+ # XXX false laziness w/bell_west.pm
+ sub { my($cdr, $date) = @_;
+
+ my $datetime = DateTime::Format::Excel->parse_datetime( $date );
+ $tmp_mon = $datetime->mon_0;
+ $tmp_mday = $datetime->mday;
+ $tmp_year = $datetime->year;
},
- #premade subref factory for date parsing
- _cdr_date_parser_maker('startddate'), #for example
-
- #premade subref factory for decimal minute parsing
- _cdr_min_parser_maker, #defaults to billsec and duration
- _cdr_min_parser_maker('fieldname'), #one field
- _cdr_min_parser_maker(['billsec', 'duration']), #listref for multiple fields
+ # Time / Yes / "TIME" excel
+ sub { my($cdr, $time) = @_;
+ #my($sec, $min, $hour, $mday, $mon, $year)= localtime($cdr->startdate);
- ],
+ #$sec = $time * 86400;
+ my $sec = int( $time * 86400 + .5);
- #Text::FixedLength field descriptions & lengths, for type=>'fixedlength' only
- 'fixedlength_format' => [qw(
- Type:2:1:2
- Sequence:4:3:6
- )],
+ #$cdr->startdate( timelocal($3, $2, $1 ,$mday, $mon, $year) );
+ $cdr->startdate(
+ timelocal(0, 0, 0, $tmp_mday, $tmp_mon, $tmp_year) + $sec
+ );
+ },
-);
-1;
+ # Dur. / Yes / Units = seconds
+ 'billsec',
-__END__
+ # OVS Type / Maybe / add "011" to international calls
+ # N = DOM LD / normal
+ # Z = INTL LD
+ # O = INTL LD
+ # others...?
+ sub { my($cdr, $ovs) = @_;
+ my $pre = ( $ovs =~ /^\s*[OZ]\s*$/i ) ? '011' : '1';
+ $cdr->dst( $pre. $cdr->dst ) unless $cdr->dst =~ /^$pre/;
+ },
-list of freeside CDR fields, useful ones marked with *
+ # Number / YES
+ 'src',
- acctid - primary key
-*[1] calldate - Call timestamp (SQL timestamp)
- clid - Caller*ID with text
-* src - Caller*ID number / Source number
-* dst - Destination extension
- dcontext - Destination context
- channel - Channel used
- dstchannel - Destination channel if appropriate
- lastapp - Last application if appropriate
- lastdata - Last application data
-* startdate - Start of call (UNIX-style integer timestamp)
- answerdate - Answer time of call (UNIX-style integer timestamp)
-* enddate - End time of call (UNIX-style integer timestamp)
-* duration - Total time in system, in seconds
-* billsec - Total time call is up, in seconds
-*[2] disposition - What happened to the call: ANSWERED, NO ANSWER, BUSY
- amaflags - What flags to use: BILL, IGNORE etc, specified on a per
- channel basis like accountcode.
-*[3] accountcode - CDR account number to use: account
- uniqueid - Unique channel identifier (Unitel/RSLCOM Event ID)
- userfield - CDR user-defined field
- cdr_type - CDR type - see FS::cdr_type (Usage = 1, S&E = 7, OC&C = 8)
-*[4] charged_party - Service number to be billed
- upstream_currency - Wholesale currency from upstream
-*[5] upstream_price - Wholesale price from upstream
- upstream_rateplanid - Upstream rate plan ID
- rated_price - Rated (or re-rated) price
- distance - km (need units field?)
- islocal - Local - 1, Non Local = 0
-*[6] calltypenum - Type of call - see FS::cdr_calltype
- description - Description (cdr_type 7&8 only) (used for
- cust_bill_pkg.itemdesc)
- quantity - Number of items (cdr_type 7&8 only)
- carrierid - Upstream Carrier ID (see FS::cdr_carrier)
- upstream_rateid - Upstream Rate ID
- svcnum - Link to customer service (see FS::cust_svc)
- freesidestatus - NULL, done (or something)
+ # City / No
+ 'channel',
+
+ # Prov/State / No / We will use your Freeside rating and description name
+ sub { my($cdr, $state) = @_;
+ $cdr->channel( $cdr->channel. ", $state" )
+ if $state;
+ },
+
+ # Number / Yes
+ 'dst',
+
+ # City / No
+ 'dstchannel',
+
+ # Prov/State / No / We will use your Freeside rating and description name
+ sub { my($cdr, $state) = @_;
+ $cdr->dstchannel( $cdr->dstchannel. ", $state" )
+ if $state;
+ },
+
+ # OVS / Maybe
+ # Would help to add "011" to international calls (if you are willing)
+ # (using ovs above)
+ sub { my($cdr, $ovs) = @_;
+ my @ignore = ( 'BELL', 'CANADA', 'UNITED STATES', );
+ $cdr->dstchannel( $cdr->dstchannel. ", $ovs" )
+ if $ovs && ! grep { $ovs =~ /^\s*$_\s*$/ } @ignore;
+ },
+
+ # CC Ind. / No / Does show if Calling card but should not be required
+ #'N' or 'E'
+ sub {},
+
+ # Call Charge / No / Bell billing info and is not required
+ 'upstream_price',
+
+ # Account # / No / Bell billing info and is not required
+ sub {},
+
+ # Net Charge / No / Bell billing info and is not required
+ sub {},
+
+ # Surcharge / No / Taxes and is not required
+ sub {},
+
+ # GST / No / Taxes and is not required
+ sub {},
+
+ # PST / No / Taxes and is not required
+ sub {},
+
+ # HST / No / Taxes and is not required
+ sub {},
+
+ ],
+
+);
+
+1;
-[1] Auto-populated from startdate if not present
-[2] Package options available to ignore calls without a specific disposition
-[3] When using 'cdr-charged_party-accountcode' config
-[4] Auto-populated from src (normal calls) or dst (toll free calls) if not present
-[5] When using 'upstream_simple' rating method.
-[6] Set to usage class classnum when using pre-rated CDRs and usage class-based
- taxation (local/intrastate/interstate/international)
Index: bell_west.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cdr/bell_west.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- bell_west.pm 31 Dec 2008 22:04:46 -0000 1.2
+++ bell_west.pm 2 Jan 2009 22:03:58 -0000 1.3
@@ -4,13 +4,13 @@
use base qw( FS::cdr );
use vars qw( %info $tmp_mon $tmp_mday $tmp_year );
use Time::Local;
-use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
+#use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
%info = (
'name' => 'Bell West',
'weight' => 210,
- 'header' => 1, #0 default, set to 1 to ignore the first line
- 'type' => 'xls', #csv (default), fixedlength or xls
+ 'header' => 1,
+ 'type' => 'xls',
'import_fields' => [
@@ -23,13 +23,9 @@
sub {},
# DATE / Yes / "DATE" Excel date format MM/DD/YYYY
+ # XXX false laziness w/troop.pm
sub { my($cdr, $date) = @_;
- #$date =~ /^(\d{1,2})\/(\d{1,2})\/(\d\d(\d\d)?)$/
- # or die "unparsable date: $date"; #maybe we shouldn't die...
- ##$cdr->startdate( timelocal(0, 0, 0 ,$2, $1-1, $3) );
- #($tmp_mday, $tmp_mon, $tmp_year) = ( $2, $1-1, $3 );
-
my $datetime = DateTime::Format::Excel->parse_datetime( $date );
$tmp_mon = $datetime->mon_0;
$tmp_mday = $datetime->mday;
@@ -49,22 +45,24 @@
);
},
- # BTN / Yes / Main billing number but not DID or real number (I guess put in SRC field)
+ # BTN / Yes / Main billing number but not DID or real number
+ # (put in SRC field)
'src',
# ORIG CITY / No / We will use your Freeside rating and description name
'channel',
- # TERM / YES / All calls should be billed, however all calls are missing "1+" and "011+" & DIR ASST = "411"
+ # TERM / YES / All calls should be billed, however all calls are
+ # missing "1+" and "011+" & DIR ASST = "411"
'dst',
# TERM CITY / No / We will use your Freeside rating and description name
'dstchannel',
- # WTN / Yes / Bill to number (I guess put in "charged_party")
+ # WTN / Yes / Bill to number (put in "charged_party")
'charged_party',
- # CODE / Yes / Account Code (security) and we need on invoice (suggestions ?)
+ # CODE / Yes / Account Code (security) and we need on invoice
'accountcode',
# PROV/COUNTRY / No / We will use your Freeside rating and description name
@@ -74,7 +72,8 @@
$cdr->dst( $pre. $cdr->dst ) unless $cdr->dst =~ /^$pre/;
},
- # CALL TYPE / Possibly / Not sure if you need this to determine correct billing method ?
+ # CALL TYPE / Possibly / Not sure if you need this to determine correct
+ # billing method ?
# DDD normal call (Direct Dial Dsomething? ="LD"?)
# TF Toll Free
# (toll free dst# should be sufficient to rate)
- Previous message: [freeside-commits] freeside/bin cdr.import, 1.2, 1.3 cdr.sftp_and_import, 1.1, 1.2
- Next message: [freeside-commits] freeside/bin cdr.http_and_import, NONE, 1.1 cdr.import, 1.3, 1.4 cdr.sftp_and_import, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list