To make a call, submit a POST request to the Calls resource.
makes this very easy to do. Open a file called
make_call.rb and write the
require 'rubygems' # not necessary with ruby 1.9 but included for completeness require 'twilio-ruby' # put your own credentials here - from twilio.com/user/account account_sid = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy' # set up a client to talk to the Twilio REST API @client = Twilio::REST::Client.new account_sid, auth_token @call = @client.account.calls.create( :from => '+14159341234', # From your Twilio number :to => '+18004567890', # To any number # Fetch instructions from this URL when the call connects :url => 'http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient' )
Lets look at the details:
By default, your application does not get any notification when a call is
complete, if the line is busy, or if no one answers. To get notifications about
the status of a call, add the
:status_callback parameter to the
create method. The full list of parameters that can be passed is available in
the Calls API Documentation.
When the call is complete, or if the line is busy or no one answers, Twilio
will make a request to the URL you specify in the