Refuse a Call
Refuse an inbound call.
Background information
If Control Inbound Call is enabled for a specific trunk on PBX web portal (Path: ), whenever an inbound call arrives on that trunk, the PBX will hold the call for up to 10 seconds and send an (30016) Incoming Call Request event to the third-party application.
Within this 10-second window,
the third-party application can decide how to handle the inbound
call:
- Accept the call: Call the
call/accept_inboundinterface. The PBX will then immediately route the call to the pre-configured destination as defined in the inbound route. - Refuse the call: Call the
call/refuse_inboundinterface. The PBX will drop the call immediately, and the destination will not ring.
Important: Calling these interfaces after the
10-second window will NOT take effect. Once the 10-second window elapses, the
PBX will automatically accept and route the call to the pre-configured
destination.
Prerequisites
You have enabled the Control Inbound Call feature for the desired trunk. For more example, see Enable Yeastar P-Series PBX System API.
Request URL
POST {base_url}/{api_path}/call/refuse_inbound?access_token={access_token}
Request parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| channel_id | Yes | String | The
call channel ID of the inbound call. Note: You can obtain the call channel ID in
the (30016) Incoming Call Request
event. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| errcode | Integer | Returned error code.
Note: You can check the error code and
error message in Error Code and Error Message.
|
| errmsg | String | Returned message.
|
| call_id | String | The unique ID of each call. |
Examples
Request example
POST /openapi/v1.0/call/refuse_inbound?access_token=Ey7Ty0kL7bpOfPHgpJH2Qq4ozMvU4IEs HTTP/1.1 Host: 192.168.5.150:8088 Content-Type: application/json { "channel_id": "PJSIP/trunk-test-peer-trunking-endpoint-00000091" }
Response example
HTTP/1.1 200 OK { "errcode": 0, "errmsg": "SUCCESS", "call_id": "1650780369.279" }