From a168f45d92fcb927ab1d9ab8e79e0b0a3f8eec59 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 28 Jul 2021 12:47:33 -0600 Subject: [PATCH] Save only numbers and an optional * prefix. Users may add phone number with formatting and this breaks call forward. So this removes white spaces and formatting to ensure the call forwarding works. --- app/calls/call_edit.php | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/app/calls/call_edit.php b/app/calls/call_edit.php index d32452d7a0..fcdc03f560 100644 --- a/app/calls/call_edit.php +++ b/app/calls/call_edit.php @@ -173,17 +173,11 @@ //call forward config if (permission_exists('call_forward')) { - //trim hidden characters - $forward_all_destination = trim($forward_all_destination); - $forward_busy_destination = trim($forward_busy_destination); - $forward_no_answer_destination = trim($forward_no_answer_destination); - $forward_user_not_registered_destination = trim($forward_user_not_registered_destination); - //sanitize the destinations - $forward_all_destination = str_replace('$', '', $forward_all_destination); - $forward_busy_destination = str_replace('$', '', $forward_busy_destination); - $forward_no_answer_destination = str_replace('$', '', $forward_no_answer_destination); - $forward_user_not_registered_destination = str_replace('$', '', $forward_user_not_registered_destination); + $forward_all_destination = preg_replace('#[^\*0-9]#', '', $forward_all_destination); + $forward_busy_destination = preg_replace('#[^\*0-9]#', '', $forward_busy_destination); + $forward_no_answer_destination = preg_replace('#[^\*0-9]#', '', $forward_no_answer_destination); + $forward_user_not_registered_destination = preg_replace('#[^\*0-9]#', '', $forward_user_not_registered_destination); //build the array $array['extensions'][0]['domain_uuid'] = $_SESSION['domain_uuid']; @@ -239,11 +233,8 @@ $destination_found = false; foreach ($destinations as $field) { if ($field['destination'] != '') { - //trim hidden characters - $field['destination'] = trim($field['destination']); - //sanitize the destination - $field['destination'] = str_replace('$', '', $field['destination']); + $field['destination'] = preg_replace('#[^\*0-9]#', '', $field['destination']); //build the array $array['follow_me'][0]['follow_me_destinations'][$d]['domain_uuid'] = $_SESSION['domain_uuid'];