Skip to main content

jitterbuffer_msec

Created by Ryan Harris, last modified by John Boteler on 2021.08.27

jitterbuffer_msec

string

Channel variable. Activates the jitter buffer. The jitter buffer has three params: length, max length, and max drift.

Usage

jitterbuffer_msec=buffer length:maximum buffer length:maximum drift

The three arguments specify the size of the jitter buffer either in units of milliseconds when only numerals are used or in the count of packets when the suffix 'p' is appended to the number.

buffer length – beginning length of jitter buffer

max length – maximum size to which the jitter buffer is allowed to grow

max drift – maximum delay the jitter buffer will tolerate before dropping frames to make up ground

Examples

Numeric time example

<action application="set" data="jitterbuffer_msec=60:200:20"/>
<action application="answer"/>

Packet count example

<action application="set" data="jitterbuffer_msec=2p:25p:4p"/>
<action application="answer"/>

Or to set it only on the subsequent outbound (Leg B) call: the export dialplan app sets a variable on both the current channel and on any channels it creates, while the 'nolocal:' directive disables setting it on the current (Leg A) channel and only sets it on the subsequent outbound channels.

Leg B only with nolocal:

<action application="export" data="nolocal:jitterbuffer_msec=60"/>
<action application="bridge" data="sofia/default/888@conference.freeswitch.org"/>

You can also activate the Jitter Buffer in the bridge as follows:

jb in bridge app

<action application="bridge" data="{jitterbuffer_msec=60}sofia/gateway/$1@gateway.com"/>

This will add a jitter buffer to packets flowing from a remote gateway towards a local freeswitch user. The network would look like this:

(local sip user) -----> FreeSWITCH -----> (remote gateway)

Where the link between FreeSWITCH and the remote gateway has jitter, and say the local SIP user has no jitter buffering on their IP-phone. This will help the voice quality for the incoming audio.