Create a Call
POST/calls
To create a new Call, you send a POST
request to the Call resource with a payload including a dial
command and additional nested params
.
Request
- application/json
Body
required
- Create a call with a URL
- Create a call with SWML
Possible values: [dial
]
params
object
required
anyOf
The URL to handle the call. This parameter allows you to specify a webhook or different route in your code containing SWML instructions for handling the call.
Either url
or swml
must be included for a new call.
https://example.com/swml
The address that initiated the call. Can be either a E.164 formatted number (+xxxxxxxxxxx
), or a SIP endpoint (sip:xxx@yyy.zzz
).
sip:from-sip@example-112233445566.sip.signalwire.com
The address that received the call. Can be either a E.164 formatted number (+xxxxxxxxxxx
), or a SIP endpoint (sip:xxx@yyy.zzz
).
sip:from-sip@example-112233445567.sip.signalwire.com
The number, in E.164 format, or identifier of the caller.
+1234567890
The Fallback URL to handle the call. This parameter allows you to specify a backup webhook or different route in your code containing SWML instructions for handling the call.
https://example.com/fallback
Inline SWML, passed as a string, containing SWML instructions for handling the call. Either url
or swml
must be included for a new call.
{'version': '1.0.0', 'sections': { 'main': [{ 'answer': { 'max_duration': 60 }},{ 'play': { 'urls': ['silence:2', 'say:Hello from SignalWire!']}}]}}
The address that initiated the call. Can be either a E.164 formatted number (+xxxxxxxxxxx
), or a SIP endpoint (sip:xxx@yyy.zzz
).
sip:from-sip@example-112233445566.sip.signalwire.com
The address that received the call. Can be either a E.164 formatted number (+xxxxxxxxxxx
), or a SIP endpoint (sip:xxx@yyy.zzz
).
sip:from-sip@example-112233445567.sip.signalwire.com
The number, in E.164 format, or identifier of the caller.
+1234567890
The Fallback URL to handle the call. This parameter allows you to specify a backup webhook or different route in your code containing SWML instructions for handling the call.
https://example.com/fallback
Responses
- 201
- 401
- 404
- 422
The request has succeeded and a new resource has been created as a result.
- application/json
- Schema
- Example (from schema)
Schema
Array [
]
The unique identifier of the call on SignalWire. This can be used to update the call programmatically.
3fa85f64-5717-4562-b3fc-2c963f66afa6
The origin number or address.
sip:from-sip@example-112233445566.sip.signalwire.com
The destination number or address.
sip:from-sip@example-112233445567.sip.signalwire.com
The direction of the call.
Possible values: [outbound-api
]
outbound-api
The status of the call.
Possible values: [answered
, queued
, initiated
, ringing
, ending
, ended
]
queued
The duration of the call in seconds.
60
The duration of the call in milliseconds.
60000
The billable duration of the call in seconds.
60
Source of this call.
Possible values: [realtime_api
]
realtime_api
Type of this call.
Possible values: [relay_pstn_call
, relay_sip_call
, relay_webrtc_call
]
relay_sip_call
charge
object[]
required
Details on charges associated with this call.
Description for this charge.
Charged amount.
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"from": "sip:from-sip@example-112233445566.sip.signalwire.com",
"to": "sip:from-sip@example-112233445567.sip.signalwire.com",
"direction": "outbound-api",
"status": "queued",
"duration": 60,
"duration_ms": 60000,
"billable_duration": 60,
"source": "realtime_api",
"type": "relay_sip_call",
"charge": [
{
"description": "string",
"amount": 0
}
]
}
Access is unauthorized.
- application/json
- Schema
Schema
string
Possible values: [Unauthorized
]
The server cannot find the requested resource.
- application/json
- Schema
Schema
string
Possible values: [Not Found
]
Client error
- application/json
- Schema
- Example (from schema)
Schema
Array [
]
errors
object[]
required
Error type.
Error code.
Error details.
Request parameter associated with this error.
Link to developer resource for this error.
{
"errors": [
{
"type": "validation_error",
"code": "missing_required_parameter",
"message": "url must be a valid http or https url",
"attribute": "url",
"url": "https://developer.signalwire.com/rest/signalwire-rest/overview/error-codes#http_url_required"
}
]
}