Create a call
POSThttps://{API_ENDPOINT}/v1/Accounts/{AccountSid}/CallsContent-Type: application/json
Authentication
Authorizationheader (bearer token, required) — Bearer authentication of the formBearer <token>, where token is your auth token.
Request
Path parameters
AccountSidstring
Body (application/json)
This endpoint expects an object.
fromstringThe calling party numbertoTargetDestination for callapplication_sidstringThe application to use to control this call. Either application_sid or call_hook is required.answerOnBridgebooleanIf set to true, the inbound call will ring until the number that was dialed answers the call, and at that point a 200 OK will be sent on the inbound leg. If false, the inbound call will be answered immediately as the outbound call is placed.call_hookWebhookcall_status_hookWebhookfromHoststringThe hostname to put in the SIP From header of the INVITEtimeoutintegerThe number of seconds to wait for call to be answered. Defaults to 60.timeLimitintegerThe max length of call in secondscodecslist of stringCodec names, in preference order, to offer on the outbound INVITE. Names are case-insensitive. When omitted the media server offers its default codecs. If any name is not supported the whole list is ignored, an error is logged and an alert is written, and default negotiation is used.tagobjectInitial set of customer-supplied metadata to associate with the call (see Wipple CPaaS 'tag' Function)headersobjectThe customer SIP headers to associate with the callsipRequestWithinDialogHookstringThe sip indialog hook to receive session messagesspeech_synthesis_vendorstringThe vendor for Text to Speech (required if application_sid is not used)speech_synthesis_languagestringThe language for Text to Speech (required if application_sid is not used)speech_synthesis_voicestringThe voice for Text to Speech (required if application_sid is not used)speech_recognizer_vendorstringThe vendor for Speech to Text (required if application_sid is not used)speech_recognizer_languagestringThe language for Speech to Text (required if application_sid is not used)amdamddual_streamsbooleanIf set to true, Wipple CPaaS generates an outbound INVITE whose SDP offer contains two audio media streams (twom=audiolines) instead of one. This is useful when the far end (for example a carrier or recording system) requires the inbound and outbound audio to be delivered on separate RTP streams. Defaults to false. Supported only when creating a call via the REST API (i.e. not available from thedialFunction).
Response
201
call successfully created
sidstring
Errors
400 Bad Request Error
bad request
any
Types
Target
typeenum- Allowed values:
phone,sip,user,teams numberstringA phone number to call (when type is phone)sipUristringA SIP URI to call (when type is sip)tenantstringMicrosoft Teams customer tenant domain name (when type is teams)trunkstringThe name of the Carrier that should be used to deliver this call (when type is phone)vmailbooleanDial directly into user's voicemail to leave a message (MS Teams only)overrideTostringA SIP URI that, if provided, will be used as the To header in the outbound INVITE (not needed in most cases)namestringThe name of a registered Wipple CPaaS user to call (when type is user)authTargetAuthproxystringSIP Proxy to use for the outgoing INVITE
Webhook
urlstringwebhook_sidstringmethodenum- Allowed values:
get,post usernamestringpasswordstring
amd
actionHookstringWebhook to send AMD events.thresholdWordCountdoubleNumber of spoken words in a greeting that result in an amd_machine_detected result.digitCountdoubleNumber of digits in a greeting to trigger a amd_machine_detected result. 0 is offtimersAmdTimers
TargetAuth
usernamestringThe username to use for SIP authentication, if challengedpasswordstringThe password to use for SIP authentication, if challenged
AmdTimers
decisionTimeoutMsdoubleTime in milliseconds to wait before returning amd_decision_timeout.greetingCompletionTimeoutMsdoubleSilence in milliseconds to wait for during greeting before returning amd_machine_stopped_speaking.noSpeechTimeoutMsdoubleTime in milliseconds to wait for speech before returning amd_no_speech_detected.toneTimeoutMsdoubleTime in milliseconds to wait to hear a tone.
Examples
Request
{
"from": "815099990001",
"to": {
"type": "phone",
"number": "+815099990003"
}
}
Response
{
"sid": "2531329f-fb09-4ef7-887e-84e648214436"
}
cURL
curl -X POST "https://{API_ENDPOINT}/v1/Accounts/AccountSid/Calls" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"from": "815099990001",
"to": {
"type": "phone",
"number": "+815099990003"
}
}'
Python
import requests
url = "https://{API_ENDPOINT}/v1/Accounts/AccountSid/Calls"
payload = {
"from": "815099990001",
"to": {
"type": "phone",
"number": "+815099990003"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
JavaScript
const url = 'https://{API_ENDPOINT}/v1/Accounts/AccountSid/Calls';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: '{"from":"815099990001","to":{"type":"phone","number":"+815099990003"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}