VoIP Jitter Buffer Settings: Measure, Tune and Fix Choppy Audio
VoIP jitter buffer settings should be tuned only after measuring jitter and loss: set the buffer to about 2-3x typical jitter (usually 60-150 ms), and if jitter keeps spiking, fix queuing with QoS or shaping instead.
- Late packets that miss the jitter buffer are discarded and counted as loss, which is what makes audio choppy or robotic.
- Asterisk does not jitter-buffer by default, and direct_media or native bridging bypasses any buffer you configure.
- Size the buffer at roughly 2-3x typical jitter and raise it in steps (60, 100, 150 ms), re-testing after each change.
- Stacked buffers in phone, Asterisk and carrier add their delays together, so enable one buffer per path unless you have a reason.
- Jitter on both call legs or periodic spikes point to the network path, where SQM and DSCP marking fix the cause and buffers only hide it.
What does a jitter buffer do, and why does it cause choppy audio?
Jitter is the variation in spacing between RTP packets. A phone sending G.711 with 20 ms packetization emits a packet every 20 ms, but the network may deliver them at 5, 45, 18 and 30 ms gaps. RFC 3550 defines interarrival jitter as a smoothed running average of that variation.
A jitter buffer holds packets briefly and plays them out at an even pace. If a packet arrives after its playout time, the buffer discards it, so late packets count as loss. That is the mechanism behind choppy, robotic or garbled audio on a link where speed tests look fine: a speed test measures throughput, not the timing of small packets under load.
Latency, jitter and loss are separate. Latency is fixed delay, jitter is its variation, and loss is missing packets, including the late ones the buffer threw away. A bigger buffer trades loss for extra fixed delay on every call.
| Metric | Good | Starts to hurt | Notes |
|---|---|---|---|
| Jitter | under 30 ms | 30-50 ms and above | Buffer is typically 2-3x typical jitter |
| One-way delay | under 150 ms | above 150 ms | Includes codec, network and buffer delay |
| Packet loss | under 1% | above 1% | Late discards count here too |
How do I measure jitter and packet loss on Asterisk?
Measure during a bad call, not on an idle network. Start with the channel statistics, then confirm with a packet capture.
RTP jitter is carried in timestamp units. At 8 kHz audio, divide by 8 to get milliseconds, so a raw value of 240 is 30 ms. Asterisk CLI output usually already shows milliseconds or seconds, so check the column header.
# PJSIP: per-channel Jitter / Loss / RTT columns
asterisk -rx "pjsip show channelstats"
# chan_sip equivalent
asterisk -rx "sip show channelstats"
# Raw RTCP reports as they arrive
asterisk -rx "rtcp set debug on"
asterisk -rx "rtcp stats on"
# RTP packet flow and SIP signalling
asterisk -rx "rtp set debug on"
asterisk -rx "pjsip set logger on"
sngrep
# In the dialplan, after the call:
# ${RTPAUDIOQOS} ${RTPAUDIOQOSJITTER} ${RTPAUDIOQOSLOSS} ${RTPAUDIOQOSRTT}
# ${CHANNEL(rtcp,all)} on newer versionsHow do I read RTP Stream Analysis in Wireshark?
Capture on the PBX or a mirrored switch port during the problem, then open Telephony > VoIP Calls, select the call and choose Flow Sequence or Play Streams. Use Telephony > RTP > RTP Stream Analysis for numbers.
Compare both directions. Wireshark computes jitter from where it captured, so a capture on the PBX shows the quality of what arrives at the PBX, which is the upstream leg from the phone.
| Field | Meaning | What to look for |
|---|---|---|
| Max Delta | Largest gap between consecutive packets | Well above 20 ms spacing (for example 200 ms) means a stall or burst |
| Mean / Max Jitter | RFC 3550 jitter in ms | Mean above 30 ms is a problem; max shows spikes |
| Sequence Errors | Out-of-order or missing sequence numbers | Non-zero means loss or reordering |
| Lost % | Packets never seen | Above 1% is audible |
Is it jitter, loss or something a buffer cannot fix?
The pattern tells you where the problem is. Read the numbers from both call legs: jitter on both legs means the path is at fault, while jitter on one leg points to that endpoint or its access link.
Some robotic audio has nothing to do with the network, so rule these out before touching buffers.
| Observation | Likely cause | Action |
|---|---|---|
| Steady low jitter (under 20 ms) but loss | Buffer too small or real loss | Raise buffer, then check the path for loss |
| Periodic spikes every N seconds | Backup, cloud sync or Wi-Fi scanning or roaming | Find the competing traffic, apply QoS, fix Wi-Fi |
| High jitter upstream only | Uplink saturation | Shape at 85-95% of uplink with SQM and prioritise EF |
| Jitter on both legs | Network path problem | Fix the path; buffer only masks it |
| Clean RTCP but robotic audio | CPU steal on a VM, transcoding load (G.729/Opus), ptime mismatch, Wi-Fi power save on handsets | Check core show channels, CPU and steal, avoid transcoding, align ptime, disable power save |
Where do VoIP jitter buffer settings live and how do I configure them?
There can be four buffers in a call: the IP phone, Asterisk, the SBC or carrier and any softphone. Asterisk does not jitter-buffer by default, so the phones and carrier usually do the work. Calls bridged with direct_media never pass through Asterisk media, and native RTP bridging skips the Asterisk buffer too.
Adaptive buffers resize with measured jitter, which suits internet links, but they can lag behind a sudden burst and glitch. Fixed buffers give predictable delay but must be sized correctly, and suit stable LANs. Phones usually expose min, max and initial values or a fixed option in the provisioning profile (Yealink, Polycom and Grandstream all do, with different names).
For Asterisk with chan_sip, set the buffer in the [general] section. For PJSIP, use the JITTERBUFFER() function on the channel that receives the audio. It must be placed on the channel before the bridge, and it has no effect on a leg that is natively bridged or on a transcoded leg where it was not applied.
; sip.conf (chan_sip) [general]
jbenable=yes
jbforce=no ; yes forces it even when the peer has its own buffer
jbimpl=adaptive ; fixed or adaptive
jbmaxsize=200 ; ms, do not set huge
jbresyncthreshold=1000
jblog=no
; PJSIP: extensions.conf
exten => _X.,1,Set(JITTERBUFFER(adaptive)=default)
same => n,Dial(PJSIP/${EXTEN})
; fixed 200 ms buffer instead
; same => n,Set(JITTERBUFFER(fixed)=200)
; keep Asterisk in the media path
; pjsip.conf endpoint: direct_media=noWhat jitter buffer size should I pick, and how do I tune it?
Change one variable at a time and keep notes. The buffer should cover typical jitter, not the worst spike; if spikes are large, the network needs fixing.
Worked example: Wireshark shows a mean jitter of 25 ms and a max of 70 ms on a cloud-hosted PBX. 2-3x the mean gives 50-75 ms, so start at 60 ms, then move to 100 ms if discards persist.
| Measured jitter | Pattern | Buffer setting or fix |
|---|---|---|
| under 15 ms | stable | Phone default or fixed 40-60 ms on LAN |
| 15-30 ms | stable | Adaptive, 60-100 ms |
| 30-50 ms | stable | Adaptive max 150 ms, and look at the path |
| above 50 ms or spikes | periodic or one-way | Stop tuning; fix queuing with QoS, SQM and VLANs |
- Capture a baseline during a bad call with channelstats and Wireshark.
- Pick the table value for the measured jitter and apply it to one place only, normally the phone.
- Make a repeat call under the same load and compare loss and jitter.
- Raise in steps, for example 60 to 100 to 150 ms, re-testing each time.
- Check that delay and talk-over are acceptable; above about 150 ms one-way, conversation suffers.
- Roll back if delay is noticeable, and leave jbmaxsize at 200 or less.
When should I stop tuning the buffer and fix the network?
Buffers hide a symptom. If jitter follows load, with spikes when a backup or upload runs, the cause is queuing in the router or ISP modem (bufferbloat), and a larger buffer only adds delay on top of it.
The real fixes are an SQM shaper such as fq_codel or CAKE at about 85-95% of the line rate so queues form in your router, a voice priority queue, DSCP EF (46) marking on RTP, and a separate voice VLAN. See the existing bufferbloat and DSCP articles for the setup steps.
Also avoid trusting speed tests as proof the link is fine, and avoid testing only when the network is idle. Test while someone uploads a large file, because that is when voice breaks.
Common questions
What is a good jitter value for VoIP?
Under 30 ms is good, and above 30-50 ms audio starts to degrade. Keep one-way delay under 150 ms and loss under 1% as well.
Is an adaptive or fixed jitter buffer better?
Adaptive suits internet links because it resizes with measured jitter, but it can lag behind sudden bursts. Fixed gives predictable delay on stable LANs if sized correctly.
Does Asterisk use a jitter buffer by default?
No. It only applies one when enabled with jbenable in chan_sip or the JITTERBUFFER() function in PJSIP. Direct media and native bridging bypass it.
Why is my VoIP audio robotic when RTCP looks clean?
Suspect CPU starvation or steal time on a VM, transcoding load from G.729 or Opus, mismatched ptime, or Wi-Fi power save on handsets. A buffer will not fix these.
Why does a bigger jitter buffer make calls feel laggy?
The buffer adds fixed delay to every call, and phone, Asterisk and carrier buffers add up. Past about 150 ms one-way delay, people start talking over each other.