Event Reference
PortSIP sends the events to the webhook in JSON object encoded using UTF-8, the events are defined as the below.
CDR Events
Call Target Definition
The definition of the call target: In PortSIP PBX, a call target refers to an endpoint. For example, if user 102 registers with the PBX from an IP phone and an app simultaneously, when user 101 calls 102, the PBX will send INVITE messages to both the IP phone and the app. In this scenario, the CDR will have two call targets: one for the IP phone and another for the app.
When the PBX sends an INVITE to a target, and the call target is ringing, answered, hung up, or the call to the target fails, the PortSIP PBX will send this call target event to the webhook.
Call Start Event
This event is sent to the webhook when a call is starting, it contains the below fields:
Key name | Value |
---|---|
event_type | call_start |
time | The Unix timestamp in string format represents the call start time. |
session_id | The session ID of the call. |
cdr_id | The ID of this CDR. |
direction | The call direction can have the following values:
|
user_data | If the call is initiated from the REST API, additional information may be passed to this call as user_data. |
call_id | The Call-ID of the INVITE SIP message. |
caller_display_name | The display name of the caller. |
caller | The caller number. |
callee_display_name | The display name of the callee. |
callee | The callee number. |
tenant_id | The numeric tenant ID in string format |
did | If the call is an inbound call, this key stores the DID. |
outbound_caller_id | If the call is an outbound call, this key stores the outbound caller ID. |
Call Info Update Event
This event is sent to the webhook when call information is updated, it contains the below fields:
Key name | Value |
---|---|
event_type | call_update_info |
time | The Unix timestamp in string format represents the call start time. |
session_id | The session ID of the call. |
cdr_id | The ID of this CDR. |
direction | The call direction can have the following values:
|
caller_display_name | The display name of the caller. |
caller | The caller number. |
callee_display_name | The display name of the callee. |
callee | The callee number. |
tenant_id | The numeric tenant ID in string format |
did | If the call is an inbound call, this key stores the DID. |
outbound_caller_id | If the call is an outbound call, this key stores the outbound caller ID. |
Call Target Event
As per the Call Target Definition, the call target event includes the below information.
event_type | For call target events, this event type can have the following values:
|
time | The Unix timestamp in string format represents the call start time. |
session_id | The session ID of the call. |
cdr_id | The ID of this CDR. |
tenant_id | The numeric tenant ID in string format |
direction | The call direction can have the following values:
|
destiantion | The call target address, for example: |
caller | The caller number. |
did | If the call is an inbound call, this key stores the DID. |
outbound_caller_id | If the call is an outbound call, this key stores the outbound caller ID. |
Call End Event
When a call is completed (either hung up or failed), the PortSIP PBX sends this event to the webhook. This event includes all information about the call. Below is an example of a CDR.
The call flow is as follows: caller 1888722 dials 18800606 > trunk > PBX IVR (5000) > Queue (8000) > Agent (102, 103).
event_type | call_cdr |
start_time | The Unix timestamp in string format represents the call start time. |
ring_time | The Unix timestamp in string format represents the first call target ring. |
answered_time | The Unix timestamp in string format represents the first call target answered. |
ended_time | The Unix timestamp in string format represents the call was ended. |
session_id | The session ID of the call. |
cdr_id | The ID of this CDR. |
call_id | The Call-ID of the INVITE SIP message. |
callee | The callee number. |
callee_domain | The domain of the callee. |
caller | The caller number. |
caller_display_name | The display name of the caller. |
caller_domain | The domain of the caller. |
call_status | The call final status can have the following values:
|
trunk_name | If the call is an inbound call or an outbound call through the trunk, the trunk name is stored in this key. |
tenant_id | The numeric tenant ID in string format |
tenant_name | The tenant name. |
status_code | The final status code of the call is a SIP standard-defined status code. |
direction | The call direction can have the following values:
|
end_reason | The end reason of the call can have the following values:
|
did | If the call is an inbound call, this key stores the DID. |
outbound_caller_id | If the call is an outbound call, this key stores the outbound caller ID. |
ring_duration | The ring time of the call. |
talk_duration | The talk time of the call. |
Call Targets Information
Since a call may be forwarded multiple times to different call targets during its duration, PortSIP PBX includes all call targets in the CDR when the call is completed. We can simply parse the call_targets JSON array object to access the call target information.
call_type | Indicates the call type. The values can be:
|
start_time | The Unix timestamp in string format represents the call start time. |
ring_time | The Unix timestamp in string format represents the first call target ring. |
answered_time | The Unix timestamp in string format represents the first call target answered. |
ended_time | The Unix timestamp in string format represents the call was ended. |
cdr_id | The ID of CDR for this call target. |
callee | The callee number. |
caller | The caller number. |
destination | The address of the call target, for example: |
status | The call final status can have the following values:
|
trunk_name | If the call is an inbound call or an outbound call through the trunk, the trunk name is stored in this key. |
cost | If the billing is enabled, store the call cost in this key. |
status_code | The final status code of the call is a SIP standard-defined status code. |
direction | The call direction can have the following values:
|
end_reason | The end reason of the call can have the following values:
|
did | If the call is an inbound call, this key stores the DID. |
outbound_caller_id | If the call is an outbound call, this key stores the outbound caller ID. |
ring_duration | The ring time of the call. |
talk_duration | The talk time of the call. |
Last updated