Class: Twilio::TwiML::VoiceResponse
- Defined in:
- lib/twilio-ruby/twiml/voice_response.rb
Overview
Voice TwiML Response
Instance Attribute Summary
Attributes inherited from TwiML
Instance Method Summary collapse
- 
  
    
      #dial(number: nil, action: nil, method: nil, timeout: nil, hangup_on_star: nil, time_limit: nil, caller_id: nil, record: nil, trim: nil, recording_status_callback: nil, recording_status_callback_method: nil, **keyword_args) {|dial| ... } ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create a <Dial> element. 
- 
  
    
      #echo(**keyword_args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create an <Echo> element. 
- 
  
    
      #enqueue(name, action: nil, method: nil, wait_url: nil, wait_url_method: nil, workflow_sid: nil, **keyword_args) {|enqueue| ... } ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create an <Enqueue> element. 
- 
  
    
      #gather(action: nil, method: nil, timeout: nil, finish_on_key: nil, num_digits: nil, partial_result_callback: nil, partial_result_callback_method: nil, language: nil, hints: nil, barge_in: nil, acknowledge_sound_url: nil, **keyword_args) {|gather| ... } ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create a <Gather> element. 
- 
  
    
      #hangup  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create a <Hangup> element. 
- 
  
    
      #initialize {|_self| ... } ⇒ VoiceResponse 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    Create a new <Response>. 
- 
  
    
      #leave  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create a <Leave> element. 
- 
  
    
      #pause(length: nil)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create a <Pause> element. 
- 
  
    
      #play(url: nil, loop: nil, digits: nil, **keyword_args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create a <Play> element. 
- 
  
    
      #record(action: nil, method: nil, timeout: nil, finish_on_key: nil, max_length: nil, play_beep: nil, trim: nil, recording_status_callback: nil, recording_status_callback_method: nil, transcribe: nil, transcribe_callback: nil, **keyword_args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create a <Record> element. 
- 
  
    
      #redirect(url, method: nil, **keyword_args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create a <Redirect> element. 
- 
  
    
      #reject(reason: nil, **keyword_args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create a <Reject> element. 
- 
  
    
      #say(body, loop: nil, language: nil, voice: nil, **keyword_args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create a <Say> element. 
- 
  
    
      #sms(body, to: nil, from: nil, method: nil, action: nil, status_callback: nil, **keyword_args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Create a <Sms> element. 
