To make a call, submit a POST request to the Calls resource.
makes this very easy to do. Open a file called
make_call.py and write the
# Download the library from twilio.com/docs/libraries from twilio.rest import Client # Get these credentials from http://twilio.com/user/account account_sid = "ACXXXXXXXXXXXXXXXXX" auth_token = "YYYYYYYYYYYYYYYYYY" client = Client(account_sid, auth_token) # Make the call call = client.api.account.calls\ .create(to="+14085551234", # Any phone number from_="+12125551234", # Must be a valid Twilio number url="http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient") print(call.sid)
Then make the call by running the following in your Terminal:
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, include the
status_callback parameter with
your request. The full list of parameters that can be passed is available in
the twilio-python helper library 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