my $error =
$self->ut_numbern('acctid')
- #Usage = 1, S&E = 7, OC&C = 8
- || $self->ut_foreign_keyn('cdrtypenum', 'cdr_type', 'cdrtypenum' )
-
- #the big list in appendix 2
- || $self->ut_foreign_keyn('calltypenum', 'cdr_calltype', 'calltypenum' )
-
- # Telstra =1, Optus = 2, RSL COM = 3
- || $self->ut_foreign_keyn('carrierid', 'cdr_carrier', 'carrierid' )
+ #add a config option to turn these back on if someone needs 'em
+ #
+ # #Usage = 1, S&E = 7, OC&C = 8
+ # || $self->ut_foreign_keyn('cdrtypenum', 'cdr_type', 'cdrtypenum' )
+ #
+ # #the big list in appendix 2
+ # || $self->ut_foreign_keyn('calltypenum', 'cdr_calltype', 'calltypenum' )
+ #
+ # # Telstra =1, Optus = 2, RSL COM = 3
+ # || $self->ut_foreign_keyn('carrierid', 'cdr_carrier', 'carrierid' )
;
return $error if $error;
'weight' => 130,
'header' => 1,
'import_fields' => [ #some of these are kind arbitrary...
- sub { my($cdr, $field) = @_; }, #XXX interesting RecordType
- # easy to fix: Can't find cdr.cdrtypenum 1 in cdr_type.cdrtypenum
+ #0
+ 'cdrtypenum', #RecordType
sub { my($cdr, $field) = @_; }, #all10#RecordVersion
sub { my($cdr, $field) = @_; }, #OrigShelfNumber
sub { my($cdr, $field) = @_; }, #OrigCardNumber
'accountcode', #SessionNumber
'src', #CallingPartyNumber
'dst', #CalledPartyNumber
+
+ #10
_cdr_date_parser_maker('startdate'), #CallArrivalTime
_cdr_date_parser_maker('enddate'), #CallCompletionTime
sub { my($cdr, $field) = @_; }, #TermShelfNumber
sub { my($cdr, $field) = @_; }, #TermCardNumber
+
+ #20
sub { my($cdr, $field) = @_; }, #TermCircuit
sub { my($cdr, $field) = @_; }, #TermCircuitType
- sub { my($cdr, $field) = @_; }, #OutboundCarrierId
+ 'carrierid', #OutboundCarrierId
'charged_party', #BillingNumber
sub { my($cdr, $field) = @_; }, #SubscriberNumber
'lastapp', #ServiceName
'lastdata', #ServiceInformation
sub { my($cdr, $field) = @_; }, #FacilityInfo
sub { my($cdr, $field) = @_; }, #all 1900-01-01 0#CallTraceTime
+
+ #30
sub { my($cdr, $field) = @_; }, #all-1#UniqueIndicator
sub { my($cdr, $field) = @_; }, #all-1#PresentationIndicator
sub { my($cdr, $field) = @_; }, #empty#Pin
- sub { my($cdr, $field) = @_; }, #CallType
+ 'calltypenum', #CallType
+
+ #nothing below is used by QIS...
+
sub { my($cdr, $field) = @_; }, #Balt/empty #OrigRateCenter
sub { my($cdr, $field) = @_; }, #Balt/empty #TermRateCenter
'userfield', #empty#UserDefined
sub { my($cdr, $field) = @_; }, #empty#PseudoDestinationNumber
sub { my($cdr, $field) = @_; }, #all-1#PseudoCarrierCode
+
+ #40
sub { my($cdr, $field) = @_; }, #empty#PseudoANI
sub { my($cdr, $field) = @_; }, #all-1#PseudoFacilityInfo
sub { my($cdr, $field) = @_; }, #OrigDialedDigits
sub { my($cdr, $field) = @_; }, #huh?#InsertTime
sub { my($cdr, $field) = @_; }, #key
sub { my($cdr, $field) = @_; }, #empty#AMALineNumber
+
+ #50
sub { my($cdr, $field) = @_; }, #empty#AMAslpID
sub { my($cdr, $field) = @_; }, #empty#AMADigitsDialedWC
sub { my($cdr, $field) = @_; }, #OpxOffHook
'type' => 'checkbox',
},
+ 'use_disposition_taqua' => { 'name' => 'Do not charge for CDRs where the disposition is not set to "100" (Taqua).',
+ 'type' => 'checkbox',
+ },
+
+ 'use_carrierid' => { 'name' => 'Do not charge for CDRs where the Carrier ID is not set to: ',
+ },
+
+ 'use_cdrtypenum' => { 'name' => 'Do not charge for CDRs where the CDR Type is not set to: ',
+ },
+
+ '411_rewrite' => { 'name' => 'Rewrite these (comma-separated) destination numbers to 411 for rating purposes: ',
+ },
+
'output_format' => { 'name' => 'Simple output format',
'type' => 'select',
'select_options' => { FS::cdr::invoice_formats() },
)
{
+ #should have some better way of checking these options than a long
+ #if-else tree...
+ my $notchg = "not charging for CDR";
+
if ( $self->option('use_amaflags') && $cdr->amaflags != 2 ) {
- warn "not charging for CDR (amaflags != 2)\n" if $DEBUG;
+ warn "$notchg (amaflags != 2)\n" if $DEBUG;
$charge = 0;
} elsif ( $self->option('use_disposition')
&& $cdr->disposition ne 'ANSWERED' ) {
- warn "not charging for CDR (disposition != ANSWERED)\n" if $DEBUG;
+ warn "$notchg (disposition != ANSWERED)\n" if $DEBUG;
+ $charge = 0;
+
+ } elsif ( $self->option('use_disposition_taqua')
+ && $cdr->disposition != 100 ) {
+
+ warn "$notchg (disposition != 100)\n" if $DEBUG;
+ $charge = 0;
+
+ } elsif ( $self->option('use_carrierid')
+ && $cdr->carrierid != $self->option('use_carrierid') ) {
+
+ warn "$notchg (carrierid != ". $self->option('use_carrierid'). ")\n"
+ if $DEBUG;
+ $charge = 0;
+
+ } elsif ( $self->option('use_cdrtypenum')
+ && $cdr->cdrtypenum != $self->option('use_cdrtypenum') ) {
+
+ warn "$notchg (cdrtypenum != ". $self->option('use_cdrtypenum'). ")\n"
+ if $DEBUG;
$charge = 0;
} else {
# (or calling station id for toll free calls)
###
+ if ( $self->option('411_rewrite') ) {
+ my @dirass = split(/\s*,\s*/, $self->option('411_rewrite'));
+ $cdr->dst('411') if grep $cdr->dst eq $_, @dirass;
+ }
+
my( $to_or_from, $number );
if ( $cdr->dst =~ /^(\+?1)?8([02-8])\1/ ) { #tollfree call
$to_or_from = 'from';