Fax Server changes (#7136)
* Added the ability to send out successful and failed fax notifications to a separate list of email addresses (confirmation emails), in addition to the email address of the originator of the fax. * Added new fax_email_confirmation permission * Check the Session variable for the user's email first and if it is not set, then query the database for the currently logged-in user's email.
This commit is contained in:
parent
1d5506826a
commit
4df5253b64
|
|
@ -258,6 +258,11 @@
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "fax";
|
$apps[$x]['permissions'][$y]['groups'][] = "fax";
|
||||||
|
$y++;
|
||||||
|
$apps[$x]['permissions'][$y]['name'] = "fax_email_confirmation";
|
||||||
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
|
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||||
|
$apps[$x]['permissions'][$y]['groups'][] = "fax";
|
||||||
|
|
||||||
//default settings
|
//default settings
|
||||||
$y=0;
|
$y=0;
|
||||||
|
|
@ -542,6 +547,11 @@
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
|
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||||
$z++;
|
$z++;
|
||||||
|
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "fax_email_confirmation";
|
||||||
|
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||||
|
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
|
||||||
|
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Delivery addresses for fax confirmations";
|
||||||
|
$z++;
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "fax_file";
|
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "fax_file";
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
|
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
|
||||||
|
|
|
||||||
|
|
@ -2592,6 +2592,60 @@ $text['label-email']['zh-cn'] = "电子邮件";
|
||||||
$text['label-email']['ja-jp'] = "メールアドレス";
|
$text['label-email']['ja-jp'] = "メールアドレス";
|
||||||
$text['label-email']['ko-kr'] = "이메일";
|
$text['label-email']['ko-kr'] = "이메일";
|
||||||
|
|
||||||
|
$text['label-email-confirmation']['en-us'] = "Confirmation Emails";
|
||||||
|
$text['label-email-confirmation']['en-gb'] = "Confirmation Emails";
|
||||||
|
$text['label-email-confirmation']['ar-eg'] = "";
|
||||||
|
$text['label-email-confirmation']['de-at'] = "";
|
||||||
|
$text['label-email-confirmation']['de-ch'] = "";
|
||||||
|
$text['label-email-confirmation']['de-de'] = "";
|
||||||
|
$text['label-email-confirmation']['el-gr'] = "";
|
||||||
|
$text['label-email-confirmation']['es-cl'] = "";
|
||||||
|
$text['label-email-confirmation']['es-mx'] = "";
|
||||||
|
$text['label-email-confirmation']['fr-ca'] = "";
|
||||||
|
$text['label-email-confirmation']['fr-fr'] = "";
|
||||||
|
$text['label-email-confirmation']['he-il'] = "";
|
||||||
|
$text['label-email-confirmation']['it-it'] = "";
|
||||||
|
$text['label-email-confirmation']['ka-ge'] = "";
|
||||||
|
$text['label-email-confirmation']['nl-nl'] = "";
|
||||||
|
$text['label-email-confirmation']['pl-pl'] = "";
|
||||||
|
$text['label-email-confirmation']['pt-br'] = "";
|
||||||
|
$text['label-email-confirmation']['pt-pt'] = "";
|
||||||
|
$text['label-email-confirmation']['ro-ro'] = "";
|
||||||
|
$text['label-email-confirmation']['ru-ru'] = "";
|
||||||
|
$text['label-email-confirmation']['sv-se'] = "";
|
||||||
|
$text['label-email-confirmation']['uk-ua'] = "";
|
||||||
|
$text['label-email-confirmation']['tr-tr'] = "";
|
||||||
|
$text['label-email-confirmation']['zh-cn'] = "";
|
||||||
|
$text['label-email-confirmation']['ja-jp'] = "";
|
||||||
|
$text['label-email-confirmation']['ko-kr'] = "";
|
||||||
|
|
||||||
|
$text['description-email-confirmation']['en-us'] = "List all emails that should receive notifications of successful or failed faxes";
|
||||||
|
$text['description-email-confirmation']['en-gb'] = "List all emails that should receive notifications of successful or failed faxes";
|
||||||
|
$text['description-email-confirmation']['ar-eg'] = "";
|
||||||
|
$text['description-email-confirmation']['de-at'] = "";
|
||||||
|
$text['description-email-confirmation']['de-ch'] = "";
|
||||||
|
$text['description-email-confirmation']['de-de'] = "";
|
||||||
|
$text['description-email-confirmation']['el-gr'] = "";
|
||||||
|
$text['description-email-confirmation']['es-cl'] = "";
|
||||||
|
$text['description-email-confirmation']['es-mx'] = "";
|
||||||
|
$text['description-email-confirmation']['fr-ca'] = "";
|
||||||
|
$text['description-email-confirmation']['fr-fr'] = "";
|
||||||
|
$text['description-email-confirmation']['he-il'] = "";
|
||||||
|
$text['description-email-confirmation']['it-it'] = "";
|
||||||
|
$text['description-email-confirmation']['ka-ge'] = "";
|
||||||
|
$text['description-email-confirmation']['nl-nl'] = "";
|
||||||
|
$text['description-email-confirmation']['pl-pl'] = "";
|
||||||
|
$text['description-email-confirmation']['pt-br'] = "";
|
||||||
|
$text['description-email-confirmation']['pt-pt'] = "";
|
||||||
|
$text['description-email-confirmation']['ro-ro'] = "";
|
||||||
|
$text['description-email-confirmation']['ru-ru'] = "";
|
||||||
|
$text['description-email-confirmation']['sv-se'] = "";
|
||||||
|
$text['description-email-confirmation']['uk-ua'] = "";
|
||||||
|
$text['description-email-confirmation']['tr-tr'] = "";
|
||||||
|
$text['description-email-confirmation']['zh-cn'] = "";
|
||||||
|
$text['description-email-confirmation']['ja-jp'] = "";
|
||||||
|
$text['description-email-confirmation']['ko-kr'] = "";
|
||||||
|
|
||||||
$text['label-destination-number']['en-us'] = "Destination Number";
|
$text['label-destination-number']['en-us'] = "Destination Number";
|
||||||
$text['label-destination-number']['en-gb'] = "Destination Number";
|
$text['label-destination-number']['en-gb'] = "Destination Number";
|
||||||
$text['label-destination-number']['ar-eg'] = "رقم الوجهة";
|
$text['label-destination-number']['ar-eg'] = "رقم الوجهة";
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,7 @@
|
||||||
$fax_prefix = $_POST["fax_prefix"];
|
$fax_prefix = $_POST["fax_prefix"];
|
||||||
$fax_email = implode(',',array_filter($_POST["fax_email"] ?? []));
|
$fax_email = implode(',',array_filter($_POST["fax_email"] ?? []));
|
||||||
$fax_file = $_POST["fax_file"];
|
$fax_file = $_POST["fax_file"];
|
||||||
|
$fax_email_confirmation = implode(',',array_filter($_POST["fax_email_confirmation"] ?? []));
|
||||||
$fax_email_connection_type = $_POST["fax_email_connection_type"];
|
$fax_email_connection_type = $_POST["fax_email_connection_type"];
|
||||||
$fax_email_connection_host = $_POST["fax_email_connection_host"];
|
$fax_email_connection_host = $_POST["fax_email_connection_host"];
|
||||||
$fax_email_connection_port = $_POST["fax_email_connection_port"];
|
$fax_email_connection_port = $_POST["fax_email_connection_port"];
|
||||||
|
|
@ -264,6 +265,9 @@
|
||||||
//escape the commas with a backslash and remove the spaces
|
//escape the commas with a backslash and remove the spaces
|
||||||
$fax_email = str_replace(" ", "", $fax_email);
|
$fax_email = str_replace(" ", "", $fax_email);
|
||||||
|
|
||||||
|
//escape the commas with a backslash and remove the spaces
|
||||||
|
$fax_email_confirmation = str_replace(" ", "", $fax_email_confirmation);
|
||||||
|
|
||||||
//set the $php_bin
|
//set the $php_bin
|
||||||
//if (file_exists(PHP_BINDIR."/php")) { $php_bin = 'php'; }
|
//if (file_exists(PHP_BINDIR."/php")) { $php_bin = 'php'; }
|
||||||
if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") {
|
if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") {
|
||||||
|
|
@ -335,6 +339,9 @@
|
||||||
$array['fax'][0]['fax_email'] = $fax_email;
|
$array['fax'][0]['fax_email'] = $fax_email;
|
||||||
$array['fax'][0]['fax_file'] = $fax_file;
|
$array['fax'][0]['fax_file'] = $fax_file;
|
||||||
}
|
}
|
||||||
|
if (permission_exists('fax_email_confirmation')) {
|
||||||
|
$array['fax'][0]['fax_email_confirmation'] = $fax_email_confirmation;
|
||||||
|
}
|
||||||
if (permission_exists('fax_caller_id_name')) {
|
if (permission_exists('fax_caller_id_name')) {
|
||||||
$array['fax'][0]['fax_caller_id_name'] = $fax_caller_id_name;
|
$array['fax'][0]['fax_caller_id_name'] = $fax_caller_id_name;
|
||||||
}
|
}
|
||||||
|
|
@ -429,6 +436,7 @@
|
||||||
$fax_name = $row["fax_name"];
|
$fax_name = $row["fax_name"];
|
||||||
$fax_email = $row["fax_email"];
|
$fax_email = $row["fax_email"];
|
||||||
$fax_file = $row["fax_file"];
|
$fax_file = $row["fax_file"];
|
||||||
|
$fax_email_confirmation = $row["fax_email_confirmation"];
|
||||||
$fax_caller_id_name = $row["fax_caller_id_name"];
|
$fax_caller_id_name = $row["fax_caller_id_name"];
|
||||||
$fax_caller_id_number = $row["fax_caller_id_number"];
|
$fax_caller_id_number = $row["fax_caller_id_number"];
|
||||||
$fax_toll_allow = $row["fax_toll_allow"];
|
$fax_toll_allow = $row["fax_toll_allow"];
|
||||||
|
|
@ -478,6 +486,9 @@
|
||||||
//build the fax_emails array
|
//build the fax_emails array
|
||||||
$fax_emails = explode(',', $fax_email ?? '');
|
$fax_emails = explode(',', $fax_email ?? '');
|
||||||
|
|
||||||
|
//build the fax_email_confirmations array
|
||||||
|
$fax_email_confirmations = explode(',', $fax_email_confirmation ?? '');
|
||||||
|
|
||||||
//set the dialplan_uuid
|
//set the dialplan_uuid
|
||||||
if (empty($dialplan_uuid) || !is_uuid($dialplan_uuid)) {
|
if (empty($dialplan_uuid) || !is_uuid($dialplan_uuid)) {
|
||||||
$dialplan_uuid = uuid();
|
$dialplan_uuid = uuid();
|
||||||
|
|
@ -601,7 +612,7 @@
|
||||||
if (permission_exists('fax_email')) {
|
if (permission_exists('fax_email')) {
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||||
echo " ".$text['label-email']."\n";
|
echo " ".$text['label-email_email-to-fax']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td class='vtable' align='left'>\n";
|
||||||
echo "<table border='0' cellpadding='2' cellspacing='0'>\n";
|
echo "<table border='0' cellpadding='2' cellspacing='0'>\n";
|
||||||
|
|
@ -609,13 +620,13 @@
|
||||||
foreach ($fax_emails as $email) {
|
foreach ($fax_emails as $email) {
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
echo "<td>\n";
|
echo "<td>\n";
|
||||||
echo " <input class='formfld' type=\"text\" name=\"fax_email[".$x."]\" maxlength='255' style=\"width: 90%;\"value=\"".escape($email)."\">\n";
|
echo " <input class='formfld' type=\"email\" name=\"fax_email[".$x."]\" maxlength='255' style=\"width: 90%;\"value=\"".escape($email)."\">\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
$x++;
|
$x++;
|
||||||
}
|
}
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
echo " <td>\n";
|
echo " <td>\n";
|
||||||
echo " <input class='formfld' type=\"text\" name=\"fax_email[".$x++."]\" maxlength='255' style=\"width: 90%;\"value=\"\">\n";
|
echo " <input class='formfld' type=\"email\" name=\"fax_email[".$x++."]\" maxlength='255' style=\"width: 90%;\"value=\"\">\n";
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
|
|
@ -638,6 +649,33 @@
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (permission_exists('fax_email_confirmation')) {
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||||
|
echo " ".$text['label-email-confirmation']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "<td class='vtable' align='left'>\n";
|
||||||
|
echo "<table border='0' cellpadding='2' cellspacing='0'>\n";
|
||||||
|
$x = 0;
|
||||||
|
|
||||||
|
foreach($fax_email_confirmations as $email) {
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td>\n";
|
||||||
|
echo " <input class='formfld' type=\"email\" name=\"fax_email_confirmation[".$x."]\" maxlength='255' style=\"width: 90%;\"value=\"".escape($email)."\">\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
$x++;
|
||||||
|
}
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo " <td>\n";
|
||||||
|
echo " <input class='formfld' type=\"email\" name=\"fax_email_confirmation[".$x++."]\" maxlength='255' style=\"width: 90%;\"value=\"\">\n";
|
||||||
|
echo " </td>\n";
|
||||||
|
echo "</table>\n";
|
||||||
|
echo "<br />\n";
|
||||||
|
echo " ".$text['description-email-confirmation']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (permission_exists('fax_caller_id_name')) {
|
if (permission_exists('fax_caller_id_name')) {
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||||
|
|
|
||||||
|
|
@ -673,9 +673,34 @@ if (!function_exists('fax_split_dtmf')) {
|
||||||
$parameters['fax_uuid'] = $fax_uuid;
|
$parameters['fax_uuid'] = $fax_uuid;
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$row = $database->select($sql, $parameters, 'row');
|
$row = $database->select($sql, $parameters, 'row');
|
||||||
$mail_to_address = $row["fax_email"];
|
//$mail_to_address = $row["fax_email"];
|
||||||
$fax_prefix = $row["fax_prefix"];
|
$fax_prefix = $row["fax_prefix"];
|
||||||
unset($sql, $parameters, $row);
|
unset($sql, $parameters);
|
||||||
|
|
||||||
|
//Get the currently logged in user's email
|
||||||
|
if(isset($_SESSION["user_email"])) {
|
||||||
|
$mail_to_address = $_SESSION["user_email"];
|
||||||
|
} else {
|
||||||
|
$sql = "select user_email from v_users where user_uuid = :user_uuid ";
|
||||||
|
$parameters['user_uuid'] = $user_uuid;
|
||||||
|
$database = new database;
|
||||||
|
$user_settings = $database->select($sql, $parameters, 'row');
|
||||||
|
|
||||||
|
$mail_to_address = $user_settings["user_email"];
|
||||||
|
unset($sql, $parameters, $user_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get a list of emails to send confirmation emails to, including that of the fax sender
|
||||||
|
if(!empty($row["fax_email_confirmation"])) {
|
||||||
|
$tmp_emails = explode(',', $row["fax_email_confirmation"]);
|
||||||
|
foreach ($tmp_emails as $email) {
|
||||||
|
if(strpos($mail_to_address, $email) === false) {
|
||||||
|
$mail_to_address .= ','.$email;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($row);
|
||||||
|
|
||||||
//for email to fax send email notification back to the email sender
|
//for email to fax send email notification back to the email sender
|
||||||
if ($included) {
|
if ($included) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue