繁体   English   中英

星号vs freeswitch配置

[英]asterisk vs freeswitch configuration

以下是用lua编写的用于freeswitch的IVR。 我没有复制整个IVR,只是复制了文件开头的一部分。

 session:set_tts_parms("flite", "kar");
    session:speak("Welcome to the VoIP World!");
    while(session:ready() == true) do
            session:speak("to go to the next level, press 1");
            session:speak("to hear my voice some more, press 2");
            session:speak("to go to the default IVR demo, press 5");
            session:speak("to exit, press 9");
            digits = session:getDigits(1, "", 3000);
            freeswitch.consoleLog("info", "Got dtmf: ".. digits .."\n");



if (digits == "1") then
                --next level stuff
                session:speak("you selected 1");
                while(session:ready() == true) do
                        session:speak("to hear me speak, press 1");
                        session:speak("to go back to the previous menu, press 2");
                        session:speak("to exit, press 9");
                    digits = session:getDigits(1, "", 3000);
                    freeswitch.consoleLog("info", "Got dtmf, level2: ".. digits .."\n");
                    if (digits == "1") then
                            session:speak("Some people will tell you that life is good");
                    elseif (digits == "2") then
                            break;
                    elseif (digits == "9") then
                            session:hangup();
                    end
            end
    elseif (digits == "2") then
            session:speak("What a Ride!");

我还使用拨号计划为星号服务器编写了一个IVR(只是一个示例,不一定相同)。

[incoming]
exten => 123,1,Answer()
 same => n(menuprompt),Background(main-menu)

exten => 1,1,Playback(digits/1)
 same => n,Goto(menuprompt)

exten => 2,1,Playback(digits/2)
 same => n,Goto(menuprompt)

exten => 9,1,Hangup()

[main-menu]
exten => n(menuprompt),Background(main-menu)

exten => 3,1,Playback(digits/3)
 same => n,Goto(menuprompt)

exten => 4,1,Playback(digits/4)
 same => n,Goto(menuprompt)

exten => 9,1,Hangup()

现在我的问题是要在功能上模拟上面的lua代码,我是否需要一些胶水代码还是上面的IVR是否足够。如果我在一台SIP服务器中编写IVR并从SIP电话拨号到该SIP服务器,它将播放菜单。 我正在尝试了解体系结构,似乎缺少一些部分。感谢您的帮助。

您很亲密,但不完全是。

将上下文视为物理盒子。 您不能穿过盒子里的墙。 因此,“标签”(就像您的n(menuprompt))和扩展名仅适用于该特定框/上下文中的内容。

在[传入]上下文中,您对“ Goto(menuprompt)”的调用将引用[传入]上下文中的“(menuprompt)”标签。

在[main-menu]上下文中,您对“ Goto(menuprompt)”的调用将引用[main-menu]上下文中的“(menuprompt)”标签。

“ n”优先级是一种构造,表示“在此上下文中此扩展名比先前的优先级高一倍”。

因此,拨号计划的最大问题是您有一个新的上下文[主菜单],但没有初始分机号。 所以你

exten => n(menuprompt),Background(main-menu)

...是“死”代码。 它没有任何作用,因为没有与之关联的扩展名。

因此,要修复您的代码,您需要执行以下操作

exten => 1,1,Playback(digits/1)
 same => n,Goto(main-menu,3,1)

...以便能够从[传入]跳转到[主菜单]。 要跳回去,您将进行相反的操作。

进一步阅读: https : //wiki.asterisk.org/wiki/display/AST/Contexts,+Extensions,+and+Priorities

我看不出为什么您需要两台具有相同功能的IVR服​​务器的原因。 在您的Asterisk拨号计划中,您可以制定规则将呼叫转发到FreeSWITCH,然后您的Asterisk用户将在那里连接。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM