mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Add voicemail record-silence-threshold variable and change the default threshold from 30 to 300.
This commit is contained in:
@@ -78,6 +78,10 @@
|
|||||||
if (not vm_disk_quota) then
|
if (not vm_disk_quota) then
|
||||||
vm_disk_quota = session:getVariable("vm_disk_quota");
|
vm_disk_quota = session:getVariable("vm_disk_quota");
|
||||||
end
|
end
|
||||||
|
record_silence_threshold = session:getVariable("record-silence-threshold");
|
||||||
|
if (not record_silence_threshold) then
|
||||||
|
record_silence_threshold = 300;
|
||||||
|
end
|
||||||
voicemail_authorized = session:getVariable("voicemail_authorized");
|
voicemail_authorized = session:getVariable("voicemail_authorized");
|
||||||
if (not vm_message_ext) then vm_message_ext = 'wav'; end
|
if (not vm_message_ext) then vm_message_ext = 'wav'; end
|
||||||
|
|
||||||
|
|||||||
@@ -63,11 +63,10 @@
|
|||||||
--prepare to record the greeting
|
--prepare to record the greeting
|
||||||
if (session:ready()) then
|
if (session:ready()) then
|
||||||
max_len_seconds = 30;
|
max_len_seconds = 30;
|
||||||
silence_threshold = 30;
|
|
||||||
silence_seconds = 5;
|
silence_seconds = 5;
|
||||||
mkdir(voicemail_dir.."/"..voicemail_id);
|
mkdir(voicemail_dir.."/"..voicemail_id);
|
||||||
-- syntax is session:recordFile(file_name, max_len_secs, silence_threshold, silence_secs)
|
-- syntax is session:recordFile(file_name, max_len_secs, silence_threshold, silence_secs)
|
||||||
result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".tmp.wav", max_len_seconds, silence_threshold, silence_seconds);
|
result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".tmp.wav", max_len_seconds, record_silence_threshold, silence_seconds);
|
||||||
--session:execute("record", voicemail_dir.."/"..uuid.." 180 200");
|
--session:execute("record", voicemail_dir.."/"..uuid.." 180 200");
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -143,10 +143,9 @@
|
|||||||
--save the recording
|
--save the recording
|
||||||
-- syntax is session:recordFile(file_name, max_len_secs, silence_threshold, silence_secs)
|
-- syntax is session:recordFile(file_name, max_len_secs, silence_threshold, silence_secs)
|
||||||
max_len_seconds = 300;
|
max_len_seconds = 300;
|
||||||
silence_threshold = 30;
|
|
||||||
silence_seconds = 5;
|
silence_seconds = 5;
|
||||||
if (storage_path == "http_cache") then
|
if (storage_path == "http_cache") then
|
||||||
result = session:recordFile(storage_path.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext, max_len_seconds, silence_threshold, silence_seconds);
|
result = session:recordFile(storage_path.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext, max_len_seconds, record_silence_threshold, silence_seconds);
|
||||||
else
|
else
|
||||||
mkdir(voicemail_dir.."/"..voicemail_id);
|
mkdir(voicemail_dir.."/"..voicemail_id);
|
||||||
if (vm_message_ext == "mp3") then
|
if (vm_message_ext == "mp3") then
|
||||||
@@ -154,10 +153,10 @@
|
|||||||
if (shout_exists == "true") then
|
if (shout_exists == "true") then
|
||||||
freeswitch.consoleLog("notice", "using mod_shout for mp3 encoding\n");
|
freeswitch.consoleLog("notice", "using mod_shout for mp3 encoding\n");
|
||||||
--record in mp3 directly
|
--record in mp3 directly
|
||||||
result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".mp3", max_len_seconds, silence_threshold, silence_seconds);
|
result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".mp3", max_len_seconds, record_silence_threshold, silence_seconds);
|
||||||
else
|
else
|
||||||
--create initial wav recording
|
--create initial wav recording
|
||||||
result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav", max_len_seconds, silence_threshold, silence_seconds);
|
result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav", max_len_seconds, record_silence_threshold, silence_seconds);
|
||||||
--use lame to encode, if available
|
--use lame to encode, if available
|
||||||
if (file_exists("/usr/bin/lame")) then
|
if (file_exists("/usr/bin/lame")) then
|
||||||
freeswitch.consoleLog("notice", "using lame for mp3 encoding\n");
|
freeswitch.consoleLog("notice", "using lame for mp3 encoding\n");
|
||||||
@@ -176,7 +175,7 @@
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext, max_len_seconds, silence_threshold, silence_seconds);
|
result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext, max_len_seconds, record_silence_threshold, silence_seconds);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user