diff --git a/resources/install/scripts/directory.lua b/resources/install/scripts/directory.lua index 45fcdcfef2..fe5557304e 100644 --- a/resources/install/scripts/directory.lua +++ b/resources/install/scripts/directory.lua @@ -1,6 +1,6 @@ -- directory.lua -- Part of FusionPBX --- Copyright (C) 2012 Mark J Crane +-- Copyright (C) 2012-2016 Mark J Crane -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -13,7 +13,7 @@ -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- --- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +-- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, @@ -79,10 +79,6 @@ end end ---debug - debug["info"] = false; - debug["sql"] = false; - --prepare the api object api = freeswitch.API(); @@ -195,9 +191,18 @@ dtmf_digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", sounds_dir.."/voicemail/vm-press.wav", "", "\\d+"); end if (string.len(dtmf_digits) == 0) then - digit_timeout = "3000"; dtmf_digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", sounds_dir.."/digits/1.wav", "", "\\d+"); end + if (string.len(dtmf_digits) == 0) then + dtmf_digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", sounds_dir.."/directory/dir-for_next.wav", "", "\\d+"); + end + if (string.len(dtmf_digits) == 0) then + dtmf_digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", sounds_dir.."/voicemail/vm-press.wav", "", "\\d+"); + end + if (string.len(dtmf_digits) == 0) then + digit_timeout = "5000"; + dtmf_digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", sounds_dir.."/digits/6.wav", "", "\\d+"); + end return dtmf_digits; end @@ -260,17 +265,19 @@ session:streamFile(file_location); else --announce the first and last names - if (speak_mod ~= nil and speak_voice ~= nil) then - session:execute("speak",speak_mod.."|"..speak_voice.."|"..row.first_name); - else - session:execute("say", "en name_spelled iterated "..row.first_name); + if (row.first_name ~= nil and row.first_name ~= '') then + if (speak_mod ~= nil and speak_voice ~= nil) then + session:execute("speak", speak_mod.."|"..speak_voice.."|"..row.first_name); + else + session:execute("say", default_language.." name_spelled iterated "..row.first_name); + end end --session:execute("sleep", "500"); - if (row.last_name ~= nil) then + if (row.last_name ~= nil and row.last_name ~= '') then if (speak_mod ~= nil and speak_voice ~= nil) then - session:execute("speak",speak_mod.."|"..speak_voice.."|"..row.last_name); + session:execute("speak", speak_mod.."|"..speak_voice.."|"..row.last_name); else - session:execute("say", "en name_spelled iterated "..row.last_name); + session:execute("say", default_language.." name_spelled iterated "..row.last_name); end end end @@ -289,28 +296,30 @@ session:streamFile(voicemail_dir.."/"..row.extension.."/recorded_name.wav"); else --announce the first and last names - if (speak_mod ~= nil and speak_voice ~= nil) then - session:execute("speak",speak_mod.."|"..speak_voice.."|"..row.first_name); - else - session:execute("say", "en name_spelled iterated "..row.first_name); + if (row.first_name ~= nil and row.first_name ~= '') then + if (speak_mod ~= nil and speak_voice ~= nil) then + session:execute("speak",speak_mod.."|"..speak_voice.."|"..row.first_name); + else + session:execute("say", default_language.." name_spelled iterated "..row.first_name); + end end - if (row.last_name ~= nil) then + if (row.last_name ~= nil and row.last_name ~= '') then --session:execute("sleep", "500"); if (speak_mod ~= nil and speak_voice ~= nil) then session:execute("speak",speak_mod.."|"..speak_voice.."|"..row.last_name); else - session:execute("say", "en name_spelled iterated "..row.last_name); + session:execute("say", default_language.." name_spelled iterated "..row.last_name); end end end end --announce the extension number - if (row.directory_exten_visible == "false") then + --if (row.directory_exten_visible == "false") then --invisible extension number - else + if (row.extension ~= nil and row.extension ~= '' and row.directory_exten_visible == "true") then session:streamFile(sounds_dir.."/directory/dir-at_extension.wav"); - session:execute("say", "en number iterated "..row.extension); + session:execute("say", default_language.." NAME_SPELLED iterated "..row.extension); end --select this entry press 1