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
Verzoek-payload
from
string
to
string
verplicht
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
Onderliggende parameters tonen
callFlow.command
string
Possible values: hangup, playback, say, gather, record, bridge, pause
callFlow.conditions
array of object
Onderliggende parameters tonen
callFlow.conditions.variable
string
Possible values: keys, speech
callFlow.conditions.operator
string
Possible values: eq, ne, ==, !=, contains
callFlow.conditions.value
string
callFlow.options
object
Onderliggende parameters tonen
callFlow.options.media
array of string
verplicht
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
Onderliggende parameters tonen
notification.url
string
amdSettings
object
Onderliggende parameters tonen
amdSettings.enabled
boolean
verplicht
amdSettings.wordCount
number
verplicht
amdSettings.speechTimeout
number
verplicht
amdSettings.speechLocale
string
verplicht
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
verplicht
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.
Antwoord-payload
id
string
verplicht
channelId
string
verplicht
from
string
verplicht
to
string
verplicht
originator
object
verplicht
Onderliggende attributen tonen
originator.contact
object
Onderliggende attributen tonen
originator.contact.id
string
verplicht
originator.contact.identifierKey
string
verplicht
originator.contact.identifierValue
string
verplicht
originator.number
object
verplicht
Onderliggende attributen tonen
originator.number.type
string
verplicht
Possible values: pstn, sip, webrtc
originator.number.number
string
verplicht
originator.number.anonymous
boolean
originator.number.callerIdName
string
originator.number.identity
string
originator.number.countryIsoCode
string
originator.number.pstnNumberType
string
receiver
object
verplicht
Onderliggende attributen tonen
receiver.contact
object
Onderliggende attributen tonen
receiver.contact.id
string
verplicht
receiver.contact.identifierKey
string
verplicht
receiver.contact.identifierValue
string
verplicht
receiver.number
object
verplicht
Onderliggende attributen tonen
receiver.number.type
string
verplicht
Possible values: pstn, sip, webrtc
receiver.number.number
string
verplicht
receiver.number.anonymous
boolean
receiver.number.callerIdName
string
receiver.number.identity
string
receiver.number.countryIsoCode
string
receiver.number.pstnNumberType
string
parentId
string
direction
string
verplicht
Possible values: incoming, outgoing
status
string
verplicht
Possible values: accepted, starting, ringing, ongoing, completed, busy, no-answer, failed, cancelled, scheduled
reason
string
type
string
verplicht
Possible values: pstn, sip, webrtc
duration
integer
hangupCauseCode
integer
hangupSource
string
Possible values: callee, caller, api, timeout, media-timeout, none
hangupSipCode
string
createdAt
string
verplicht
updatedAt
string
verplicht
ringingAt
string
answeredAt
string
endedAt
string
scheduledFor
string
callFlow
object
Onderliggende attributen tonen
callFlow.id
string
callFlow.commands
array of object
Onderliggende attributen tonen
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
Onderliggende attributen tonen
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
Onderliggende attributen tonen
notification.url
string
qualityInsights
object
Onderliggende attributen tonen
qualityInsights.mos
string
qualityInsights.pdd
string
sipInsights
object
Onderliggende attributen tonen
sipInsights.hangupSipCode
string
sipInsights.edgeRegion
string
sipInsights.providerName
string
sipInsights.userAgent
string
sipInsights.remoteSignallingIp
string
sipInsights.remoteMediaIp
string
amdResult
object
Onderliggende attributen tonen
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.
Codevoorbeeld
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
Codevoorbeeld
curl -X POST "https://api.bird.com/workspaces/:workspaceId/channels/:channelId/calls" \
-H 'Authorization: AccessKey YOUR_SECRET_TOKEN`
Codevoorbeeld
{
"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"
}
]
}
Codevoorbeeld
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
Codevoorbeeld
curl -X POST "https://api.bird.com/workspaces/:workspaceId/channels/:channelId/calls \
-H 'Authorization: AccessKey YOUR_SECRET_TOKEN'
Codevoorbeeld
{
"to": "+351000000000",
"callFlow": [
{
"command": "say",
"options": {
"locale": "en-US",
"text": "Your TTS message here",
"voice": "female"
}
},
{
"command": "hangup"
}
]
}
Codevoorbeeld
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"}