API Quick Start
This topic describes how to call APIs and check the events by Yeastar demo tool.
Requirements
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.
- API demo settings
-
- In API demo, enter API version, the domain 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: Choose
HTTPS.
- Destination: Enter the domain of PBX.
- Port: Enter the web access port of PBX. In this example, enter 443.
- Version: Enter API version
2.0.0.
- 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.
- In API demo, enter API version, the domain of PBX, and the communication
port.
- Set up API authentication
-
- Call login
to get an API token.
- Call login
to get an API token.
- Send API request
-
- 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:
{"caller":"4001","callee":"4003"}
- Call call/dial to place a call to an extension.
- Observe the API result
-
If the API interface is called successfully, the subsequent process should be as follows:
- Caller 4001 rings first.
- After extension 4001 answers the call, the callee 4003 rings.
- After extension 4003 answers the call, the call is established.
- 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.