[Freeswitch-dev] lua problems
I want to receive dtmf events I have problems with the following code. con = freeswitch.EventConsumer("all") session:setVariable("playback_terminators", "0123456789") session:execute("playback", "/usr/local/freeswitch/sounds/SAMPLE.wav") while (session:ready()) do for e in (function() return con:pop(1) end) do event_name = e:getHeader("Event-Name") or "" if(event_name == "DTMF") then print("have DTMF") print(e:getHeader("DTMF-Digit")) end end end I thought con:pop should work like on esl_recv_event however in this case after the first incoming dtmf it freezes? It does not respond on further key presses. On some instances the console has printed two entries when I am sure I only press the key once. have DTMF 8 have DTMF 8 I saw a posting online about the adding optional timeout parameter to pop. Has this been offically implemented because I get an error when using it like con:pop(1, 6000) 2012-04-02 13:42:50.643708 [ERR] mod_lua.cpp:191 Error in pop expected 1..2 args, got 3 stack traceback: [C]: in function 'pop' /usr/local/freeswitch/scripts/aprompt.lua:11: in function '(for generator)' /usr/local/freeswitch/scripts/aprompt.lua:11: in main chunk I have not found esl_recv_event_timed function in lua. If it does not exit in lua what is correct the equivilent way? On a further note is Session.collectInput going to be available in lua?
participants (1)
-
adam harris