Ruby Quickstart: Initiating calls

Before you start

This tutorial assumes you have a Ruby development environment with Sinatra and the twilio-ruby helper library. If you don't have these yet, please see our post on setting up your environment.

To initiate a new outgoing phone call, we need to specify three things:

  • From: the Caller ID Twilio will display to the recipient of the call.
  • To: the phone number you wish to call.
  • Url: this is the URL where Twilio can find instructions about what to do when the call connects.

Lets take a look at these parameters in a little more detail.

The From Parameter

The 'From' parameter must be set to one of your Twilio Numbers or to a phone number that you have verified with Twilio.

If you don't have a Twilio Number yet, or you want to use a different number for the caller ID, you can verify a number on the Phone Numbers page of your account.

The To Parameter

The 'To' parameter is the phone number you wish to call. It should be formatted with a '+' and country code e.g., +16175551212. '1' is the international country code for the US and Canada, and the '+' formats the number in E.164, the phone number standard used by Twilio.

Please see the international calling FAQ for more information on formatting international phone numbers, and the international pricing page for calling rates to destinations around the world.

The Url Parameter

The final parameter is the HTTP URL of the TwiML file that Twilio will fetch when the call is answered.

Next: Lets make the call already! »

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.