API Quick Start

This topic describes how to call APIs and check the events by Yeastar demo tool.


Before using API feature, make sure PBX firmware version meets the requirement and the API feature is enabled.

For PBX firmware requirements, refer to API Requirements.

For descriptions of PBX API settings, refer to API Settings on PBX.

API demo

Download API demo
Download Yeastar demo tool for API 2.0.
API demo overview
See the following figure to get familiar with the user interface of the demo tool.

Use API demo to call an API

The following takes call/dial as an example API to call and check the relevant events.

Note: Before calling the API, read the API references to understand its usage and check the required request parameters. If errors are reported when you call the API, you can check the Error Code for troubleshooting.
API demo settings
  1. In API demo, enter API version, the IP address of PBX, and the communication port.

    • Version: Enter API version 2.0.0.
      Note: In this documentation, all API interfaces and events use API version 2.0.0.
    • HTTP/HTTPS: Select communication protocol.
      Note: In this example, we use HTTPS 8088 as communication port. If you change the web access protocol and port on PBX, you should enter corresponding protocol and port.
    • Destination: Enter the IP address of PBX.
    • Port: Enter the web access port of PBX. In this example, enter 8088.
  2. In API demo, configure the port that you want to monitor. Click Start the Server to monitor the port.

    PBX will send events through this port.

Set up API authentication
  1. Call login to get an API token.

Send API request
  1. Call call/dial to place a call to an extension.
    In this example, extension 4001 calls extension 4003 out. The request parameters are as follows:

Observe the API result

If the API interface is called successfully, the subsequent process should be as follows:

  1. Caller 4001 rings first.
  2. After extension 4001 answers the call, the callee 4003 rings.
  3. After extension 4003 answers the call, the call is established.
  4. The call ends if either party hangs up.
Check events

After the API request is sent, PBX sends the CallStatus event and ExtensionStatus event.

  • For parameters description of CallStatus event, refer to CallStatus.
  • For parameters description of ExtensionStatus event, refer to ExtensionStatus.

After the call ends, PBX sends NewCdr event.

  • For parameters description of NewCdr event, refer to NewCdr.