Update a call
Update an active call resource. You can use this request to do additional actions:
- You can use this request to hangup the call by setting status to completed
- It can also be used to update the callFlow of the call. Commands of the new callFlow will be executed after the Patch.
CallFlowCommand
Check bellow the available commands when initiating an outbound call. In order to assess the options of each command, you may explore each command section.
Contoh kode
type: string
enum:
- answer
- hangup
- playback
- say
- gather
- record
- bridge
- pause
- ringing
PATCH
/workspaces/{workspaceId}/channels/{channelId}/calls/{callId}
Update a call
Payload permintaan
status
string
Possible values: completed
callFlow
array of object
Tampilkan parameter turunan
callFlow.command
string
Possible values: answer, hangup, playback, say, gather, record, bridge, pause, ringing
callFlow.options
object
Tampilkan parameter turunan
callFlow.options.media
array of string
wajib
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: record
callFlow.options.command
Value: hangup
callFlow.options.command
Value: pause
callFlow.options.command
Value: bridge
callFlow.conditions
array of object
Tampilkan parameter turunan
callFlow.conditions.variable
string
Possible values: keys, speech
callFlow.conditions.operator
string
Possible values: eq, ne, ==, !=, contains
callFlow.conditions.value
string
Payload respons
id
string
wajib
channelId
string
wajib
from
string
wajib
to
string
wajib
originator
object
wajib
Tampilkan atribut turunan
originator.contact
object
Tampilkan atribut turunan
originator.contact.id
string
wajib
originator.contact.identifierKey
string
wajib
originator.contact.identifierValue
string
wajib
originator.number
object
wajib
Tampilkan atribut turunan
originator.number.type
string
wajib
Possible values: pstn, sip, webrtc
originator.number.number
string
wajib
originator.number.anonymous
boolean
originator.number.callerIdName
string
originator.number.identity
string
originator.number.countryIsoCode
string
originator.number.pstnNumberType
string
receiver
object
wajib
Tampilkan atribut turunan
receiver.contact
object
Tampilkan atribut turunan
receiver.contact.id
string
wajib
receiver.contact.identifierKey
string
wajib
receiver.contact.identifierValue
string
wajib
receiver.number
object
wajib
Tampilkan atribut turunan
receiver.number.type
string
wajib
Possible values: pstn, sip, webrtc
receiver.number.number
string
wajib
receiver.number.anonymous
boolean
receiver.number.callerIdName
string
receiver.number.identity
string
receiver.number.countryIsoCode
string
receiver.number.pstnNumberType
string
parentId
string
direction
string
wajib
Possible values: incoming, outgoing
status
string
wajib
Possible values: accepted, starting, ringing, ongoing, completed, busy, no-answer, failed, cancelled, scheduled
reason
string
type
string
wajib
Possible values: pstn, sip, webrtc
duration
integer
hangupCauseCode
integer
hangupSource
string
Possible values: callee, caller, api, timeout, media-timeout, none
hangupSipCode
string
createdAt
string
wajib
updatedAt
string
wajib
ringingAt
string
answeredAt
string
endedAt
string
scheduledFor
string
callFlow
object
Tampilkan atribut turunan
callFlow.id
string
callFlow.commands
array of object
Tampilkan atribut turunan
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
Tampilkan atribut turunan
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
Tampilkan atribut turunan
notification.url
string
qualityInsights
object
Tampilkan atribut turunan
qualityInsights.mos
string
qualityInsights.pdd
string
sipInsights
object
Tampilkan atribut turunan
sipInsights.hangupSipCode
string
sipInsights.edgeRegion
string
sipInsights.providerName
string
sipInsights.userAgent
string
sipInsights.remoteSignallingIp
string
sipInsights.remoteMediaIp
string
amdResult
object
Tampilkan atribut turunan
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.
Contoh kode
curl -X PATCH 'https://api.bird.com/workspaces/{workspaceId}/channels/{channelId}/calls/{callId}' \
-H 'Authorization: AccessKey YOUR_ACCESS_KEY'Example 1: Update a call by answering
Contoh kode
curl -X PATCH "https://api.bird.com/workspaces/{workspaceId}/channels/{channelId}/calls/{channelId}" \
-H "Authorization: AccessKey YOUR_SECRET_TOKEN"
Contoh kode
{
"status": "completed",
"callFlow": [
{
"command": "answer",
"options": {
"media": [
"string"
],
"loop": 0,
"timeout": 0
}
}
]
}
Contoh kode
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"channelId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"from": "string",
"to": "string",
"originator": {
"contact": {
"id": "string",
"identifierKey": "string",
"identifierValue": "string"
},
"number": {
"type": "pstn",
"number": "string",
"anonymous": true,
"callerIdName": "string",
"identity": "string",
"countryIsoCode": "string",
"pstnNumberType": "string"
}
},
"direction": "incoming",
"status": "accepted",
"reason": "string",
"type": "pstn",
"duration": 0,
"hangupCauseCode": 0,
"hangupSource": "callee",
"hangupSipCode": "string",
"createdAt": "2023-10-25T14:36:18.575Z",
"updatedAt": "2023-10-25T14:36:18.575Z",
"ringingAt": "2023-10-25T14:36:18.575Z",
"answeredAt": "2023-10-25T14:36:18.575Z",
"endedAt": "2023-10-25T14:36:18.575Z",
"callFlow": {
"commands": [
{
"callFlowId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "string",
"command": "string"
}
]
},
"qualityInsights": {
"mos": "string",
"pdd": "string"
},
"sipInsights": {
"hangupSipCode": "string",
"edgeRegion": "string",
"providerName": "string",
"userAgent": "string",
"remoteSignallingIp": "string",
"remoteMediaIp": "string"
}
}
Example 2: Update a call by sending ringing, pause for 2 seconds, answer and play an announcement
Contoh kode
curl -X PATCH "https://api.bird.com/workspaces/{workspaceId}/channels/{channelId}/calls/{channelId}" \
-H "Authorization: AccessKey YOUR_SECRET_TOKEN"
Contoh kode
{
"callFlow": [
{
"command": "ringing"
},
{
"command": "pause",
"options": {
"pauseSeconds": 2
}
},
{
"command": "answer"
},
{
"command": "say",
"options": {
"text": "Sorry, we don't have available agents now. Please call later. GoodBye.",
"locale": "en-GB",
"voice": "male"
}
},
{
"command": "hangup"
}
]
}
Contoh kode
{
"id": "a78dd93c-08fb-450b-8651-0def9cf77cf9",
"channelId": "db53c357-92e3-4f3d-babe-159573940a50",
"originator": {
"contact": {
"id": "1ea5d8c8-3f5e-4cc0-bb92-47b099d317c0",
"identifierKey": "phonenumber",
"identifierValue": "+351910648518"
},
"number": {
"type": "pstn",
"number": "+351910648518",
"callerIdName": "Jose G",
"countryIsoCode": "PT"
}
},
"receiver": {
"number": {
"type": "pstn",
"number": "+3197058016589",
"countryIsoCode": "NL"
}
},
"from": "+351910648518",
"to": "+3197058016589",
"direction": "incoming",
"status": "starting",
"type": "pstn",
"duration": 0,
"callFlow": {
"id": "c4b84cee-66bb-4f1f-b43c-4b63be02ef84",
"commands": [
{
"id": "2c27c266-856d-4ae2-abfe-19a3388bdfaf",
"callId": "a78dd93c-08fb-450b-8651-0def9cf77cf9",
"command": "ringing",
"status": "accepted",
"callFlowId": "c4b84cee-66bb-4f1f-b43c-4b63be02ef84"
},
{
"id": "f39efa8f-5c8e-40f1-99a2-9b3eab040734",
"callId": "a78dd93c-08fb-450b-8651-0def9cf77cf9",
"command": "pause",
"status": "accepted",
"callFlowId": "c4b84cee-66bb-4f1f-b43c-4b63be02ef84"
},
{
"id": "1d093dc0-3646-49d5-9125-939da797961a",
"callId": "a78dd93c-08fb-450b-8651-0def9cf77cf9",
"command": "answer",
"status": "accepted",
"callFlowId": "c4b84cee-66bb-4f1f-b43c-4b63be02ef84"
},
{
"id": "57f960c6-455f-4884-b4de-fc017c0f1be3",
"callId": "a78dd93c-08fb-450b-8651-0def9cf77cf9",
"command": "say",
"status": "accepted",
"callFlowId": "c4b84cee-66bb-4f1f-b43c-4b63be02ef84"
},
{
"id": "cf8a8557-f3ba-41a5-a21f-2543f7268380",
"callId": "a78dd93c-08fb-450b-8651-0def9cf77cf9",
"command": "hangup",
"status": "accepted",
"callFlowId": "c4b84cee-66bb-4f1f-b43c-4b63be02ef84"
}
]
},
"createdAt": "2024-03-01T16:46:50.158Z",
"updatedAt": "2024-03-01T16:46:50.45Z"
}