I am writing an IVR using Lua and want to run xml script in between

477 views Asked by At

This is the Lua code which runs IVR

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/[email protected]");
    session:hangup();
    destroy(0);



  elseif (digits == "2")  then

    language = "de"
    session:execute("set","transfer_ringback=$${us-ring}");
    session:execute("bridge","sofia/clixxo.co.in/[email protected]");
    session:hangup();
    destroy(0);




else
    language = "de"
    session:execute("set","transfer_ringback=$${us-ring}");
    session:execute("bridge","sofia/clixxo.co.in/[email protected]");
    session:hangup();
    destroy(0);



end




until j == 2
end
until i == 5




end

I want to run the functionality of following xml code if digit 3 will pressed by the user. It can achieved by Lua xml Parser but I don't know how?

<permission>
<name>900Dialing</name>
<label>900Dialing</label>
<defaultValue>false</defaultValue>
<type>CALL</type>
<builtIn>true</builtIn>
</permission>

Centos already has XPAT xml Parser but I don't know how to use it?

1

There are 1 answers

1
Stanislav Sinyagin On

you can run a Perl script from mod_perl the same way as you use Lua. It's a bit bigger overhead, but you have all the goodies of Perl for you. Also the most flexible way is to use the Event Socket library and control the call from an external application. In this case, you have a much broader choice of programming languages.