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.
Codebeispiel
type: string
enum:
- answer
- hangup
- playback
- say
- gather
- record
- bridge
- pause
- ringing
PATCH
/workspaces/{workspaceId}/channels/{channelId}/calls/{callId}
Update a call
Anfrage-Payload
status
string
Possible values: completed
callFlow
array of object
Untergeordnete Parameter anzeigen
callFlow.command
string
Possible values: answer, hangup, playback, say, gather, record, bridge, pause, ringing
callFlow.options
object
Untergeordnete Parameter anzeigen
callFlow.options.media
array of string
erforderlich
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
Untergeordnete Parameter anzeigen
callFlow.conditions.variable
string
Possible values: keys, speech
callFlow.conditions.operator
string
Possible values: eq, ne, ==, !=, contains
callFlow.conditions.value
string
Antwort-Payload
id
string
erforderlich
channelId
string
erforderlich
from
string
erforderlich
to
string
erforderlich
originator
object
erforderlich
Untergeordnete Attribute anzeigen
originator.contact
object
Untergeordnete Attribute anzeigen
originator.contact.id
string
erforderlich
originator.contact.identifierKey
string
erforderlich
originator.contact.identifierValue
string
erforderlich
originator.number
object
erforderlich
Untergeordnete Attribute anzeigen
originator.number.type
string
erforderlich
Possible values: pstn, sip, webrtc
originator.number.number
string
erforderlich
originator.number.anonymous
boolean
originator.number.callerIdName
string
originator.number.identity
string
originator.number.countryIsoCode
string
originator.number.pstnNumberType
string
receiver
object
erforderlich
Untergeordnete Attribute anzeigen
receiver.contact
object
Untergeordnete Attribute anzeigen
receiver.contact.id
string
erforderlich
receiver.contact.identifierKey
string
erforderlich
receiver.contact.identifierValue
string
erforderlich
receiver.number
object
erforderlich
Untergeordnete Attribute anzeigen
receiver.number.type
string
erforderlich
Possible values: pstn, sip, webrtc
receiver.number.number
string
erforderlich
receiver.number.anonymous
boolean
receiver.number.callerIdName
string
receiver.number.identity
string
receiver.number.countryIsoCode
string
receiver.number.pstnNumberType
string
parentId
string
direction
string
erforderlich
Possible values: incoming, outgoing
status
string
erforderlich
Possible values: accepted, starting, ringing, ongoing, completed, busy, no-answer, failed, cancelled, scheduled
reason
string
type
string
erforderlich
Possible values: pstn, sip, webrtc
duration
integer
hangupCauseCode
integer
hangupSource
string
Possible values: callee, caller, api, timeout, media-timeout, none
hangupSipCode
string
createdAt
string
erforderlich
updatedAt
string
erforderlich
ringingAt
string
answeredAt
string
endedAt
string
scheduledFor
string
callFlow
object
Untergeordnete Attribute anzeigen
callFlow.id
string
callFlow.commands
array of object
Untergeordnete Attribute anzeigen
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
Untergeordnete Attribute anzeigen
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
Untergeordnete Attribute anzeigen
notification.url
string
qualityInsights
object
Untergeordnete Attribute anzeigen
qualityInsights.mos
string
qualityInsights.pdd
string
sipInsights
object
Untergeordnete Attribute anzeigen
sipInsights.hangupSipCode
string
sipInsights.edgeRegion
string
sipInsights.providerName
string
sipInsights.userAgent
string
sipInsights.remoteSignallingIp
string
sipInsights.remoteMediaIp
string
amdResult
object
Untergeordnete Attribute anzeigen
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.
Codebeispiel
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
Codebeispiel
curl -X PATCH "https://api.bird.com/workspaces/{workspaceId}/channels/{channelId}/calls/{channelId}" \
-H "Authorization: AccessKey YOUR_SECRET_TOKEN"
Codebeispiel
{
"status": "completed",
"callFlow": [
{
"command": "answer",
"options": {
"media": [
"string"
],
"loop": 0,
"timeout": 0
}
}
]
}
Codebeispiel
{
"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
Codebeispiel
curl -X PATCH "https://api.bird.com/workspaces/{workspaceId}/channels/{channelId}/calls/{channelId}" \
-H "Authorization: AccessKey YOUR_SECRET_TOKEN"
Codebeispiel
{
"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"
}
]
}
Codebeispiel
{
"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"
}