- if ( $dest =~ /^011((\d\d)(\d))(\d+)$/ ) {
-
- my( $three, $two, $unknown, $rest ) = ( $1, $2, $3, $4 );
- #first look for 2 digit country code
- if ( qsearch('rate_prefix', { 'countrycode' => $two } ) ) {
+ if ( $dest =~ /^011(((\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