[Freeswitch-users] how to catch DTMF in Lua while a phrase macro is playing
Michael Jerris
mike at jerris.com
Sat Aug 8 13:16:39 PDT 2009
use the SayPhrase method of sessin instead of executing the phrase
application then your input callback should work as expected.
Mike
On Aug 8, 2009, at 11:15 AM, Chad Phillips -- Apartment Lines wrote:
> in a lua script, i've tried using session:setInputCallback() to catch
> DTMF tones while a phrase macro is playing, but it doesn't seem to
> work. the same callback _does_ catch DTMF when i use
> session:streamFile() to play something. is there some other way to do
> it?
>
> below is an example of how i'm doing it now. when voicemail/vm-
> mailbox_full.wav plays, i see key presses being printed to the
> console, but when the phrase plays, no key presses are displayed.
>
> function key_press(session, input_type, data)
> if input_type == "dtmf" then
> freeswitch.consoleLog("info", "Key pressed: " .. data["digit"] ..
> "\n")
> end
> end
>
> if session:ready() then
> session:answer()
> session:execute("sleep", "1000")
> session:setInputCallback("key_press", "")
> session:streamFile("voicemail/vm-mailbox_full.wav")
> session:execute("phrase", "voicemail_menu,1:2:3:#")
> end
More information about the FreeSWITCH-users
mailing list