Update a call

Update an active call resource. You can use this request to do additional actions:

  • It can also be used to update the callFlow of the call. Commands of the new callFlow will be executed after the Patch.

Update call status

Check bellow the available call status.

 status:
    type: string
    nullable: true
    enum:
      - completed

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.

type: string
enum:
  - answer
  - hangup
  - playback
  - say
  - gather
  - record
  - bridge
  - pause
  - ringing

Update call

Update a call

PATCH/workspaces/{workspaceId}/channels/{channelId}/calls/{callId}
Authorization
Path parameters
workspaceId*string (uuid)

The ID of the workspace

callId*string (uuid)

The ID for a call

channelId*string (uuid)

The ID for a channel

Body
statusnullable enum
completed
callFlowarray of CallFlowCommand
Response

Call update accepted

Body
id*Id-2 (string (uuid))
channelId*ChannelId (string (uuid))
from*string
to*string
originator*ChannelCallOriginatorOrReceiver
receiver*ChannelCallOriginatorOrReceiver
parentIdId-2 (string (uuid))
direction*Direction (enum)
incomingoutgoing
status*Status-4 (enum)
acceptedstartingringingongoingcompletedno-answerbusyfailedcancelledscheduled
reasonstring
type*Type-2 (enum)
pstnsipwebrtc
durationinteger
hangupCauseCodeinteger
hangupSourcenullable HangupSource (enum)
calleecallerapitimeoutmedia-timeoutnone
hangupSipCodestring
createdAt*string (date-time)
updatedAt*string (date-time)
ringingAtstring (date-time)
answeredAtstring (date-time)
endedAtstring (date-time)
scheduledForstring (date-time)
callFlowCallFlow
notificationCallNotification
qualityInsightsqualityInsights
sipInsightssignallingInsights
amdResultAmdResult
sipTypeSIPType (enum)
elasticbyocforward
tagsTags-2 (array of Name-3 (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.

Request
const response = await fetch('/workspaces/{workspaceId}/channels/{channelId}/calls/{callId}', {
    method: 'PATCH',
    headers: {
      "Authorization": "Bearer jwt",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();
Response
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "channelId": "123e4567-e89b-12d3-a456-426614174000",
  "from": "text",
  "to": "text",
  "originator": {
    "contact": {
      "id": "text",
      "identifierKey": "text",
      "identifierValue": "text"
    },
    "number": {
      "type": "pstn",
      "number": "text",
      "anonymous": false,
      "callerIdName": "text",
      "identity": "text",
      "countryIsoCode": "text",
      "pstnNumberType": "text"
    }
  },
  "receiver": {
    "contact": {
      "id": "text",
      "identifierKey": "text",
      "identifierValue": "text"
    },
    "number": {
      "type": "pstn",
      "number": "text",
      "anonymous": false,
      "callerIdName": "text",
      "identity": "text",
      "countryIsoCode": "text",
      "pstnNumberType": "text"
    }
  },
  "parentId": "123e4567-e89b-12d3-a456-426614174000",
  "direction": "incoming",
  "status": "accepted",
  "reason": "text",
  "type": "pstn",
  "duration": 0,
  "hangupCauseCode": 0,
  "hangupSource": "callee",
  "hangupSipCode": "text",
  "createdAt": "2024-12-21T12:04:24.680Z",
  "updatedAt": "2024-12-21T12:04:24.680Z",
  "ringingAt": "2024-12-21T12:04:24.680Z",
  "answeredAt": "2024-12-21T12:04:24.680Z",
  "endedAt": "2024-12-21T12:04:24.680Z",
  "scheduledFor": "2024-12-21T12:04:24.680Z",
  "callFlow": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "commands": [
      {
        "id": "123e4567-e89b-12d3-a456-426614174000",
        "callId": "123e4567-e89b-12d3-a456-426614174000",
        "callFlowId": "123e4567-e89b-12d3-a456-426614174000",
        "status": "text",
        "command": "text"
      }
    ]
  },
  "notification": {
    "url": "text"
  },
  "qualityInsights": {
    "mos": "text",
    "pdd": "text"
  },
  "sipInsights": {
    "hangupSipCode": "text",
    "edgeRegion": "text",
    "providerName": "text",
    "userAgent": "text",
    "remoteSignallingIp": "text",
    "remoteMediaIp": "text"
  },
  "amdResult": {
    "result": "human",
    "speech": "text",
    "locale": "text"
  },
  "sipType": "elastic",
  "tags": [
    "text"
  ]
}

Example 1: Update a call by answering

curl -X "PATCH" "https://nest.messagebird.one/workspaces/8bc02f53-87ac-48d2-b4fd-c2cf856a305f/channels/3fa85f64-5717-4562-b3fc-2c963f66afa6
/calls/3fa85f64-5717-4562-b3fc-2c963f66afa6" \
     -H 'Authorization: Bearer {Token}'

Example 2: Update a call by sending ringing, pause for 2 seconds, answer and play an announcement

curl -X "PATCH" "https://nest.messagebird.one/workspaces/8bc02f53-87ac-48d2-b4fd-c2cf856a305f/channels/3fa85f64-5717-4562-b3fc-2c963f66afa6
/calls/3fa85f64-5717-4562-b3fc-2c963f66afa6" \
     -H 'Authorization: Bearer {Token}'

Last updated