Initiate an outbound call
In order to create an outbound call from a voice channel you can use this request. You can set a callFlow with commands to be executed after call is answered.
POST
/workspaces/{workspaceId}/channels/{channelId}/calls
Create a channel call
Cuerpo de la solicitud
from
string
to
string
obligatorio
ringTimeout
integer
maxDuration
integer
sendKeys
string
record
boolean
recordStart
string
Possible values: record-from-answer, record-from-ringing
flowStart
string
Possible values: from-answer, from-ringing
stereo
boolean
callFlow
array of object
Mostrar parámetros secundarios
callFlow.command
string
Possible values: hangup, playback, say, gather, record, bridge, pause
callFlow.conditions
array of object
Mostrar parámetros secundarios
callFlow.conditions.variable
string
Possible values: keys, speech
callFlow.conditions.operator
string
Possible values: eq, ne, ==, !=, contains
callFlow.conditions.value
string
callFlow.options
object
Mostrar parámetros secundarios
callFlow.options.media
array of string
obligatorio
callFlow.options.loop
integer
callFlow.options.timeout
integer
callFlow.options.pauseMilliseconds
integer
callFlow.options.command
Value: say
callFlow.options.command
Value: gather
callFlow.options.command
Value: hangup
callFlow.options.command
Value: pause
scheduledFor
string
notification
object
Mostrar parámetros secundarios
notification.url
string
amdSettings
object
Mostrar parámetros secundarios
amdSettings.enabled
boolean
obligatorio
amdSettings.wordCount
number
obligatorio
amdSettings.speechTimeout
number
obligatorio
amdSettings.speechLocale
string
obligatorio
Possible values: de-DE, en-AU, en-GB, en-US, es-US, it-IT, ja-JP, ko-KR, pt-BR, th-TH, zh-CN
amdSettings.beepTimeout
number
amdSettings.ifMachineNotifyAfter
string
obligatorio
Possible values: beep, wordCount
tags
array of string
Tags to associate with the call. Tags are converted to lower case and tags
that do not exist are automatically created. You can view your created tags
in the UI. You can specify up to 10 tags per call.
Cuerpo de la respuesta
id
string
obligatorio
channelId
string
obligatorio
from
string
obligatorio
to
string
obligatorio
originator
object
obligatorio
Mostrar atributos secundarios
originator.contact
object
Mostrar atributos secundarios
originator.contact.id
string
obligatorio
originator.contact.identifierKey
string
obligatorio
originator.contact.identifierValue
string
obligatorio
originator.number
object
obligatorio
Mostrar atributos secundarios
originator.number.type
string
obligatorio
Possible values: pstn, sip, webrtc
originator.number.number
string
obligatorio
originator.number.anonymous
boolean
originator.number.callerIdName
string
originator.number.identity
string
originator.number.countryIsoCode
string
originator.number.pstnNumberType
string
receiver
object
obligatorio
Mostrar atributos secundarios
receiver.contact
object
Mostrar atributos secundarios
receiver.contact.id
string
obligatorio
receiver.contact.identifierKey
string
obligatorio
receiver.contact.identifierValue
string
obligatorio
receiver.number
object
obligatorio
Mostrar atributos secundarios
receiver.number.type
string
obligatorio
Possible values: pstn, sip, webrtc
receiver.number.number
string
obligatorio
receiver.number.anonymous
boolean
receiver.number.callerIdName
string
receiver.number.identity
string
receiver.number.countryIsoCode
string
receiver.number.pstnNumberType
string
parentId
string
direction
string
obligatorio
Possible values: incoming, outgoing
status
string
obligatorio
Possible values: accepted, starting, ringing, ongoing, completed, busy, no-answer, failed, cancelled, scheduled
reason
string
type
string
obligatorio
Possible values: pstn, sip, webrtc
duration
integer
hangupCauseCode
integer
hangupSource
string
Possible values: callee, caller, api, timeout, media-timeout, none
hangupSipCode
string
createdAt
string
obligatorio
updatedAt
string
obligatorio
ringingAt
string
answeredAt
string
endedAt
string
scheduledFor
string
callFlow
object
Mostrar atributos secundarios
callFlow.id
string
callFlow.commands
array of object
Mostrar atributos secundarios
callFlow.commands.id
string
callFlow.commands.callId
string
callFlow.commands.callFlowId
string
callFlow.commands.status
string
callFlow.commands.command
string
callFlow.commands.conditions
array of object
Mostrar atributos secundarios
callFlow.commands.conditions.variable
string
Possible values: keys, speech
callFlow.commands.conditions.operator
string
Possible values: eq, ne, ==, !=, contains
callFlow.commands.conditions.value
string
notification
object
Mostrar atributos secundarios
notification.url
string
qualityInsights
object
Mostrar atributos secundarios
qualityInsights.mos
string
qualityInsights.pdd
string
sipInsights
object
Mostrar atributos secundarios
sipInsights.hangupSipCode
string
sipInsights.edgeRegion
string
sipInsights.providerName
string
sipInsights.userAgent
string
sipInsights.remoteSignallingIp
string
sipInsights.remoteMediaIp
string
amdResult
object
Mostrar atributos secundarios
amdResult.result
string
Possible values: human, machine, noSpeech, beep, unknown
amdResult.speech
string
amdResult.locale
string
sipType
string
Possible values: elastic, byoc, forward
tags
array of string
Tags to associate with the call. Tags are converted to lower case and tags
that do not exist are automatically created. You can view your created tags
in the UI. You can specify up to 10 tags per call.
Ejemplo de código
curl -X POST 'https://api.bird.com/workspaces/{workspaceId}/channels/{channelId}/calls' \
-H 'Authorization: AccessKey YOUR_ACCESS_KEY'Example 1: Initiate an outbound call, play an announcement and hangup
Ejemplo de código
curl -X POST "https://api.bird.com/workspaces/:workspaceId/channels/:channelId/calls" \
-H 'Authorization: AccessKey YOUR_SECRET_TOKEN`
Ejemplo de código
{
"to": "+351000000000",
"callFlow": [
{
"command": "playback",
"options": {
"media": [
"https://www.media.com.com/audio/code1.wav",
"https://www.media.com.com/audio/code2.wav",
"https://www.media.com.com/audio/code3.wav",
"https://www.media.com.com/audio/code4.wav",
],
"pauseMilliseconds": 100
}
},
{
"command": "hangup"
}
]
}
Ejemplo de código
HTTP/1.1 202 Accepted
Content-Type: application/json; charset=UTF-8
Content-Length: 1041
Connection: close
Date: Thu, 29 Feb 2024 11:44:07 GMT
Messagebird-Request-Id: dfdc5b69-518f-4033-845b-cfd952ac1542
Vary: Origin
X-Cache: Miss from cloudfront
Via: 1.1 1d956df7e4e25ae74372a8b2c4cdb82e.cloudfront.net (CloudFront)
X-Amz-Cf-Pop: FCO50-P1
Alt-Svc: h3=":443"; ma=86400
X-Amz-Cf-Id: 5q_MM0W4I4L4O1R4pwlJuNMd8IplyIR1_EiO-kpk0yiuxh9TRBVvPA==
X-XSS-Protection: 1; mode=block
X-Frame-Options: DENY
Referrer-Policy: no-referrer
Content-Security-Policy: default-src 'self'; style-src 'self'; script-src 'self'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'; object-src 'none'; media-src 'self'; frame-src 'self'; worker-src 'self' blob:; manifest-src 'self'; base-uri 'self'; form-action 'self'; frame-ancestors 'self';
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Vary: Origin
{"id":"1e5e9219-2da2-4aa2-bf0f-8cc34775e6c0","channelId":"1499d657-31af-4ba0-b731-7eab3fb764be","originator":{"number":{"type":"pstn","number":"+3197058016631","countryIsoCode":"NL"}},"receiver":{"contact":{"id":"1fddcbcd-3ece-42da-82e1-ef48a8536b92","identifierKey":"phonenumber","identifierValue":"+351910648517"},"number":{"type":"pstn","number":"+351910648517","countryIsoCode":"PT"}},"from":"+3197058016631","to":"+351910648517","direction":"outgoing","status":"accepted","type":"pstn","duration":0,"callFlow":{"id":"004a540b-897b-494c-a176-d7aec51d0257","commands":[{"id":"a28a931e-191c-4f2e-afcb-fa940f8e3a8a","callId":"1e5e9219-2da2-4aa2-bf0f-8cc34775e6c0","command":"playback","status":"accepted","callFlowId":"004a540b-897b-494c-a176-d7aec51d0257"},{"id":"d6022794-1c8e-44ab-8a9b-4e2deb2bf3e7","callId":"1e5e9219-2da2-4aa2-bf0f-8cc34775e6c0","command":"hangup","status":"accepted","callFlowId":"004a540b-897b-494c-a176-d7aec51d0257"}]},"notification":{},"createdAt":"2024-02-29T11:44:07.74Z","updatedAt":"2024-02-29T11:44:07.74Z"}
Example 2: Initiate an outbound call with TTS
Ejemplo de código
curl -X POST "https://api.bird.com/workspaces/:workspaceId/channels/:channelId/calls \
-H 'Authorization: AccessKey YOUR_SECRET_TOKEN'
Ejemplo de código
{
"to": "+351000000000",
"callFlow": [
{
"command": "say",
"options": {
"locale": "en-US",
"text": "Your TTS message here",
"voice": "female"
}
},
{
"command": "hangup"
}
]
}
Ejemplo de código
HTTP/1.1 202 Accepted
Content-Type: application/json; charset=UTF-8
Content-Length: 1041
Connection: close
Date: Thu, 29 Feb 2024 11:44:07 GMT
Messagebird-Request-Id: dfdc5b69-518f-4033-845b-cfd952ac1542
Vary: Origin
X-Cache: Miss from cloudfront
Via: 1.1 1d956df7e4e25ae74372a8b2c4cdb82e.cloudfront.net (CloudFront)
X-Amz-Cf-Pop: FCO50-P1
Alt-Svc: h3=":443"; ma=86400
X-Amz-Cf-Id: 5q_MM0W4I4L4O1R4pwlJuNMd8IplyIR1_EiO-kpk0yiuxh9TRBVvPA==
X-XSS-Protection: 1; mode=block
X-Frame-Options: DENY
Referrer-Policy: no-referrer
Content-Security-Policy: default-src 'self'; style-src 'self'; script-src 'self'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'; object-src 'none'; media-src 'self'; frame-src 'self'; worker-src 'self' blob:; manifest-src 'self'; base-uri 'self'; form-action 'self'; frame-ancestors 'self';
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Vary: Origin
{"id":"1e5e9219-2da2-4aa2-bf0f-8cc34775e6c0","channelId":"1499d657-31af-4ba0-b731-7eab3fb764be","originator":{"number":{"type":"pstn","number":"+3197058016631","countryIsoCode":"NL"}},"receiver":{"contact":{"id":"1fddcbcd-3ece-42da-82e1-ef48a8536b92","identifierKey":"phonenumber","identifierValue":"+351910648517"},"number":{"type":"pstn","number":"+351910648517","countryIsoCode":"PT"}},"from":"+3197058016631","to":"+351910648517","direction":"outgoing","status":"accepted","type":"pstn","duration":0,"callFlow":{"id":"004a540b-897b-494c-a176-d7aec51d0257","commands":[{"id":"a28a931e-191c-4f2e-afcb-fa940f8e3a8a","callId":"1e5e9219-2da2-4aa2-bf0f-8cc34775e6c0","command":"playback","status":"accepted","callFlowId":"004a540b-897b-494c-a176-d7aec51d0257"},{"id":"d6022794-1c8e-44ab-8a9b-4e2deb2bf3e7","callId":"1e5e9219-2da2-4aa2-bf0f-8cc34775e6c0","command":"hangup","status":"accepted","callFlowId":"004a540b-897b-494c-a176-d7aec51d0257"}]},"notification":{},"createdAt":"2024-02-29T11:44:07.74Z","updatedAt":"2024-02-29T11:44:07.74Z"}