Sending xml to Twilio in Rails
I'm spiking on a rails app to make calls using twilio. I'm using the twilio gem but when twilio hits my app to get the xml it blows up as there is nothing in the body of the response. It calls my phone but says error in the app.
def index
Twilio.connect('ac开发者_JS百科count sid', 'auth token')
Twilio::Call.make('from number', 'to number', 'url')
end
def show
@verb = Twilio::Verb.new { |v|
v.say "The time is #{Time.now}"
v.hangup
}
respond_to do |format|
format.xml {render :xml => verb.response}
end
end
And here is the error on twilio site.
Response: What your web application responded with to Twilio HTTP Headers:
Key ValueX-Runtime 0.011953
X-Ua-Compatible IE=Edge,chrome=1
Transfer-Encoding chunked
Date Thu, 13 Oct 2011 16:13:21 GMT
Set-Cookie _twilio_session=xxxxxxx; path=/; HttpOnly
Connection close
X-Rack-Cache invalidate, pass
Content-Type text/html; charset=utf-8
Server nginx/0.7.67
Cache-Control no-cache
Added ".xml" to the end of the url in the Call.make and it worked.
精彩评论