Skip to content
Andrew Benton edited this page Jul 18, 2011 · 11 revisions

Documentation: TwiML

TwiML support is based on the builder library. You can construct a TwiML response like this:

# Build up a response
response = Twilio::TwiML::Response.new do |r|
  r.Say 'hello there', :voice => 'woman'
  r.Dial :callerId => '+14159992222' do |d|
    d.Conference '1234'
  end
end

# The following will print:
#   <?xml version="1.0" encoding="UTF-8"?>
#   <Response>
#     <Say voice="woman">hello there</Say>
#     <Dial callerId="+14159992222">
#       <Conference>1234</Conference>
#     </Dial>
#  </Response>
puts response.text
Clone this wiki locally