Search code examples
sipvoipasteriskfreeswitchsip-server

asterisk vs freeswitch configuration


Below is an IVR that has been written in lua for freeswitch. I have not copied the whole IVR, just some portion from the start of the file.

 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!");

I have also written an IVR (just an example not necessarily the same) for asterisk server using dial plan,that is given below.

[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()

Now my question to emulate the lua code above in functionality do I need some glue code or is the IVR above enough.If I program an IVR in one SIP server and dial from a sip phone to that sip server will it play the menu. I am trying to understanding the architecture and seem to be missing some portions.Any help is appreciated.


Solution

  • I don't see a reason why you would need two IVR servers with the same functionality. In your Asterisk dialplan, you can make a rule to forward the call to FreeSWITCH, and then your Asterisk users would be connected there.