API Events
This topic introduces the API events which are sent from Yeastar S-Series VoIP PBX to the application server. We introduce two types of API events and the relevant communication protocols, communication ports, and interaction flow between the PBX and the application server.
API reports (events) settings
Yeastar S-Series VoIP PBX supports to send HTTP events and TCP events. You can go to API Settings on PBX, and select the report method.
HTTP events
- Communication protocol
- PBX sends HTTP events by short-lived TCP flows.
- Communication port
- When the application server sends the request of Get API token, the
port
parameter should be specified in the API request.port
defines the monitoring port to receive events.. PBX will send events to the application server through this port.
- Event format
- JSON.
- Requirements
- The application server must send the request of Get API token to log in PBX. Token validity must be ensured, or the application server can not receive the events.
- Interaction flow
- The following figure shows the HTTP events flow between the application server and the PBX.
TCP events
- Communication protocol
- PBX sends TCP events by keep-alive TCP flows.
PBX will send events continuously till the TCP connection disconnects. When the network error occurs or the application server disconnects the TCP connection, the application server needs to establish a new TCP connection with the PBX.
- Communication port
- On the PBX API web interface, set the TCP port. PBX will send TCP events to the application server through this port.
- Event format
- JSON.
- Requirements
- The application server should establish a TCP connection with PBX, and send a login data to log in PBX. Only the login request is authorized will PBX send events.
- Interaction flow
- The application server acts as a TCP client, and the PBX acts as a TCP server.