How to Send an Outbound Call and Play a Message

In all the previous guides, we showed different methods of handling inbound calls to your SignalWire numbers. This guide will show the opposite - how to create an outbound call using SignalWire numbers and play an appointment reminder message for the callee when they connect.

How to Send an Outbound Call

In this example, we will show how you can Create a Call using cURL. This is a simple HTTP request to SignalWire servers that includes a few key values.

To send a message, you must have the following included

  • a From number from your SignalWire account (purchased or verified)
  • a To number to route the call correctly
  • a URL
  • your authentication string "Your-Project-ID:Your-Auth-Token"

The URL can point to an XML code document containing detailed instructions hosted on your server, or more simply, you can use an XML Bin! This example will show how to use an XML Bin URL to play a simple appointment reminder.

When you run the curl code below on your command line interface or use a browser based curl command tool, make sure to replace the placeholders with your own space domain, project ID, auth token, from number, to number, and XML Bin URL!

curl --request POST \
     --url https://{Your-Space-Domain}.signalwire.com/api/laml/2010-04-01/Accounts/{Your-Project-ID}/Calls \
     --header 'Accept: application/json' \
     ---u "YourProjectID:YourAuthToken" \
     --header 'Content-Type: application/x-www-form-urlencoded' \
     --data 'From=+12223334444' \
     --data 'To=+18887776666' \
     --data Url=https://{Your-Space-Domain}.signalwire.com/laml-bins/{xml-bin-url}

How to Configure the Bin to Play a Message

Playing a message is a breeze using <Say> for text to speech. Add a snippet about what you want to say and nest it within the <Say> tags.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Hello! This is your dentist's office calling you about your upcoming appointment. You have a crown repair scheduled for September 1st, 2021 with Doctor Crentist. If you would like to cancel or reschedule this appointment, please call our office at 111-111-1111. Thank you, and have a good day. Goodbye!
</Say>
</Response>

When you save your bin, you will see a paper stack icon next to the URL. Click this to easily copy your URL and paste it into your cURL command!

You're now able to make easy outbound calls by executing a simple cURL command!


Did this page help you?