my $idp = $config->{international_dialing_prefix} // '00';
my $number = $params{number} // '';
- $number =~ s/[^0-9+\.-]//g; # delete unsupported characters
+ $number =~ s/[^0-9+]//g; # delete unsupported characters
my $countrycode = $number =~ s/^(?: $idp | \+ ) ( \d{2} )//x ? $1 : ''; # TODO: countrycodes can have more or less than 2 digits
$number =~ s/^0//x if $countrycode; # kill non standard optional zero after global identifier
+ $number =~ s{[^0-9]+}{}g;
return '' unless $number;
}
is SL::CTI->call_link(number => '0371 5347 620'), 'controller.pl?action=CTI/call&number=03715347620';
-is SL::CTI->call_link(number => '0049(0)421-22232 22'), 'controller.pl?action=CTI/call&number=0049421-2223222';
-is SL::CTI->call_link(number => '+49(0)421-22232 22'), 'controller.pl?action=CTI/call&number=0049421-2223222';
+is SL::CTI->call_link(number => '0049(0)421-22232 22'), 'controller.pl?action=CTI/call&number=00494212223222';
+is SL::CTI->call_link(number => '+49(0)421-22232 22'), 'controller.pl?action=CTI/call&number=00494212223222';
is SL::CTI->call_link(number => 'Tel: +49 40 809064 0'), 'controller.pl?action=CTI/call&number=0049408090640';
is SL::CTI->call_link(number => '0371 5347 620', internal => 1), 'controller.pl?action=CTI/call&number=03715347620&internal=1';
-is SL::CTI->call_link(number => '0049(0)421-22232 22', internal => 1), 'controller.pl?action=CTI/call&number=0049421-2223222&internal=1';
-is SL::CTI->call_link(number => '+49(0)421-22232 22', internal => 1), 'controller.pl?action=CTI/call&number=0049421-2223222&internal=1';
+is SL::CTI->call_link(number => '0049(0)421-22232 22', internal => 1), 'controller.pl?action=CTI/call&number=00494212223222&internal=1';
+is SL::CTI->call_link(number => '+49(0)421-22232 22', internal => 1), 'controller.pl?action=CTI/call&number=00494212223222&internal=1';
is SL::CTI->call_link(number => 'Tel: +49 40 809064 0', internal => 1), 'controller.pl?action=CTI/call&number=0049408090640&internal=1';
}
is SL::CTI->sanitize_number(number => '0371 5347 620'), '03715347620';
-is SL::CTI->sanitize_number(number => '0049(0)421-22232 22'), '0049421-2223222';
-is SL::CTI->sanitize_number(number => '+49(0)421-22232 22'), '0049421-2223222';
+is SL::CTI->sanitize_number(number => '0049(0)421-22232 22'), '00494212223222';
+is SL::CTI->sanitize_number(number => '+49(0)421-22232 22'), '00494212223222';
is SL::CTI->sanitize_number(number => 'Tel: +49 40 809064 0'), '0049408090640';