SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

Call Quality in Twilio Flex: Understanding and Adjusting Jitter Buffer Size

Issue

If you’re using Twilio Flex for voice calls and have noticed issues like high latency, choppy audio, or a high rate of “network-affected” calls, especially when using conference calls, this article will help you understand the causes and how to address them. We’ll explain what a jitter buffer is, how it impacts call quality, and how you can adjust its settings in Flex to optimize your users’ experience.

 

Cause

What is a Jitter Buffer?

jitter buffer is a tool used in real-time voice communications to smooth out variations in packet arrival times (jitter) caused by network instability. By temporarily holding incoming audio packets, the jitter buffer helps ensure that audio is played out smoothly, even if some packets arrive late or out of order.

  • Larger jitter buffer: Reduces audio glitches but increases latency (delay).
  • Smaller jitter buffer: Reduces latency but may introduce audio artifacts (robotic or choppy sound) if the network is unstable.
  • Jitter buffer off: No smoothing; useful for troubleshooting but may result in poor audio if the network is unreliable.

 

Why Does Jitter Buffer Size Matter in Flex Conference Calls?

In Twilio Flex, conference calls often involve multiple participants, including agents using the Twilio Voice SDK (for web or mobile) and customers on the PSTN (regular phone network). If an agent’s network connection is unstable, it can cause high latency or audio issues for everyone in the conference.

By default, Twilio uses a “large” jitter buffer for conference calls to maximize audio smoothness. However, in some cases—especially when agents have consistently good network connections—reducing the jitter buffer size can lower latency and improve the real-time feel of conversations.

 

Resolution

How to Adjust Jitter Buffer Size in Twilio Flex

You can customize the jitter buffer size for agent legs in Flex conference calls by creating a Flex plugin and modifying the jitterBufferSize parameter in the beforeAcceptTask action.

Example code snippet:

Twilio.Flex.Actions.addListener("beforeAcceptTask", payload => {
  if (payload.task.taskChannelUniqueName === "voice") {
    payload.conferenceOptions.jitterBufferSize = "small"; // or "off"
  }
});
  • small: Reduces latency, may introduce some audio artifacts.
  • off: No jitter buffer; use for troubleshooting or advanced scenarios.

Note: This setting only affects the agent’s (SDK client) audio. It does not change the jitter buffer for PSTN participants.

 

What’s the Impact on Client Experience?

  • Lower latency: Conversations feel more real-time, but there may be occasional audio glitches if the network is unstable.
  • Audio artifacts: With a smaller buffer or no buffer, users may hear robotic or choppy audio during periods of high network jitter.
  • Troubleshooting: Turning the buffer off can help identify if network issues are causing audio problems.

We recommend testing these settings in a controlled environment before rolling them out widely. Monitor call quality and gather feedback from users to find the best balance for your use case.

 

Additional Information

Adjusting the jitter buffer size in Twilio Flex conference calls can help you optimize call quality for your agents and customers. If you’re experiencing high latency or network-affected calls, consider experimenting with the jitter buffer settings as described above. Always test changes in a safe environment and monitor the results to ensure the best experience for your users. More details are available in the following documents:

If you have further questions or need personalized guidance, our team is here to help!

Have more questions? Submit a request
Powered by Zendesk