From 78b1ebc47d624e1ba720b9a1b983ff56d5f2c370 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 28 Jan 2026 15:25:50 -0700 Subject: [PATCH] Fix voicemail greetings file extension Steps to reproduce the issue current greeting is a wav file. The text-to-speech provider used mp3. Then it would change the file type to mp3. Moved the $speech->get_format(); to the section of code that generates the text-to-speech. So that it doesn't overwrite the file type when its not the text to speech is not being used. --- app/voicemail_greetings/voicemail_greeting_edit.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/voicemail_greetings/voicemail_greeting_edit.php b/app/voicemail_greetings/voicemail_greeting_edit.php index 0230f8c6c0..57c459e52f 100644 --- a/app/voicemail_greetings/voicemail_greeting_edit.php +++ b/app/voicemail_greetings/voicemail_greeting_edit.php @@ -60,7 +60,6 @@ if (class_exists('speech') && $speech_enabled && !empty($speech_engine)) { $speech = new speech($settings); $voices = $speech->get_voices(); - $greeting_format = $speech->get_format(); //$speech_models = $speech->get_models(); //$translate_enabled = $speech->get_translate_enabled(); //$language_enabled = $speech->get_language_enabled(); @@ -179,7 +178,8 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { $greeting_path = $settings->get('switch', 'voicemail').'/default/'.$_SESSION['domain_name'].'/'.$voicemail_id; //set the recording format - $greeting_files = glob($greeting_path.'/greeting_'.$greeting_id.'.*'); + $greeting_files = glob($greeting_path.'/greeting_*'); + if (empty($greeting_format) && !empty($greeting_files)) { $greeting_format = pathinfo($greeting_files[0], PATHINFO_EXTENSION); } else { @@ -197,7 +197,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { } } - if (!empty($greeting_id)) { + if (isset($greeting_id) && is_numeric($greeting_id)) { //set file name $greeting_filename = 'greeting_'.$greeting_id.'.'.$greeting_format; @@ -214,6 +214,12 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { //text to audio - make a new audio file from the message if ($update_greeting && $speech_enabled && !empty($greeting_voice) && !empty($greeting_message)) { + //set the greeting file format + $greeting_format = $speech->get_format(); + + //set file name + $greeting_filename = 'greeting_'.$greeting_id.'.'.$greeting_format; + $speech->audio_path = $greeting_path; $speech->audio_filename = $greeting_filename; $speech->audio_format = $greeting_format;