diff --git a/app/destinations/destinations.php b/app/destinations/destinations.php index 5caafc6850..79384d6794 100644 --- a/app/destinations/destinations.php +++ b/app/destinations/destinations.php @@ -178,7 +178,7 @@ else { echo " ".$_SESSION['domains'][$row['domain_uuid']]['domain_name']."\n"; } echo " ".ucwords($row['destination_type'])."\n"; - echo " ".$row['destination_number']."\n"; + echo " ".format_phone($row['destination_number'])."\n"; echo " ".$row['destination_context']."\n"; echo " ".ucwords($row['destination_enabled'])."\n"; echo " ".$row['destination_description']." \n"; diff --git a/resources/functions.php b/resources/functions.php index 69b33d3933..79c9cc14ca 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -771,13 +771,15 @@ function format_string ($format, $data) { //get the format and use it to format the phone number function format_phone($phone_number) { - foreach ($_SESSION["format"]["phone"] as &$format) { - $format_count = substr_count($format, 'x'); - $format_count = $format_count + substr_count($format, 'R'); - $format_count = $format_count + substr_count($format, 'r'); - if ($format_count == strlen($phone_number)) { - //format the number - $phone_number = format_string($format, $phone_number); + if (is_numeric($phone_number)) { + foreach ($_SESSION["format"]["phone"] as &$format) { + $format_count = substr_count($format, 'x'); + $format_count = $format_count + substr_count($format, 'R'); + $format_count = $format_count + substr_count($format, 'r'); + if ($format_count == strlen($phone_number)) { + //format the number + $phone_number = format_string($format, $phone_number); + } } } return $phone_number;