copyright: years: 2018, 2023 lastupdated: "2023-01-05"
Monitoring RTP audio streams by using RTCP
You can configure IBM® Voice Gateway to monitor audio streaming by enabling the RTP Control Protocol (RTCP). When RTCP is enabled, Voice Gateway reports network-related incidents in reporting events and in the vgwNetworkWarnings
state
variable. Enabling RTCP is supported in Version 1.0.0.5 and later.
About audio stream monitoring
Voice Gateway uses the Real-time Transport Protocol (RTP) to send and receive audio streams from an end system, such as a SIP trunk. The RTP Control Protocol (RTCP) is part of the RTP specification (RFC 3550) and provides quality of service (QoS) statistics for RTP media streams. When RTCP is enabled, Voice Gateway uses the protocol to monitor RTP network data delivery metrics, such as jitter and packet transmission.
When audio stream monitoring with RTCP is enabled, Voice Gateway reports the following information:
-
Network warnings: When a network-related incident occurs, such as high packet loss rate or a high average jitter in the RTP stream, the SIP Orchestrator and Media Relay log a warning. Voice Gateway also reports these warnings to the following places:
- For each Watson Assistant turn, Voice Gateway reports warnings in the Watson Assistant turn event, if Watson Assistant turn event reporting is enabled. Voice Gateway also sends the warnings on the
vgwNetworkWarnings
API state variable, which is sent to Watson Assistant or service orchestration engine. - At the end of the call, the warnings are included in a
warnings
object in a call detail record event, if CDR event reporting is enabled.
- For each Watson Assistant turn, Voice Gateway reports warnings in the Watson Assistant turn event, if Watson Assistant turn event reporting is enabled. Voice Gateway also sends the warnings on the
-
Network summaries: Voice Gateway provides a network summary in a
rtpNetworkSummary
object within the call detail record event. The network summary contains statistics from the inbound and outbound audio streams in the call, including average and maximum jitter and packet information.
Note that if the RTP end system does not support RTCP, outbound stream jitter and packet loss can't be reported.
Important: Enabling RTCP uses an additional UDP port per call. For each call, RTP uses a dynamic port within the range set on the RTP_UDP_PORT_RANGE
environment variable, and RTCP uses the next port. For example,
if RTP uses port 16384, RTCP will use port 16385. Make sure that these ports are open in your firewall. For more information, see Port settings for firewalls.
Enabling RTCP
To enable RTCP, set the following environment variables under the Media Relay container in your deployment configuration:
Environment variable | Default value | Description |
---|---|---|
ENABLE_RTCP Required |
false |
Set to true to enable use of the RTP Control Protocol (RTCP) to monitor RTP audio streaming. When RTCP is enabled, warnings that were generated during the call and network summaries with audio stream statistics are included
in call detail record (CDR) reporting events. Version 1.0.0.5 and later. |
RTCP_MAX_JITTER_THRESHOLD Optional |
30 |
The maximum delay in milliseconds between RTP packets before a warning is triggered. If this maximum is exceeded, Voice Gateway issues a warning for the affected inbound or outbound audio stream. Version 1.0.0.5 and later. |
RTCP_MAX_PACKET_LOSS_THRESHOLD Optional |
5 |
The maximum percentage of lost packets before a warning is triggered. If this maximum is exceeded, Voice Gateway issues a warning for the affected inbound or outbound audio steam. Version 1.0.0.5 and later. |
The following examples enable RTCP and change the default values for sending jitter and packet loss warnings.
- For Docker:
media.relay: environment: ... - ENABLE_RTCP=true - RTCP_MAX_JITTER_THRESHOLD=45 - RTCP_MAX_PACKET_LOSS_THRESHOLD=10
- For Kubernetes in IBM Cloud Kubernetes Service:
"env": [ ... { "name": "ENABLE_RTCP", "value": "true" }, { "name": "RTCP_MAX_JITTER_THRESHOLD", "value": "45" }, { "name": "RTCP_MAX_PACKET_LOSS_THRESHOLD", "value": "10" }]
Reported network information
When RTCP is enabled, Voice Gateway reports network warnings during the call and then aggregates the warnings and provides a network summary when the call ends.
During the call
For each conversation turn, Voice Gateway sends network warnings to the configured Watson Assistant service or service orchestration engine on the vgwNetworkWarnings
state variable. You can use this state variable as a trigger
to perform an appropriate action, such as transferring or ending the call. For more information about using state variables, see Programming self-service agents using the Voice Gateway API.
For example:
"vgwNetworkWarnings" : [
{
"timestamp": "2018-02-08T13:10:01Z",
"message": "CWSMR0035W: The inbound RTP audio stream packet loss of 7 percent exceeds the maximum packet loss threshold of 5 percent.",
"id": "CWSMR0035W"
}
]
Because Watson Assistant turn events contain the complete context as sent from Watson Assistant or a service orchestration engine, the events also include the reported warnings. For more information, see Reporting Watson Assistant turn events from Voice Gateway.
At the call end
When the call ends, voice Gateway aggregates the reported network warnings and provides an RTP network summary in a call detail record (CDR) event. To generate CDR events, you must enable CDR event reporting in the Voice Gateway configuration and set up a REST server to store the events. For more information, see Reporting call detail record events from Voice Gateway.
RTCP adds to the following JSON objects within the event:
warnings
: Adds RTP network warnings to the list of warnings that were logged during the call. See Warning details.rtpNetworkSummary
: Data delivery statistics for the inbound and outbound RTP audio streams. See RTP network summary details