Check for valid fax numbers

Validate the fax destination number
- Check outbound routes
- Check valid extension
- Set the status to failed for all other numbers
This commit is contained in:
FusionPBX 2024-05-14 12:49:13 -06:00 committed by GitHub
parent 1a10543851
commit 475696ecff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 27 additions and 11 deletions

View File

@ -275,8 +275,22 @@
} }
$route_array = outbound_route_to_bridge($domain_uuid, $fax_prefix . $fax_number, $channel_variables); $route_array = outbound_route_to_bridge($domain_uuid, $fax_prefix . $fax_number, $channel_variables);
if (count($route_array) == 0) { if (count($route_array) == 0) {
//send the internal call to the registered extension //check for valid extension
$route_array[] = "user/".$fax_number."@".$domain_name; $sql = "select count(extension_uuid) ";
$sql .= "from v_extensions ";
$sql .= "where extension = :fax_number ";
$sql .= "and domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
$parameters['fax_number'] = $fax_number;
$database = new database;
$extension_count = $database->select($sql, $parameters, 'column');
if ($extension_count > 0) {
//send the internal call to the registered extension
$route_array[] = "user/".$fax_number."@".$domain_name;
}
else {
$fax_status = 'failed';
}
} }
//set the origination uuid //set the origination uuid
@ -322,7 +336,9 @@
$fax_instance_id = pathinfo($fax_file, PATHINFO_FILENAME); $fax_instance_id = pathinfo($fax_file, PATHINFO_FILENAME);
//set the fax status //set the fax status
$fax_status = 'sending'; if (empty($fax_status)) {
$fax_status = 'sending';
}
//update the database to say status to trying and set the command //update the database to say status to trying and set the command
$array['fax_queue'][0]['fax_queue_uuid'] = $fax_queue_uuid; $array['fax_queue'][0]['fax_queue_uuid'] = $fax_queue_uuid;