Making and Receiving Phone Calls
In this guide we are going to show how to make and receive phone calls using the following products:
- SWML
- SWML Script
- Compatibility API
- REST APIs
- cXML Bins
Prerequisites
To be able to make calls, you will need:
- a SignalWire phone number
- your API credentials (Space URL, Project ID, and API token)
Also, note that if your account is in trial mode, you'll need to upgrade it in order to call numbers other than your own verified numbers. See How to exit Trial Mode.
To acquire a phone number, Log in to your SignalWire Space. From the Phone Numbers section, you can buy a new phone number. You will need at least one number to make and receive calls.
For what concerns your API credentials, find these in the API section of your Space, as shown in the following figure. You may need to create a new token if you never used one. Make sure that your token has the "Voice" scope enabled.

You can find your Project ID and Token from the API tab in your SignalWire Space. Make sure your token has the 'Voice' scope enabled.
If your account was created prior to January 2025, your Dashboard may be on the Legacy UI.
SWML
Receiving incoming calls
To handle incoming calls we need to configure the phone number in our SignalWire Space to answer calls using a SWML Script.
- New Dashboard
- Legacy Dashboard
To create a SWML Script in the new UI, go to the "Resources" section from the sidebar, and create a new Resource. In the new resource picker, select "Script" and create a "SWML Application".

If you are using the Legacy UI, go to the "Relay/SWML" section in your sidebar, then click on the "SWML Scripts" tab. Click on "Create a SWML Script", and then give it a name and pass it some instructions. You can use the following as a starting point:

- YAML
- JSON
version: 1.0.0
sections:
main:
- play: say:Hello from SignalWire!
{
"version": "1.0.0",
"sections": {
"main": [
{
"play": "say:Hello from SignalWire!"
}
]
}
}
Take note of the Request URL for the SWML Script that we created. You can even create a new script if you want to define a different behavior for incoming calls.
To configure your number to handle incoming calls with an SWML Script, click the "Phone Numbers" section within your SignalWire Space, and edit the settings of the specific number you would like to use to answer calls. Set "Handle calls using" to "a SWML Script", then select your SWML Script from the dropdown:
That's it! Inbound calls to this SignalWire number will execute the specified SWML Script.
Compatibility API
Making your first call
You now have all you need to make your first call, for example to your personal phone number.
We want to call a number and play an audio message which says "Welcome to SignalWire. This is my first call". We are going to define this behavior in a cXML bin, which is used to declare what should happen during a call.
- New Dashboard
- Legacy Dashboard
If you're on the new UI, go to the "Resources" section from the sidebar, and create a new Resource. In the new resource picker, select "Script" and create a "cXML script".

If you're on the Legacy UI, go to the "cXML/LaML" section in your SignalWire Space, then click on "Bins", and create a new script.

Create a new bin, and paste the following XML in it:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Welcome to SignalWire. This is my first call.</Say>
</Response>
The XML above uses the <Say> verb to play a text-to-speech message. Save the bin and take note of its Request URL.
You are now ready to start the call using cURL:
curl -L -X POST 'https://{SpaceName}.signalwire.com/api/laml/2010-04-01/Accounts/{ProjectID}/Calls' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: application/json' \
-u '{ProjectID}:{APIToken}' \
--data-urlencode 'Url=https://{BinRequestURL}' \
--data-urlencode 'From={+XXXXXXXXXX}' \
--data-urlencode 'To={+YYYYYYYYYY}'
Make sure to replace all occurrences of {SpaceName}
, {ProjectID}
,
{APIToken}
, {BinRequestURL}
, {+XXXXXXXXXX}
, and {+YYYYYYYYYY}
with
your actual values.
Instead of your own bin, feel free to try one of ours: <https://<spacename>.signalwire.com/laml-bins/f85376be-7fe1-439b-a24f-3113ff980804>
.
Congratulations! Once the cURL request is executed, your personal phone number
({+YYYYYYYYYY}
) will start ringing.
Receiving incoming calls
- New Dashboard
- Legacy Dashboard
To handle incoming calls we need to configure the phone number in our SignalWire Space to answer calls using a cXML resource.
If you're on the new UI, go to the "Phone Numbers" section from the sidebar, and edit the phone number you want to answer calls from. There, click on the "Assign Resource" button for incoming calls, and select the cXML or SWML script you'd like to connect.

To handle incoming calls we need to configure the phone number in our SignalWire Space to answer calls using a SWML or cXML script.
Take note of the Request URL for the bin that we created in the previous section. You can even create a new bin if you want to define a different behavior for incoming calls.
Click the "Phone Numbers" section from your sidebar, and select the specific number you would like to use to answer calls. The same number we used before can work.
Make sure that "Accept Calls As" is set to "Voice Calls", "Handle Calls Using" is set to "LaML Webhooks" or "SWML Scripts", and paste your Bin URL in as the value for "When a Call Comes In". Click "Save", and you're done! Inbound calls to this SignalWire number will execute the specified bin.

Wrapping up
cXML bins allow you to program the behavior of phone calls, and REST APIs make it easy to trigger calls to any phone number. Find the documentation for our Compatibility API (XML and REST) here.
As we have seen, REST APIs are easy to get started with. In case you need more flexibility and real-time control on your calls, you may be interested in our guide about how to make and receive calls in Node.js.