Communication Methods

Yeastar K2 VoIP PBX communicates with the 3rd-party application server by two methods.

Communication protocol

Request and Response

Request over HTTP or HTTPS is supported. The API communication protocol and port are the same as the web access settings of the Yeastar K2 VoIP PBX.

Note: We recommend that you send requests over HTTPS to enhance security and upload an HTTPS certification to the PBX.
The following figure shows the default web access settings on the Yeastar K2 VoIP PBX. With the default settings, you can access the API interfaces by HTTPS (port 8088) or HTTP (port 80).
  • Protocol: HTTPS (port 8088)
  • Redirect from port 80: Enabled. Accessing the web by HTTP (port 80) will be redirected to HTTPS (8088).

API Reports
The 3rd-party application server sends API reports to the PBX through HTTP protocol.

Communication method

1. The 3rd-party application server sends request to the PBX.

The 3rd-party application server acts as a client; PBX acts as a server.

Note:
  • All API requests should contain an API token.

    The API token is generated when the 3rd-party application server logs in the PBX API successfully.

  • The API token is valid in 30 minutes.

    Within the validity time of the token, if there is no event interaction between the API and the application server (for example, the application server sends API request to the PBX, or PBX API sends event report to the application server), the token will be erased by the PBX.

    The application server can prolong the validity time of the token by sending a Heartbeat packet to the PBX via the Heartbeat packet interface. Every time a packet is sent, the token validity time will be prolonged for 30 minutes.
Scenario: The 3rd-party application server initiates a call or query request.
2. The PBX automatically sends API reports to the 3rd-party application server.

Prerequisite: The 3rd-party application server should be connected to the PBX via API interface.

The 3rd-party application server acts as a server; PBX acts as a client.

Note: After receiving API reports from the PBX, the 3rd-party application server should response 200OK, or the PBX will send API reports repeatedly.

Scenario: PBX sends extension status to the application server.