diff --git a/app/voicemails/app_defaults.php b/app/voicemails/app_defaults.php index bd7fc63bfd..a4b47bdf30 100644 --- a/app/voicemails/app_defaults.php +++ b/app/voicemails/app_defaults.php @@ -55,6 +55,19 @@ if ($domains_processed == 1) { $array[$x]['default_setting_enabled'] = 'false'; $array[$x]['default_setting_description'] = 'Define which storage type (base_64 stores in the database).'; $x++; + $array[$x]['default_setting_category'] = 'voicemail'; + $array[$x]['default_setting_subcategory'] = 'message_max_length'; + $array[$x]['default_setting_name'] = 'numeric'; + $array[$x]['default_setting_value'] = '300'; + $array[$x]['default_setting_enabled'] = 'false'; + $array[$x]['default_setting_description'] = 'Maximum length of a voicemail (in seconds).'; + $x++; + $array[$x]['default_setting_category'] = 'voicemail'; + $array[$x]['default_setting_subcategory'] = 'greeting_max_length'; + $array[$x]['default_setting_name'] = 'numeric'; + $array[$x]['default_setting_value'] = '90'; + $array[$x]['default_setting_enabled'] = 'false'; + $array[$x]['default_setting_description'] = 'Maximum length of a voicemail greeting (in seconds).'; //iterate and add each, if necessary foreach ($array as $index => $default_settings) { diff --git a/resources/install/scripts/app/voicemail/resources/functions/record_greeting.lua b/resources/install/scripts/app/voicemail/resources/functions/record_greeting.lua index 41e7d1ee09..e5b7a45588 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/record_greeting.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/record_greeting.lua @@ -25,6 +25,10 @@ --define a function to record the greeting function record_greeting(greeting_id) + local db = dbh or Database.new('system') + local settings = Settings.new(db, domain_name, domain_uuid) + + local max_len_seconds = settings:get('voicemail', 'greeting_max_length', 'numeric'); --flush dtmf digits from the input buffer session:flushDigits(); @@ -62,7 +66,6 @@ else --prepare to record the greeting if (session:ready()) then - max_len_seconds = 90; silence_seconds = 5; mkdir(voicemail_dir.."/"..voicemail_id); -- syntax is session:recordFile(file_name, max_len_secs, silence_threshold, silence_secs) diff --git a/resources/install/scripts/app/voicemail/resources/functions/record_message.lua b/resources/install/scripts/app/voicemail/resources/functions/record_message.lua index b4d0292cb1..e45e39c429 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/record_message.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/record_message.lua @@ -25,6 +25,10 @@ --save the recording function record_message() + local db = dbh or Database.new('system') + local settings = Settings.new(db, domain_name, domain_uuid) + + local max_len_seconds = settings:get('voicemail', 'message_max_length', 'numeric'); --record your message at the tone press any key or stop talking to end the recording if (skip_instructions == "true") then @@ -142,7 +146,6 @@ --save the recording -- syntax is session:recordFile(file_name, max_len_secs, silence_threshold, silence_secs) - max_len_seconds = 300; silence_seconds = 5; if (storage_path == "http_cache") then result = session:recordFile(storage_path.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext, max_len_seconds, record_silence_threshold, silence_seconds);