Edit WebSocket Audio Streaming Setting

Edit the WebSocket audio streaming settings, including WebSocket server URL, sample rate of transmission, subscription objects, and so on.

Request URL

POST {base_url}/{api_path}/websocketaudiostream/update?access_token={access_token}

Request parameters

Table 1.
Parameter Required Type Description
enable No Integer Whether to enable WebSocket Audio Streaming feature.

Valid value:

  • 0: Disabled
  • 1: Enabled
websocket_url No String WebSocket server address for receiving audio streams.

For example, ws://docs.example.cloud.com:8080.

Note: The maximum character length is 255.
auth_key No String The name of the authentication field required by the third-party platform.
Note: The maximum character length is 63.
auth_value No String Authentication value.
Note: The maximum character length is 255.
sample_rate No Integer Sample rate.

Valid value:

  • 0: 8000Hz
  • 1: 16000Hz
enable_ext No Integer Whether to subscribe to specific extensions to obtain their associated call audio streams.

Valid value:

  • 0: Disabled
  • 1: Enabled
enable_trunk No Integer Whether to subscribe to specific trunks to obtain their associated call audio streams.

Valid value:

  • 0: Disabled
  • 1: Enabled
enable_did No Integer Whether to subscribe to specific DID numbers to obtain their associated call audio streams.

Valid value:

  • 0: Disabled
  • 1: Enabled
subscribe_list No Array <Subscribe_List> The information of subscribed objects.
Note: To successfully add subscription objects, you need to set the corresponding value of enable_ext, enable_trunk or enable_did to 1.
Subscribe_List
Table 2.
Parameter Required Type Description
subscribe_id Yes Integer The ID of the subscription object.
Tip: You can call Get Menu Options to get IDs of extensions, extension groups, organization, trunks or DID numbers.
subscribe_type Yes Integer The type of the subscription object.

Valid value:

  • extension
  • ext_group
  • organization
  • trunk
  • did

Response parameters

Table 3.
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.

Examples

Request example

POST /openapi/v1.0/websocketaudiostream/update?access_token=iioRRjGzPoYGGJLjh7zkYfYxj3Xe4oqW HTTP/1.1
Host: 192.168.5.150:8088
Content-Type: application/json
{
    "auth_key": "yyyy",
    "auth_value": "chasnCjhsbvkslMCWJIEOFKCJKABHCOACLNHCSHJBCssss",
    "enable": 1,
    "enable_did": 0,
    "enable_ext": 1,
    "enable_trunk": 0,
    "sample_rate": 1,
    "subscribe_list": [
        {
            "subscribe_id": 50,
            "subscribe_type": "extension"
        }
    ],
    "websocket_url": "wss://docs.example.cloud.com"
}

Response example

HTTP 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS"
}