Skip to content

Call Events Webhook

The Call Events webhook sends an HTTP request to your own application every time a call of your account changes state: a channel is created, starts ringing, is answered, is bridged to another party, or hangs up. Use it to keep an external system (a CRM, a helpdesk, a reporting database) in step with the calls on the platform, without polling.

It is configured once per account and applies to every call of that account. To react to a call only when it reaches a specific point of a callflow, use the callflow Webhook action instead (see Callflow Webhook and Pivot). To receive the same events over a WebSocket instead of HTTP, see Firehose.

Configure it

  1. In the admin portal, go to Config → Webhooks → Call Events.
  2. Fill in the form (all fields except API Headers are required) and click Save.
Field Description
API Method The HTTP method of the request: POST, PUT, GET or PATCH. The event is sent in the request body with every method, so choose POST unless your endpoint requires another one.
API Endpoint The URL the request is sent to.
API Headers Optional key/value pairs added to the request. Content-Type is always application/json and cannot be overridden.
Retries How many times an event is attempted in total when your endpoint does not answer 200. 1 means a single attempt with no retry.
Events The events to send (see below). Events not selected are not sent.

The section is visible to users whose role has the Call Events permission under Configuration (see Admin Roles). Saving replaces the previous configuration; there is one Call Events webhook per account.

Events

Event Sent when
CHANNEL_CREATE A call leg is created: an incoming call reaches the platform, a user dials out, or the platform rings a device.
CHANNEL_PROGRESS The far end reports that it is ringing.
CHANNEL_PROGRESS_MEDIA The far end sends early media (ringback tone or an announcement) before answering.
CHANNEL_ANSWER The call leg is answered.
CHANNEL_BRIDGE The call leg is connected to another leg (the two parties can talk).
CHANNEL_DESTROY The call leg hangs up. This event carries the durations and the hangup cause.

Events are sent per call leg, not per conversation. One phone conversation has at least two legs (the caller's and the answering device's), and an incoming call that rings several devices creates one leg for each device that rings. Each leg has its own Call-ID and sends its own events. To group the legs of one conversation, use Custom-Channel-Vars → Call-Interaction-ID when it is present, and Other-Leg-Call-ID, which on a bridged leg names the leg it is connected to.

Only calls that belong to the account where the webhook is configured are sent; calls of its sub-accounts are not.

Request

POST /your/endpoint HTTP/1.1
Content-Type: application/json

{ ...event... }

The body is a JSON object. Keys are in Title-Case-With-Hyphens, as in the example below. The keys listed in the table are always present; a value the event does not have is sent as an empty string (""). Durations are strings that contain a number of seconds.

{
  "Event-Name": "CHANNEL_DESTROY",
  "Call-ID": "3a5f0c9e-8f1d-4c2a-9a77-1b2c3d4e5f60",
  "Call-Direction": "inbound",
  "Caller-ID-Number": "+27215550100",
  "Caller-ID-Name": "Jane Customer",
  "Callee-ID-Number": "101",
  "Callee-ID-Name": "Front Desk",
  "From": "+27215550100@sip.example.com",
  "To": "+27215550199@sip.example.com",
  "Other-Leg-Call-ID": "8c1e2d3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f",
  "Timestamp": 63945678901,
  "Duration-Seconds": "74",
  "Billing-Seconds": "61",
  "Ringing-Seconds": "13",
  "Hangup-Cause": "NORMAL_CLEARING",
  "Custom-Channel-Vars": {
    "Account-ID": "0123456789abcdef0123456789abcdef",
    "Owner-ID": "fedcba9876543210fedcba9876543210",
    "Call-Interaction-ID": "63945678827-1a2b3c4d",
    "Authorizing-Type": "device",
    "Username": "user_abc123"
  }
}

The example shows the keys most integrations use; the request carries more (SIP and switch details, Custom-SIP-Headers set by the contact center). Treat unknown keys as optional.

Key Meaning
Event-Name One of the events in the table above.
Call-ID Unique ID of this call leg. All events of the leg carry the same value.
Call-Direction inbound or outbound, from the platform's point of view for this leg: the leg of an external caller is inbound, and the leg that rings the user's device is outbound.
Caller-ID-Number, Caller-ID-Name Who is calling on this leg.
Callee-ID-Number, Callee-ID-Name Who is being called on this leg, when known.
From, To SIP From and To of the leg (number@domain). For an incoming call, the user part of To is the number that was dialled.
Other-Leg-Call-ID Call-ID of the leg this one is connected to.
Timestamp When the event happened, in Gregorian seconds (seconds since year 0). Subtract 62167219200 for a Unix timestamp.
Duration-Seconds CHANNEL_DESTROY only: total lifetime of the leg.
Billing-Seconds CHANNEL_DESTROY only: seconds after answer. "0" means the leg was never answered.
Ringing-Seconds CHANNEL_DESTROY only: seconds before answer.
Hangup-Cause CHANNEL_DESTROY only: why the leg ended, for example NORMAL_CLEARING, ORIGINATOR_CANCEL, NO_ANSWER, USER_BUSY.
Custom-Channel-Vars.Account-ID Account that owns the call.
Custom-Channel-Vars.Owner-ID User that owns the device of this leg, when the leg is a user's device.

Delivery

  • Your endpoint must answer HTTP 200 within 10 seconds. Any other status (including 201 and 204) or a timeout counts as a failure, and the event is attempted again, immediately, until the number of attempts set in Retries is reached. After that the event is dropped.
  • The same event can be delivered more than once. Make your endpoint idempotent: treat a repeated Call-ID + Event-Name pair as the same event.
  • Events are sent as they happen and are not queued: an event your endpoint missed while it was unreachable is not sent again later. For a complete record of past calls, read the call detail records instead.
  • Call events do not include the call recording. Recordings are stored after the call ends; see Download Call Recordings.