Monitor a Call

If call monitoring is allowed for extensions, the third-party application can monitor a call on a specific extension using another extension.

Prerequisite

The monitored extension should be allowed to be monitored (set in the Extension > Features > Call Monitor on the PBX ), otherwise the API call would not take effect.

Supported monitoring modes

The third-party application can monitor a call via the API interface in the following ways:
Call listening
The monitor can listen in on a call in real time, but can NOT talk with either party.
Call whispering
The monitor can listen in on a call in real time, and directly talk with the monitored extension without being heard by the other party.
Call barging
The monitor can listen in on a call in real time, and talk with both parties.

Request URL

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

Request parameters

Parameter Required Type Description
monitor Yes String The monitor's extension number.
channel_id Yes String The call channel ID of the monitored extension during a call.
Note: You can obtain the call channel ID in the (30011) Call Status Changed event.
type Yes String Monitor mode.

Valid value:

  • listen
  • whisper
  • barge

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

Extension 2008 listens in on the call of extension 2000.

POST /openapi/v1.0/call/listen?access_token=LymgRxH3mFJmIU7M5QR2MUlTo69RclR5 HTTP/1.1
Host: 192.168.5.150:8088
Content-Type: application/json
{
    "monitor": "2008",
    "channel_id":"PJSIP/2000-00000114",
    "type": "listen"
}

Response example

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