capturing dtmf codes

3 views
Skip to first unread message

Jose Gavine Cueto

unread,
Apr 14, 2015, 2:33:10 AM4/14/15
to liverpie...@googlegroups.com
Hi,

What is the most straightforward way for capturing dtmf codes ?
Currently, I do the following;

1. playback, expect for execute complete
2. handle execute complete
3. send silence, expect for dtmf
4. handle dtmf
4. and then repeat #3-4 until desired number of digits is captured

Sometimes this works, sometimes not, few issues I observed;

1.  dtmf codes were nil
2.  #3-4 is just so hacky

Cheers

alexand...@gmail.com

unread,
Apr 14, 2015, 3:07:16 AM4/14/15
to liverpie...@googlegroups.com
Hi,

You can do a "read" like this (in Ruby)

msg = send_msg "read", "0 10 ivr/8000/ivr-enter_ext.wav extno 10000 #,*"

Then you wait for CHANNEL_EXECUTION_COMPLETE.

Yes, it's possible to simulate a noop like this:

fs_render 'api sleep 1', 'content_type', 'api/response'

That, and the contents of the fs_render and send_msg methods, in the Rails example here: http://www.liverpie.com/examples.html#rails

I think using the Freeswitch command "read", like shown before, is better than playback followed by digit-by-digit processing, but the latter may have some advantages (you can make decisions quicker; if you already know where to take the user after he's keyed in two digits, no point waiting for the others, like you have to with "read").

As for nil DTMF codes, that's something I've never encountered. But, to be honest, I haven't used Liverpie in 6 years, and Freeswitch may have changed some things in their API, in the meantime. You should investigate by having Liverpie in debug mode and looking for lines that start with "Sending DTMF ". Basically, if Liverpie detects an inband DTMF from Freeswitch, it will call the webapp with whatever Freeswitch populated the "dtmf_digit" variable. No idea why that should be nil, though, without access to all logs.
Reply all
Reply to author
Forward
0 new messages