use vars qw( @ISA @EXPORT_OK $DEBUG $me
$conf $cdr_prerate %cdr_prerate_cdrtypenums
$use_lrn $support_key $max_duration
+ $cp_accountcode $cp_accountcode_trim0s $cp_field
+ $tollfree_country
);
use Exporter;
use List::Util qw(first min);
$max_duration = $conf->config('cdr-max_duration') || 0;
+ $cp_accountcode = $conf->exists('cdr-charged_party-accountcode');
+ $cp_accountcode_trim0s = $conf->exists('cdr-charged_party-accountcode-trim_leading_0s');
+
+ $cp_field = $conf->config('cdr-charged_party-field');
+
+ $tollfree_country = $conf->config('tollfree-country') || '';
+
});
=head1 NAME
=item detailnum - Link to invoice detail (L<FS::cust_bill_pkg_detail>)
+=item sipcallid - SIP Call-ID
+
=back
=head1 METHODS
sub is_tollfree {
my $self = shift;
my $field = scalar(@_) ? shift : 'dst';
- my $country = $conf->config('tollfree-country') || '';
- if ( $country eq 'AU' ) {
+ if ( $tollfree_country eq 'AU' ) {
( $self->$field() =~ /^(\+?61)?(1800|1300)/ ) ? 1 : 0;
- } elsif ( $country eq 'NZ' ) {
+ } elsif ( $tollfree_country eq 'NZ' ) {
( $self->$field() =~ /^(\+?64)?(800|508)/ ) ? 1 : 0;
} else { #NANPA (US/Canaada)
( $self->$field() =~ /^(\+?1)?8(8|([02-7])\3)/ ) ? 1 : 0;
unless ( $self->charged_party ) {
- if ( $conf->exists('cdr-charged_party-accountcode') && $self->accountcode ){
+ if ( $cp_accountcode && $self->accountcode ) {
my $charged_party = $self->accountcode;
$charged_party =~ s/^0+//
- if $conf->exists('cdr-charged_party-accountcode-trim_leading_0s');
+ if $cp_accountcode_trim0s;
$self->charged_party( $charged_party );
- } elsif ( $conf->exists('cdr-charged_party-field') ) {
+ } elsif ( $cp_field ) {
- my $field = $conf->config('cdr-charged_party-field');
- $self->charged_party( $self->$field() );
+ $self->charged_party( $self->$cp_field() );
} else {
} else {
$self->freesidestatus($status);
+ $self->freesidestatustext($opt{'statustext'}) if exists($opt{'statustext'});
$self->rated_price($rated_price);
$self->$_($opt{$_})
foreach grep exists($opt{$_}), map "rated_$_",
return $self->set_status_and_rated_price( 'skipped',
0,
$opt{'svcnum'},
+ 'statustext' => $reason,
);
}
my $iopt = _import_options;
$opt->{$_} = $iopt->{$_} foreach keys %$iopt;
- if ( defined $opt->{'cdrtypenum'} ) {
- $opt->{'preinsert_callback'} = sub {
- my($record,$param) = (shift,shift);
- $record->cdrtypenum($opt->{'cdrtypenum'});
+ if ( grep defined $opt->{$_}, qw(cdrtypenum carrierid) ) {
+ $opt->{preinsert_callback} = sub {
+ my($record, $param) = @_;
+ $record->$_($opt->{$_})
+ foreach grep defined $opt->{$_}, qw(cdrtypenum carrierid);
'';
};
}