我正在使用Lua编写一个IVR,并希望在两者之间运行xml脚本
这是运行IVR的Lua代码我正在使用Lua编写一个IVR,并希望在两者之间运行xml脚本,xml,lua,freeswitch,ivr,Xml,Lua,Freeswitch,Ivr,这是运行IVR的Lua代码 i = 0 j = 0 while (session:ready() == true) do session:setAutoHangup(false); repeat digits = session:playAndGetDigits(1, 3, 3, 3000, "#", "/var/sipxdata/mediaserver/data/ivrscript/sampleIvrS1test/prompts/Corporate.wav", "shout:
i = 0
j = 0
while (session:ready() == true) do
session:setAutoHangup(false);
repeat
digits = session:playAndGetDigits(1, 3, 3, 3000, "#", "/var/sipxdata/mediaserver/data/ivrscript/sampleIvrS1test/prompts/Corporate.wav", "shout://translate.google.com/translate_tts?tl=en&q=This+option+is+not+valid", "\\d+");
if ( digits == "1") then
repeat
digits = session:playAndGetDigits(1, 3, 3, 3000, "#", "/var/sipxdata/mediaserver/data/ivrscript/sampleIvrS1test/prompts/coral_converted.wav","shout://translate.google.com/translate_tts?tl=en&q=This+option+is+not+valid", "\\d+");
if (digits == "1") then
language = "de"
session:execute("set","transfer_ringback=$${us-ring}");
session:execute("bridge","sofia/clixxo.co.in/208@10.161.17.112");
session:hangup();
destroy(0);
elseif (digits == "2") then
language = "de"
session:execute("set","transfer_ringback=$${us-ring}");
session:execute("bridge","sofia/clixxo.co.in/101@10.161.17.112");
session:hangup();
destroy(0);
else
language = "de"
session:execute("set","transfer_ringback=$${us-ring}");
session:execute("bridge","sofia/clixxo.co.in/200@10.161.17.112");
session:hangup();
destroy(0);
end
until j == 2
end
until i == 5
end
如果用户按下数字3,我想运行以下xml代码的功能。它可以通过LuaXML解析器实现,但我不知道如何实现
<permission>
<name>900Dialing</name>
<label>900Dialing</label>
<defaultValue>false</defaultValue>
<type>CALL</type>
<builtIn>true</builtIn>
</permission>
900拨号
900拨号
假的
呼叫
真的
Centos已经有了XPAT xml解析器,但我不知道如何使用它?您可以从
mod_Perl
运行Perl脚本,方法与使用Lua相同。它的开销要大一点,但是Perl的所有优点都在这里。另外,最灵活的方法是使用事件套接字库并控制来自外部应用程序的调用。在这种情况下,您有更广泛的编程语言选择。请正确缩进您的代码。我只能使用Lua,因为我使用的代码位于Freeswitch服务器中,该服务器支持xml或Lua进行IVR确认。