Skip to content

Instantly share code, notes, and snippets.

@scpike
Created January 27, 2012 15:56
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 scpike/1689441 to your computer and use it in GitHub Desktop.
Save scpike/1689441 to your computer and use it in GitHub Desktop.
Handle phone input with twilio
def directions
if params["Digits"] == '1'
response = Twilio::TwiML::Response.new do |r|
r.Record :action => '/handle_recording'
end
elsif params["Digits"] == '2'
# Need to return immediately after a redirect
redirect_to :action => 'handle_call'
return
else
# we're unforgiving of invalid input
response = Twilio::TwiML::Response.new do |r|
r.Hangup
end
end
respond_to do |format|
format.xml { render :xml => response.text }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment