Use fax_email from the fax table for the mail to address.

And add additional condition for fax_queue enabled.
This commit is contained in:
FusionPBX 2022-04-30 23:50:50 -06:00 committed by GitHub
parent eeba3eb66f
commit 0e4e379b14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -282,7 +282,6 @@ if (!function_exists('fax_split_dtmf')) {
//$destination_number = $tmp_array[1]; //$destination_number = $tmp_array[1];
//unset($tmp_array); //unset($tmp_array);
} }
$mail_to_address = $fax_email;
//get the fax file name (only) if a full path //get the fax file name (only) if a full path
$fax_path = pathinfo($fax_file); $fax_path = pathinfo($fax_file);
@ -339,6 +338,7 @@ if (!function_exists('fax_split_dtmf')) {
$fax_forward_number = $row["fax_forward_number"]; $fax_forward_number = $row["fax_forward_number"];
$fax_description = $row["fax_description"]; $fax_description = $row["fax_description"];
$fax_email_inbound_subject_tag = $row['fax_email_inbound_subject_tag']; $fax_email_inbound_subject_tag = $row['fax_email_inbound_subject_tag'];
$mail_to_address = $fax_email;
} }
unset($sql, $parameters, $row); unset($sql, $parameters, $row);
@ -383,7 +383,7 @@ if (!function_exists('fax_split_dtmf')) {
echo "fax_forward_number: $fax_forward_number\n"; echo "fax_forward_number: $fax_forward_number\n";
//add fax to the fax queue or send it directly //add fax to the fax queue or send it directly
if ($_SESSION['fax_queue']['enabled']['boolean']) { if ($_SESSION['fax_queue']['enabled']['boolean'] == 'true') {
//build an array to add the fax to the queue //build an array to add the fax to the queue
$array['fax_queue'][0]['fax_queue_uuid'] = uuid(); $array['fax_queue'][0]['fax_queue_uuid'] = uuid();
$array['fax_queue'][0]['domain_uuid'] = $domain_uuid; $array['fax_queue'][0]['domain_uuid'] = $domain_uuid;
@ -617,7 +617,7 @@ if (!function_exists('fax_split_dtmf')) {
// failed_fax_emails.sh - this is created when we have a email we need to re-send. At the time it is created, an at job is created to execute it in 3 minutes time, // failed_fax_emails.sh - this is created when we have a email we need to re-send. At the time it is created, an at job is created to execute it in 3 minutes time,
// this allows us to try sending the email again at that time. If the file exists but there is no at job this is because there are no longer any emails queued // this allows us to try sending the email again at that time. If the file exists but there is no at job this is because there are no longer any emails queued
// as we have successfully sent them all. // as we have successfully sent them all.
if (strlen($fax_email) > 0 && file_exists($fax_file)) { if ($_SESSION['fax_queue']['enabled']['boolean'] != 'true' && strlen($fax_email) > 0 && file_exists($fax_file)) {
if (stristr(PHP_OS, 'WIN')) { if (stristr(PHP_OS, 'WIN')) {
//not compatible with windows //not compatible with windows
} }
@ -644,6 +644,7 @@ if (!function_exists('fax_split_dtmf')) {
$tmp_response = exec("chmod 777 ".$_SESSION['server']['temp']['dir']."/failed_fax_emails.sh"); $tmp_response = exec("chmod 777 ".$_SESSION['server']['temp']['dir']."/failed_fax_emails.sh");
//note we use batch in order to execute when system load is low. Alternatively this could be replaced with AT. //note we use batch in order to execute when system load is low. Alternatively this could be replaced with AT.
$tmp_response = exec("at -f ".$_SESSION['server']['temp']['dir']."/failed_fax_emails.sh now + 3 minutes"); $tmp_response = exec("at -f ".$_SESSION['server']['temp']['dir']."/failed_fax_emails.sh now + 3 minutes");
} }
} }
} }