您的位置:首页 > 编程语言 > Lua

FreeSwitch Lua Welcome IVR

2016-07-12 16:48 1746 查看
IVR(Interactive Voice Response),交互式语音应答系统

预备知识:

mod_lua
mod_flite ,也可以是 mod_cepstral

步骤一:配置拨号计划

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

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

<include>
<extension name="welcome_ivr">
<condition field="destination_number" expression="^2910$">
<action application="lua" data="welcome.lua"/>
</condition>
</extension>
</include>


步骤二: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","voipaware@sip.voipuser.org");
end
end
注意:

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

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

2.不要同时加载mod_flite和mod_cepstral

翻译出处:https://freeswitch.org/confluence/display/FREESWITCH/Lua+Welcome+IVR+example
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  LUA C API freeSWITCH