Methods inherited from TwiML
#append, to_lower_camel_case, #to_s, #xml
Constructor Details
#initialize {|_self| ... } ⇒ VoiceResponse
Create a new <Response>
| 6 7 8 9 10 | # File 'lib/twilio-ruby/twiml/voice_response.rb', line 6 def initialize super() @name = 'Response' yield(self) if block_given? end | 
Instance Method Details
#dial(number: nil, action: nil, method: nil, timeout: nil, hangup_on_star: nil, time_limit: nil, caller_id: nil, record: nil, trim: nil, recording_status_callback: nil, recording_status_callback_method: nil, **keyword_args) {|dial| ... } ⇒ Object
Create a <Dial> element
Parameters:
- number
- 
phone number to dial 
- action
- 
action URL 
- method
- 
action HTTP method 
- timeout
- 
time to wait for answer 
- hangup_on_star
- 
hangup call on * press 
- time_limit
- 
max time length 
- caller_id
- 
caller ID to display 
- record
- 
record the call 
- trim
- 
trim the recording 
- recording_status_callback
- 
status callback URL 
- recording_status_callback_method
- 
status callback URL method 
- keyword_args
- 
additional attributes 
Returns:
A <Response> element with a <Dial> child element
| 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | # File 'lib/twilio-ruby/twiml/voice_response.rb', line 30 def dial( number: nil, action: nil, method: nil, timeout: nil, hangup_on_star: nil, time_limit: nil, caller_id: nil, record: nil, trim: nil, recording_status_callback: nil, recording_status_callback_method: nil, **keyword_args ) dial = Dial.new( number: number, action: action, method: method, timeout: timeout, hangup_on_star: hangup_on_star, time_limit: time_limit, caller_id: caller_id, record: record, trim: trim, recording_status_callback: recording_status_callback, recording_status_callback_method: recording_status_callback_method, **keyword_args ) yield(dial) if block_given? append(dial) end | 
#echo(**keyword_args) ⇒ Object
Create an <Echo> element
Parameters:
- keyword_args
- 
attributes 
Returns:
A <Response> element with an <Echo> child element
| 71 72 73 | # File 'lib/twilio-ruby/twiml/voice_response.rb', line 71 def echo(**keyword_args) append(Echo.new(**keyword_args)) end | 
#enqueue(name, action: nil, method: nil, wait_url: nil, wait_url_method: nil, workflow_sid: nil, **keyword_args) {|enqueue| ... } ⇒ Object
Create an <Enqueue> element
Parameters:
- name
- 
friendly name 
- action
- 
action URL 
- method
- 
action URL method 
- wait_url
- 
wait URL 
- wait_url_method
- 
wait URL method 
- workflow_sid
- 
TaskRouter workflow SID 
- keyword_args
- 
additional attributes 
Returns:
A <Response> element with an <Enqueue> child element
| 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | # File 'lib/twilio-ruby/twiml/voice_response.rb', line 88 def enqueue( name, action: nil, method: nil, wait_url: nil, wait_url_method: nil, workflow_sid: nil, **keyword_args ) enqueue = Enqueue.new( name, action: action, method: method, wait_url: wait_url, wait_url_method: wait_url_method, workflow_sid: workflow_sid, **keyword_args ) yield(enqueue) if block_given? append(enqueue) end | 
#gather(action: nil, method: nil, timeout: nil, finish_on_key: nil, num_digits: nil, partial_result_callback: nil, partial_result_callback_method: nil, language: nil, hints: nil, barge_in: nil, acknowledge_sound_url: nil, **keyword_args) {|gather| ... } ⇒ Object
Create a <Gather> element
Parameters:
- action
- 
action URL 
- method
- 
action URL method 
- timeout
- 
time to wait while gathering input 
- finish_on_key
- 
finish on key press 
- num_digits
- 
digits to collect 
- partial_result_callback
- 
callback url 
- partial_result_callback_method
- 
callback method 
- language
- 
locale string 
- hints
- 
speech recognition hints 
- barge_in
- 
stop playing media upon speech 
- acknowledge_sound_url
- 
url to hit when sound starts 
- keyword_args
- 
additional attributes 
Returns:
A <Response> element with a <Gather> child element
| 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | # File 'lib/twilio-ruby/twiml/voice_response.rb', line 130 def gather( action: nil, method: nil, timeout: nil, finish_on_key: nil, num_digits: nil, partial_result_callback: nil, partial_result_callback_method: nil, language: nil, hints: nil, barge_in: nil, acknowledge_sound_url: nil, **keyword_args ) gather = Gather.new( action: action, method: method, timeout: timeout, finish_on_key: finish_on_key, num_digits: num_digits, partial_result_callback: partial_result_callback, partial_result_callback_method: partial_result_callback_method, language: language, hints: hints, barge_in: , acknowledge_sound_url: acknowledge_sound_url, **keyword_args ) yield(gather) if block_given? append(gather) end | 
#hangup ⇒ Object
Create a <Hangup> element
Returns:
A <Response> element with a <Hangup> child element
| 168 169 170 | # File 'lib/twilio-ruby/twiml/voice_response.rb', line 168 def hangup append(Hangup.new) end | 
#leave ⇒ Object
Create a <Leave> element
Returns:
A <Response> element with a <Leave> child element
| 176 177 178 | # File 'lib/twilio-ruby/twiml/voice_response.rb', line 176 def leave append(Leave.new) end | 
#pause(length: nil) ⇒ Object
Create a <Pause> element
Parameters:
- length
- 
time in seconds to pause 
Returns:
A <Response> element with a <Pause> child element
| 187 188 189 | # File 'lib/twilio-ruby/twiml/voice_response.rb', line 187 def pause(length: nil) append(Pause.new(length: length)) end | 
#play(url: nil, loop: nil, digits: nil, **keyword_args) ⇒ Object
Create a <Play> element
Parameters:
- url
- 
url to play 
- loop
- 
times to loop 
- digits
- 
play DTMF tones during a call 
- keyword_args
- 
additional attributes 
Returns:
A <Response> element with a <Play> child element
| 201 202 203 204 205 206 207 208 | # File 'lib/twilio-ruby/twiml/voice_response.rb', line 201 def play(url: nil, loop: nil, digits: nil, **keyword_args) append(Play.new( url: url, loop: loop, digits: digits, **keyword_args )) end | 
#record(action: nil, method: nil, timeout: nil, finish_on_key: nil, max_length: nil, play_beep: nil, trim: nil, recording_status_callback: nil, recording_status_callback_method: nil, transcribe: nil, transcribe_callback: nil, **keyword_args) ⇒ Object
Create a <Record> element
Parameters:
- action
- 
action URL 
- method
- 
action URL method 
- timeout
- 
timeout for recording 
- finish_on_key
- 
finish recording on key 
- max_length
- 
max length to record 
- play_beep
- 
play beep 
- trim
- 
trim the recording 
- recording_status_callback
- 
status callback for the recordings 
- recording_status_callback_method
- 
status callback method 
- transcribe
- 
transcribe the recording 
- transcribe_callback
- 
transcribe callback URL 
- keyword_args
- 
additional attributes 
Returns:
A <Response> element with a <Record> child element
| 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | # File 'lib/twilio-ruby/twiml/voice_response.rb', line 228 def record( action: nil, method: nil, timeout: nil, finish_on_key: nil, max_length: nil, play_beep: nil, trim: nil, recording_status_callback: nil, recording_status_callback_method: nil, transcribe: nil, transcribe_callback: nil, **keyword_args ) append(Record.new( action: action, method: method, timeout: timeout, finish_on_key: finish_on_key, max_length: max_length, play_beep: play_beep, trim: trim, recording_status_callback: recording_status_callback, recording_status_callback_method: recording_status_callback_method, transcribe: transcribe, transcribe_callback: transcribe_callback, **keyword_args )) end | 
#redirect(url, method: nil, **keyword_args) ⇒ Object
Create a <Redirect> element
Parameters:
- url
- 
redirect URL 
- method
- 
redirect method 
- keyword_args
- 
additional attributes 
Returns:
A <Response> element with a <Redirect> child element
| 267 268 269 | # File 'lib/twilio-ruby/twiml/voice_response.rb', line 267 def redirect(url, method: nil, **keyword_args) append(Redirect.new(url, method: method, **keyword_args)) end | 
#reject(reason: nil, **keyword_args) ⇒ Object
Create a <Reject> element
Parameters:
- reason
- 
rejection reason 
- keyword_args
- 
additional attributes 
Returns:
A <Response> element with a <Reject> child element
| 279 280 281 | # File 'lib/twilio-ruby/twiml/voice_response.rb', line 279 def reject(reason: nil, **keyword_args) append(Reject.new(reason: reason, **keyword_args)) end | 
#say(body, loop: nil, language: nil, voice: nil, **keyword_args) ⇒ Object
Create a <Say> element
Parameters:
- body
- 
message body 
- loop
- 
times to loop 
- language
- 
language of message 
- voice
- 
voice to use 
- keyword_args
- 
additional attributes 
Returns:
A <Response> element with a <Say> child element
| 294 295 296 297 298 299 300 301 302 | # File 'lib/twilio-ruby/twiml/voice_response.rb', line 294 def say(body, loop: nil, language: nil, voice: nil, **keyword_args) append(Say.new( body, loop: loop, language: language, voice: voice, **keyword_args )) end | 
#sms(body, to: nil, from: nil, method: nil, action: nil, status_callback: nil, **keyword_args) ⇒ Object
Create a <Sms> element
Parameters:
- body
- 
body of message 
- to
- 
to phone number 
- from_
- 
from phone number 
- method
- 
action URL method 
- action
- 
action URL 
- status_callback
- 
status callback URL 
- keyword_args
- 
additional attributes 
Returns:
A <Response> element with a <Sms> child element
| 317 318 319 320 321 322 323 324 325 326 327 | # File 'lib/twilio-ruby/twiml/voice_response.rb', line 317 def sms(body, to: nil, from: nil, method: nil, action: nil, status_callback: nil, **keyword_args) append(Sms.new( body, to: to, from: from, method: method, action: action, status_callback: status_callback, **keyword_args )) end |