X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fvoip_cdr.pm;h=64ea20a724d95b971be9ca6128de1643f7695d99;hb=4af73b8c830417be1e90ce274f5c19f5ec90b316;hp=794ae010f44dd3a066f492756c05c67c33410fd6;hpb=3b97735238d919ed548bfb17aea8162623c1d286;p=freeside.git diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm index 794ae010f..64ea20a72 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -80,7 +80,7 @@ tie my %temporalities, 'Tie::IxHash', # 'type' => 'checkbox', # }, - 'international_prefix' => { 'name' => 'Destination prefix(es) for international CDR records. Separate multiple options with commas.', + 'international_prefix' => { 'name' => 'Destination prefix for international CDR records', 'default' => '011', }, @@ -269,6 +269,8 @@ sub calc_recur { $number = $cdr->dst; } + warn "parsing call $to_or_from $number\n" if $DEBUG; + #remove non-phone# stuff and whitespace $number =~ s/\s//g; # my $proto = ''; @@ -277,23 +279,13 @@ sub calc_recur { # $dest =~ s/\@(.*)$// and $siphost = $1; # @10.54.32.1, @sip.example.com my $intl = $self->option('international_prefix') || '011'; - my @intl = (); - if ( $intl =~ /,/ ) { - @intl = split(/\s*,\s*/, $intl); - } else { - @intl = ($intl); - } #determine the country code - my $intl_match = 0; - foreach my $i (@intl) { - if ( $number =~ /^$i(((\d)(\d))(\d))(\d+)$/ ) { - $intl_match++; - last; - } - } my $countrycode; - if ( $intl_match || $number =~ /^\+(((\d)(\d))(\d))(\d+)$/ ) { + if ( $number =~ /^$intl(((\d)(\d))(\d))(\d+)$/ + || $number =~ /^\+(((\d)(\d))(\d))(\d+)$/ + ) + { my( $three, $two, $one, $u1, $u2, $rest ) = ( $1,$2,$3,$4,$5,$6 ); #first look for 1 digit country code