Accept a Call

Accept an inbound call through the interface.

Background information

If Control Inbound Call is enabled for a specific trunk on PBX web portal, PBX will send an (30016) Inbound Call Invitation event to the third-party application when an inbound call through the trunk is received. In this call phase, the third-party application has 10 seconds to decide whether to accept the call via the interface.

Important: Calling this interface after the specified time would NOT take effect, i.e. if there is no response from the third-party application within 10 seconds, the PBX will accept and route the call to the destination of originated inbound route, and the interface will not take effect.

Prerequisites

You have enabled the Control Inbound Call feature for the desired trunk. For more example, see For more information, see Enable Yeastar P-Series Software Edition API.

Request URL

POST {base_url}/{api_path}/call/accept_inbound?access_token={access_token}

Request parameters

Table 1.
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) Inbound Call Invitation event.

Response parameters

Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed.
Note: You can check the error code and error message in Error Code and Error Message.
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.
call_id String The unique ID of each call.

Examples

Request example

POST /openapi/v1.0/call/accept_inbound?access_token=HLu2doEoDZpYcOqlvbCIzsbdD090Uo24 HTTP/1.1
Host: 192.168.5.150:8088
Content-Type: application/json
{
    "channel_id": "PJSIP/trunk-test-peer-trunking-endpoint-0000008f"
}

Response example

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "call_id": "1648627871.65"
}