Skip to content

Instantly share code, notes, and snippets.

@eric
Created September 22, 2008 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eric/12162 to your computer and use it in GitHub Desktop.
Save eric/12162 to your computer and use it in GitHub Desktop.
Example tutorial for collecting DTMF keypad digits while using text-to-speech
# Example tutorial for collecting DTMF keypad digits while using
# text-to-speech (TTS). Tested on Cloudvox via AGI (Asterisk's
# phone call API) and Adhearsion Ruby library.
default {
execute 'swift', "%p" % "Please enter a number and we will tell you what it is when we are done talking."
# See if our talking was interrupted by DTMF, and if so, grab the digit
nums = variable('SWIFT_DTMF')
if nums.nil? || nums.length < 1
# This would generally be replaced with calling "input(1)" in Adhearsion
execute 'Read', 'userconfirm||1|skip|2|2'
nums = variable('userconfirm')
end
execute 'swift', '%p' % "You entered: #{nums}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment