- if ( $self->option('rating_method') eq 'prefix'
- || ! $self->option('rating_method')
- )
- {
-
- die "rating_method 'prefix' not yet supported";
-
-# ###
-# # look up rate details based on called station id
-# ###
-#
-# my $dest = $cdr->dst;
-#
-# #remove non-phone# stuff and whitespace
-# $dest =~ s/\s//g;
-# my $proto = '';
-# $dest =~ s/^(\w+):// and $proto = $1; #sip:
-# my $siphost = '';
-# $dest =~ s/\@(.*)$// and $siphost = $1; # @10.54.32.1, @sip.example.com
-#
-# #determine the country code
-# my $countrycode;
-# if ( $dest =~ /^011(((\d)(\d))(\d))(\d+)$/
-# || $dest =~ /^\+(((\d)(\d))(\d))(\d+)$/
-# )
-# {
-#
-# my( $three, $two, $one, $u1, $u2, $rest ) = ( $1,$2,$3,$4,$5,$6 );
-# #first look for 1 digit country code
-# if ( qsearch('rate_prefix', { 'countrycode' => $one } ) ) {
-# $countrycode = $one;
-# $dest = $u1.$u2.$rest;
-# } elsif ( qsearch('rate_prefix', { 'countrycode' => $two } ) ) { #or 2
-# $countrycode = $two;
-# $dest = $u2.$rest;
-# } else { #3 digit country code
-# $countrycode = $three;
-# $dest = $rest;
-# }
-#
-# } else {
-# $countrycode = '1';
-# $dest =~ s/^1//;# if length($dest) > 10;
-# }
-#
-# warn "rating call to +$countrycode $dest\n" if $DEBUG;
-# $pretty_destnum = "+$countrycode $dest";
-#
-# #find a rate prefix, first look at most specific (4 digits) then 3, etc.,
-# # finally trying the country code only
-# my $rate_prefix = '';
-# for my $len ( reverse(1..6) ) {
-# $rate_prefix = qsearchs('rate_prefix', {
-# 'countrycode' => $countrycode,
-# #'npa' => { op=> 'LIKE', value=> substr($dest, 0, $len) }
-# 'npa' => substr($dest, 0, $len),
-# } ) and last;
-# }
-# $rate_prefix ||= qsearchs('rate_prefix', {
-# 'countrycode' => $countrycode,
-# 'npa' => '',
-# });
-#
-# die "Can't find rate for call to +$countrycode $dest\n"
-# unless $rate_prefix;
-#
-# $regionnum = $rate_prefix->regionnum;
-# $rate_detail = qsearchs('rate_detail', {
-# 'ratenum' => $ratenum,
-# 'dest_regionnum' => $regionnum,
-# } );
-#
-# $rate_region = $rate_prefix->rate_region;
-#
-# warn " found rate for regionnum $regionnum ".
-# "and rate detail $rate_detail\n"
-# if $DEBUG;