FreeSwitch Lua Welcome IVR

IVR(Interactive Voice Response),交互式语音应答系统

预备知识:

  • mod_lua
  • mod_flite ,也可以是 mod_cepstral


步骤一:配置拨号计划

在拨号计划(dialplan)中配置extensions调用LUA脚本——welecome.lua

welcome.xml(freeswitch/conf/dialplan/default/welcome.xml)


  
    
       
    
  

步骤二:LUA脚本

welcome.lua(freeswitch/scripts/welcome.lua)

session:answer();
while (session:ready() == true) do
    session:setAutoHangup(false);
    session:set_tts_params("flite", "kal");
    session:speak("Welcome. Welcome to the VoIp World!. this is a Blind Users Programing Community. powered by Freeswitch, 
                   the free ultimate PBX. thank to toni!");
    session:sleep(100);
    session:speak("please select an Action.");
    session:sleep(100);
    session:speak("to call the conference, press 1");
    session:sleep(100);
    session:speak("to call Freeswitch IVR, press 2");
    session:sleep(100);
    session:speak("to call Voice Mail, press 3");
    session:sleep(100);
    session:speak("for Music on hold, press 4");
    session:sleep(100);
    session:speak("to call me, press 0");
    session:sleep(3000);
    digits = session:getDigits(1, "", 3000);
    if (digits == "1")  then
        session:execute("transfer","9888");
    end
    if (digits == "2")  then
        session:execute("transfer","5000");
    end
    if (digits == "3")  then
        session:execute("transfer","4000");
    end
    if (digits == "4")  then
        session:execute("transfer","9999");
    end
    if (digits == "0")  then
        session:execute("transfer","[email protected]");
    end
end
注意:

1.需要取消激活枚举,即将99999XX.xml改成9999XX.xml.noload或者其他不同于原名字即可

(官网上信息可能有误,仅在源码中找到相关文件,编译后的文件未找到)

2.不要同时加载mod_flite和mod_cepstral


翻译出处:https://freeswitch.org/confluence/display/FREESWITCH/Lua+Welcome+IVR+example

你可能感兴趣的:(freeSwitch,LUA)