Create a Call
Use this endpoint for the Calls method to create a new call.
Parameters
Parameter | Description |
---|---|
ApplicationSid required*if Url is not present | The unique identifier of the application used to handle the call. |
From Required | The number that initiated the call. |
To Required | The number that received the call. |
Url required*if ApplicationSid is not present | The URL of the call. |
CallerId Optional | The number, in E.164 format, or identifier of the caller. |
FallbackMethod Optional | Whether the request to FallbackUrl is a GET or a POST . Default is POST . If ApplicationSid is present, this parameter is ignored. |
FallbackUrl Optional | The URL SignalWire will request if errors occur when fetching the Url . If ApplicationSid is present, this parameter is ignored. |
MachineDetection Optional | Whether a human or machine picked up the call. Possible values are Enable , DetectMessageEnd and none . |
AsyncAmd Optional | Whether or not to execute machine detection asynchronously. Possible values are true or false . Default is false . |
AsyncAmdStatusCallback Optional | The URL to request when the machine detection is completed. This parameter is ignored if AsyncAmd is false . |
AsyncAmdStatusCallbackMethod Optional | Whether the request to AsyncAmdStatusCallback is a GET or a POST . Default is POST . |
MachineDetectionSilenceTimeout Optional | Number of milliseconds to wait for initial voice before giving up. Must be at least 2000 to a maximum of 10000 . Default is 5000 milliseconds. |
MachineDetectionSpeechThreshold Optional | How many milliseconds of voice to decide if it is a machine. If a voice is detected for longer than this value, it is interpreted as a machine. Must be at least 1000 to a maximum of 6000 . Default is 2400 milliseconds. |
MachineDetectionSpeechEndThreshold Optional | Number of milliseconds of silence before speech is considered finished. Must be at least 500 to a maximum of 5000 . Default is 1200 milliseconds. |
MachineDetectionTimeout Optional | The time SignalWire will wait for machine detection before timing out. Default is 30 seconds. |
MachineWordsThreshold Optional | How many words counted to decide if it is a machine. If more words than this value are counted, it is interpreted as a machine. Must be at least one to a maximum of 100 . Default is 6 . |
MaxPricePerMinute Optional | The maximum price in USD acceptable for the call to be created. If the cost to create the call is calculated at greater than MaxPricePerMinute , the call will not be created and error 30010 : MaxPricePerMinute was exceeded. This call's cost is XX. will be returned. You will not be charged. If MaxPricePerMinute is not set, all calls will be created. The price can have a maximum of four decimal places, i.e. 0.0075. |
Method Optional | Whether the request to Url is a GET or a POST . Default is POST . Ignored if ApplicationSid is present. |
Record Optional | Whether or not to record a call. Possible values are true or false . Default is false . |
RecordingChannels Optional | The number of channels in the recording. Can be mono (both legs of call recorded under one channel into one recording file) or dual (each leg of call recorded in separate channels into one recording file). |
RecordingStatusCallback Optional | The URL to request to when recording is available. |
RecordingStatusCallbackEvent Optional | The different recording statuses. Possible values are completed , in-progress , and absent . To specify multiple events, separate with a space. Defaults to completed . |
RecordingStatusCallbackMethod Optional | Whether the request to RecordingStatusCallback URL is a GET or a POST . Default is POST . |
RecordingTrack Optional | Specifies whether to record the inbound audio to SignalWire from the called party or the outbound audio from SignalWire to the called party or both the inbound and outbound audio. Defaults to both . |
SipAuthUsername Optional | The username to authenticate the caller when making an outbound SIP call. |
SipAuthPassword Optional | The password to authenticate the caller when making an outbound SIP call. |
SendDigits Optional | The digits to press after a call is connected. Possible values are (0-9) , # , * , and w . Each w gives a 0.5 second pause before moving on to the next instruction. |
StatusCallback Optional | The URL SignalWire will send webhooks to on every requested StatusCallbackEvent event. |
StatusCallbackEvent Optional | The status events that trigger a SignalWire webhook. Possible values are initiated , ringing , answered , and completed . To specify multiple events, specify each one in a separate parameter of the same name. Default is completed . |
StatusCallbackMethod Optional | Whether the request to StatusCallback URL is a GET or a POST . Default is POST . Ignored if ApplicationSid is present. |
Timeout Optional | The time SignalWire will wait before assuming the call has no answer. Max wait time is 600 seconds. Default is 60 seconds. |
Trim Optional | Whether leading and trailing silence is trimmed from a recording. Possible values are trim-silence and do-not-trim . Default is trim-silence . |
Request
- cURL
- Node.js
- C#
- Python
- Ruby
curl https://example.signalwire.com/api/laml/2010-04-01/Accounts/{AccountSid}/Calls.json \
-X POST \
--data-urlencode "Url=http://your-application.com/docs/voice.xml" \
--data-urlencode "To=+13105678901" \
--data-urlencode "From=+13103384645" \
-u "YourProjectID:YourAuthToken"
const { RestClient } = require('@signalwire/compatibility-api')
const client = RestClient('YourProjectID', 'YourAuthToken', { signalwireSpaceUrl: 'example.signalwire.com' })
client.calls
.create({
url: 'http://your-application.com/docs/voice.xml',
to: '+13105678901',
from: '+13103384645'
})
.then(call => console.log(call.sid))
.done();
using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
class Program
{
static void Main(string[] args)
{
TwilioClient.Init("YourProjectID", "YourAuthToken", new Dictionary<string, object> { ["signalwireSpaceUrl"] = "{SPACE}.signalwire.com" });
var call = CallResource.Create(
url: new Uri("http://your-application.com/docs/voice.xml"),
to: new Twilio.Types.PhoneNumber("+13105678901"),
from: new Twilio.Types.PhoneNumber("+13103384645")
);
Console.WriteLine(call.Sid);
}
}
from signalwire.rest import Client as signalwire_client
client = signalwire_client("YourProjectID", "YourAuthToken", signalwire_space_url = 'example.signalwire.com')
call = client.calls.create(
url='http://your-application.com/docs/voice.xml',
to='+13105678901',
from_='+13103384645'
)
print(call.sid)
require 'signalwire/sdk'
@client = Signalwire::REST::Client.new 'YourProjectID', 'YourAuthToken', signalwire_space_url: "example.signalwire.com"
call = @client.calls.create(
url: 'http://your-application.com/docs/voice.xml',
to: '+13105678901',
from: '+13103384645'
)
puts call.sid
Responses
200 OK
{
"account_sid": "b3877c40-da60-4998-90ad-b792e98472af",
"annotation": null,
"answered_by": null,
"api_version": "2010-04-01",
"caller_name": null,
"date_created": "Wed, 19 Sept 2018 20:00:00 +0000",
"date_updated": "Thur, 20 Sept 2018 10:00:00 +0000",
"direction": "inbound",
"duration": "20",
"end_time": "Fri, 21 Sept 2018 10:00:00 +0000",
"forwarded_from": "+13102259067",
"from": "+13103384645",
"from_formatted": "(310) 338-4645",
"group_sid": "b3877c40-da60-4998-90ad-b792e98472pg",
"parent_call_sid": "b3877c40-da60-4998-90ad-b792e98472pa",
"phone_number_sid": "b3877c40-da60-4998-90ad-b792e98472ph",
"price": -0.02000,
"price_unit": "USD",
"sid": "b3877c40-da60-4998-90ad-b792e98472pa",
"start_time": "Wed, 19 Sept 2018 20:00:01 +0000",
"status": "completed",
"subresource_uris": {
"notifications": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af/Calls/b3877c40-da60-4998-90ad-b792e98472pa/Notifications.json",
"recordings": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af/Calls/b3877c40-da60-4998-90ad-b792e98472pa/Recordings.json",
"feedback": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af/Calls/b3877c40-da60-4998-90ad-b792e98472pa/Feedback.json",
"feedback_summaries": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af/Calls/FeedbackSummary.json"
},
"to": "+13105678901",
"to_formatted": "(310) 567-8901",
"uri": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472af/Calls/b3877c40-da60-4998-90ad-b792e98472pa.json",
"url": "http://your-application.com/docs/voice.xml"
}