Skip to content

Instantly share code, notes, and snippets.

@chrismetcalf
Created October 28, 2010 19:47
Show Gist options
  • Save chrismetcalf/652184 to your computer and use it in GitHub Desktop.
Save chrismetcalf/652184 to your computer and use it in GitHub Desktop.
King County Tree Disposal Line - Greeting
answer
sleep(2)
say "Welcome to the King County Christmas Tree Recycling Line."
# Setting up our options for "ask". We accept 5 digits, either spoken or entered
# by DTMF, and time out after 10 seconds.
zipcode_options = { :choices => "[5 DIGITS]",
:repeat => 3,
:timeout => 10,
:onBadChoice => lambda { say 'Invalid entry, please try again.' },
:onTimeout => lambda { say 'Timeout, please try again.' },
:onChoice => lambda { |zip| lookup_facilities(zip.value) }
}
ask 'Enter or say your ZIP code to find a Christmas tree facility in your area.', zipcode_options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment