Created
January 27, 2012 15:56
-
-
Save scpike/1689441 to your computer and use it in GitHub Desktop.
Handle phone input with twilio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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