VXML Style Voice Form for Adhearsion
March 31, 2009
The Adhearsion developer community continues to create new applications and components.
And even more importantly, sharing them. The latest component addition to the line-up is a VoiceXML style Voice Form plugin for Adhearsion, created by @adzap and posted to GitHub.
You may new create your own compenent, include the Voice Form module and create extensive voice menus to your callers. Here is the classic Adhearison Simon example re-factored into a Voice Form:
class SimonGame
include VoiceForm
voice_form do
setup do
@number = ''
end
field(:attempt, :attempts => 1) do
prompt :play => :current_number, :bargein => false, :timeout => 2
setup do
@number << random_number
end
validate do
@attempt == @number
end
success do
call.play 'good'
form.restart
end
failure do
call.play %W[#{@number.length-1} times wrong-try-again-smarty]
@number = ''
form.restart
end
end
end
def random_number
rand(10).to_s
end
def current_number
as_digits(@number)
end
end
The readme and code are all available on GitHub here. Enjoy and many thanks to @adzap!
One Comment
leave one →
RSS





Thanks for the write up Jason!