Voicemail-to-Email: Domain Settings fix.
This commit is contained in:
parent
5f20080c66
commit
aaca2bb47c
|
|
@ -73,6 +73,9 @@
|
|||
ob_end_clean();
|
||||
ob_start();
|
||||
|
||||
//message divider for log file
|
||||
echo "\n\n======================================================================================================================================================================================\n\n";
|
||||
|
||||
//testing show the raw email
|
||||
//echo "Message: \n".$msg."\n";
|
||||
|
||||
|
|
@ -99,6 +102,7 @@
|
|||
// 'SkipBody' => 1,
|
||||
);
|
||||
$success = $mime->Decode($parameters, $decoded);
|
||||
unset($parameters);
|
||||
|
||||
if (!$success) {
|
||||
echo "MIME message decoding error: ".HtmlSpecialChars($mime->error)."\n";
|
||||
|
|
@ -142,7 +146,7 @@
|
|||
}
|
||||
$smtp['host'] = (strlen($_SESSION['email']['smtp_host']['text'])?$_SESSION['email']['smtp_host']['text']:'127.0.0.1');
|
||||
if (isset($_SESSION['email']['smtp_port'])) {
|
||||
$smtp['port'] = (int)$_SESSION['email']['smtp_port']['numeric'];
|
||||
$smtp['port'] = (int) $_SESSION['email']['smtp_port']['numeric'];
|
||||
}
|
||||
else {
|
||||
$smtp['port'] = 0;
|
||||
|
|
@ -162,12 +166,11 @@
|
|||
}
|
||||
|
||||
// overwrite with domain-specific smtp server settings, if any
|
||||
if ($headers["X-FusionPBX-Domain-UUID"] != '') {
|
||||
if (is_uuid($headers["X-FusionPBX-Domain-UUID"])) {
|
||||
$sql = "select domain_setting_subcategory, domain_setting_value ";
|
||||
$sql .= "from v_domain_settings ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and (domain_setting_category = 'email' or domain_setting_category = 'voicemail') ";
|
||||
$sql .= "and domain_setting_name = 'text' ";
|
||||
$sql .= "and domain_setting_enabled = 'true' ";
|
||||
$parameters['domain_uuid'] = $headers["X-FusionPBX-Domain-UUID"];
|
||||
$database = new database;
|
||||
|
|
@ -192,7 +195,7 @@
|
|||
include_once "resources/phpmailer/class.smtp.php";
|
||||
$mail = new PHPMailer();
|
||||
if (isset($_SESSION['email']['method'])) {
|
||||
switch($_SESSION['email']['method']['text']) {
|
||||
switch ($_SESSION['email']['method']['text']) {
|
||||
case 'sendmail': $mail->IsSendmail(); break;
|
||||
case 'qmail': $mail->IsQmail(); break;
|
||||
case 'mail': $mail->IsMail(); break;
|
||||
|
|
@ -273,7 +276,7 @@
|
|||
|
||||
//get the attachments and add to the email
|
||||
if ($success) {
|
||||
foreach ($decoded[0][Parts] as &$parts_array) {
|
||||
foreach ($decoded[0]["Parts"] as &$parts_array) {
|
||||
$content_type = $parts_array["Parts"][0]["Headers"]["content-type:"];
|
||||
//image/tiff;name="testfax.tif"
|
||||
//text/plain; charset=ISO-8859-1; format=flowed
|
||||
|
|
@ -294,7 +297,7 @@
|
|||
$file_name = substr($file, 0, (strlen($file) - strlen($file_ext))-1 );
|
||||
$encoding = "base64"; //base64_decode
|
||||
|
||||
switch($file_ext){
|
||||
switch ($file_ext){
|
||||
case "wav":
|
||||
$mime_type = "audio/x-wav";
|
||||
break;
|
||||
|
|
@ -317,11 +320,12 @@
|
|||
|
||||
//add an attachment
|
||||
$mail->AddStringAttachment($parts_array["Body"],$file,$encoding,$mime_type);
|
||||
if (function_exists(get_transcription)) {
|
||||
if (function_exists('get_transcription')) {
|
||||
$attachments_array = $mail->GetAttachments();
|
||||
$transcription = get_transcription($attachments_array[0]);
|
||||
echo "Transcription: " . $transcription;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$transcription = '';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue