Method: Twilio::Verb#dial
- Defined in:
- lib/twilio/verb.rb
#dial(*args, &block) ⇒ Object
The Dial verb connects the current caller to an another phone. If the called party picks up, the two parties are connected and can communicate until one hangs up. If the called party does not pick up, if a busy signal is received, or the number doesn’t exist, the dial verb will finish.
If an action verb is provided, Twilio will submit the outcome of the call attempt to the action URL. If no action is provided, Dial will fall through to the next verb in the document.
Note: this is different than the behavior of Record and Gather. Dial does not submit back to the current document URL if no action is provided.
Options (see www.twilio.com/docs/api_reference/TwiML/dial) are passed in as a hash
Examples:
Twilio::Verb.dial '415-123-4567'
Twilio::Verb.dial '415-123-4567', :action => 'http://foobar.com'
Twilio::Verb.dial '415-123-4567', :timeout => 10, :callerId => '858-987-6543'
Twilio also supports an alternate form in which a Number object is nested inside Dial:
verb = Twilio::Verb.new { |v|
v.dial { |v|
v.number '415-123-4567'
v.number '415-123-4568'
v.number '415-123-4569'
}
}
verb.response # represents the final xml output
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/twilio/verb.rb', line 198 def dial(*args, &block) number_to_dial = '' = {} args.each do |arg| case arg when String number_to_dial = arg when Hash .merge!(arg) else raise ArgumentError, 'dial expects String or Hash argument' end end output { if block_given? @xml.Dial() { block.call } else @xml.Dial(number_to_dial, ) end } end |