Phil Nash edited this page Jul 24, 2017 · 9 revisions

This document is not intended to be a guide to all TwiML Verbs and Nouns and their attributes. Consult the official TwiML documentation for the complete reference.

You can construct a TwiML response like this:

require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new do |r|
  r.say('hello there', voice: 'alice')
  r.dial(caller_id: '+14159992222') do |d|
    d.client 'jenny'
  end
end

# print the result
puts response.to_s

This will print the following (except for the whitespace):

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say voice="alice">hello there</Say>
  <Dial callerId="+14159992222">
    <Client>jenny</Client>
  </Dial>
</Response>
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.