Audio Stream Fields
The audio streams are encoded as 16-bit little-endian PCM, then Base64-encoded and transmitted to the third-party platform in JSON messages. This topic describes the fields in the JSON message transmitted via WebSocket.
Field Description
| Field | Description |
|---|---|
| channelid | The call channel ID of each party in the call. |
| callid | The unique ID of the call. |
| callflow | Call scenario. Note: If the field is
empty, it means the call does not match any of the scenarios
listed below.
|
| number | Caller ID of the call. |
| status | The current transmission status of the audio stream.
|
| audio | The audio payload containing PCM-encoded voice data for the call. |
Tip: To obtain additional call details, use the
callid provided in the audio stream packet to query the
information via the API. For more information, see Developer Guide - Query
Calls.Example
According to the number of call parties, the audio transmission methods differs.
- JSON message for a one-on-one call
- For a one-on-one call, the PBX establishes a single WebSocket connection
with the third-party platform and interleaves audio fragments from both call
parties over this connection, using two logical channels identified by
channelid.- The call is in progress.
- Channel 1
{ "callid":"1755940023.7" "callflow":"" "audio":"UkSDFj82nJKLm90qweRTyVxZaBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890ABCD..." "number":"1009", "status":"process" "channelid":"P]SIP/1009-XXXXX005' } - Channel 2
{ "callid":"1755940023.7" "callflow":"" "audio":"WHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA..." "number":"1010", "status":"process" "channelid":"P]SIP/1010-XXXXX006' }
- Channel 1
- The call ends.
- Channel 1
{ "callid":"1755940023.7" "callflow":"" "audio":"" "number":"1009", "status":"end" "channelid":"P]SIP/1009-XXXXX005' } - Channel 2
{ "callid":"1755940023.7" "callflow":"" "audio":"" "number":"1010", "status":"end" "channelid":"P]SIP/1010-XXXXX006' }
- Channel 1
- The call is in progress.
- JSON message for a multi-party call
-
For a multi-party call, the PBX establishes a dedicated WebSocket connection with the third-party platform for each call party, sending their individual audio fragments separately.Note: If a multi-party call is escalated from a one-on-one call, the PBX switches from a single WebSocket connection to multiple independent connections with the third-party platform, while preserving the sameThe following example illustrates JSON messages of a three-party conference in which each call party's audio is streamed over a separate WebSocket connection.
channel_idfor each original party andcall_idin JSON messages.- The call is in progress.
- Channel 1
{ "callid":"1769052671.54" "callflow":"conference" "audio":"Lm90qweRTyVxZaBcDeFgHi5ccll..." "number":"1000", "status":"process" "channelid":"PJSIP/1000-XXXX0020' } - Channel 2
{ "callid":"1769052671.54" "callflow":"conference" "audio":"HiJkLmNoPqRsTuVwXyZ1234567890ABCD..." "number":"1001", "status":"process" "channelid":"PJSIP/1001-XXXX0021' } - Channel 3
{ "callid":"1769052671.54" "callflow":"conference" "audio":"WHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5c..." "number":"2131005", "status":"process" "channelid":"PJSIP/2131005-XXXX0022' }
- Channel 1
- The call ends.
- Channel 1
{ "callid":"1769052671.54" "callflow":"conference" "audio":"" "number":"1000", "status":"end" "channelid":"PJSIP/1000-XXXX0020' } - Channel 2
{ "callid":"1769052671.54" "callflow":"conference" "audio":"" "number":"1001", "status":"end" "channelid":"PJSIP/1001-XXXX0021' } - Channel 3
{ "callid":"1769052671.54" "callflow":"conference" "audio":"" "number":"2131005", "status":"end" "channelid":"PJSIP/2131005-XXXX0022' }
- Channel 1
- The call is in progress.