API Events Overview
Yeastar P-Series Cloud Edition API events provide comprehensive event-logging and change-tracking to help you monitor the PBX resources. The third-party application can subscribe to desired PBX events, and the Yeastar P-Series Cloud Edition would proactively send event reports to the application once the related event occurs.
Background information
Yeastar P-Series Cloud Edition API supports to send event notifications to a third-party application via WebSocket, which is a computer communication protocol that provides a persistent, full-duplex communication between a server and a client over a single TCP connection.
After the third-party application establishes WebSocket connection with Yeastar P-Series Cloud Edition and subscribes to desired events, it will receive event-driven responses without having to poll the PBX for a reply, thus achieving real-time monitoring.
To connect to PBX and subscribe desired events, see Monitor Events via WebSocket.
Restriction
- The WebSocket connection expires after 60 seconds. If there is no interaction between the third-party application and PBX for 60 seconds, the WebSocket connection will be automatically disconnected.Note: You can use a heartbeat request to keep the WebSocket connection alive.
- The WebSocket connection establishment requires a valid access token, which
will expire after 30 minutes.
You will need to get a new access token or refresh the access token to maintain the WebSocket connection.
WebSocket workflow
Data interaction between client (third-party application) and server (Yeastar P-Series Cloud Edition) via WebSocket is shown below:
For the initial handshake, the third-party application sends a request through HTTP to request an upgrade to WebSocket. PBX responds an HTTP status code 101, indicating that the protocol will be switched from HTTP to WebSocket. After a successful upgrade, the communication occurring through this active TCP connection follows the WebSocket Protocol.During the connection, both the PBX and the application can send each other messages whenever they wish for the whole duration of the WebSocket connection. If either side closes the connection, the WebSocket connection will be terminated.
Supported events
Yeastar P-Series Cloud Edition offers a comprehensive set of events to which developers can subscribe. Such events include but is not limited to the followings:
- Status and configuration change of features, including extension, trunk, organization, etc.
- Call status of extensions
- Inbound call notifications
- Call activity details
- Call records
- Satisfaction survey results