diff options
| -rw-r--r-- | FS/FS/cdr.pm | 18 | ||||
| -rw-r--r-- | FS/FS/cdr/taqua.pm | 21 | ||||
| -rw-r--r-- | FS/FS/part_pkg/voip_cdr.pm | 46 | 
3 files changed, 71 insertions, 14 deletions
| diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm index 8b09e4ec4..5848f9bbe 100644 --- a/FS/FS/cdr.pm +++ b/FS/FS/cdr.pm @@ -246,14 +246,16 @@ sub check {    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; diff --git a/FS/FS/cdr/taqua.pm b/FS/FS/cdr/taqua.pm index bdbac1327..fdbba8e95 100644 --- a/FS/FS/cdr/taqua.pm +++ b/FS/FS/cdr/taqua.pm @@ -11,9 +11,9 @@ use FS::cdr qw(_cdr_date_parser_maker);    '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 @@ -23,6 +23,8 @@ use FS::cdr qw(_cdr_date_parser_maker);      'accountcode',                        #SessionNumber      'src',                                #CallingPartyNumber      'dst',                                #CalledPartyNumber + +    #10      _cdr_date_parser_maker('startdate'),  #CallArrivalTime      _cdr_date_parser_maker('enddate'),    #CallCompletionTime @@ -53,9 +55,11 @@ use FS::cdr qw(_cdr_date_parser_maker);      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 @@ -63,10 +67,15 @@ use FS::cdr qw(_cdr_date_parser_maker);      '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 @@ -78,6 +87,8 @@ use FS::cdr qw(_cdr_date_parser_maker);      '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 @@ -88,6 +99,8 @@ use FS::cdr qw(_cdr_date_parser_maker);      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 diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm index bd73ea604..3de2171d6 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -80,6 +80,19 @@ tie my %rating_method, 'Tie::IxHash',                             '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() }, @@ -182,15 +195,39 @@ sub calc_recur {           )        { +        #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 { @@ -200,6 +237,11 @@ sub calc_recur {            # (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'; | 
