[asterisk-users] JITTERBUFFER function

Torbjörn Abrahamsson torbjorn.abrahamsson at gmail.com
Thu Jan 29 13:56:24 CST 2015

> > 1.       Do I need to activate jbenable in sip.conf? Or is it enough to
> > the JITTERBUFFER function?
> You only need to use the JITTERBUFFER function.
> The jbenable option will enable a jitter buffer on every channel
> created for that peer (or, if global, for every peer in the system).
> Depending on the version of Asterisk, it will also place the jitter
> buffer on the write side of the channel, which is often not what you
> want.

Thank you very much. Two questions though: First, you say that if I set
jbenable=yes in sip.conf in the general section, this will add a JB to all
channels. But sip.conf says:

; jbenable = yes              ; Enables the use of a jitterbuffer on the
receiving side of a
                              ; SIP channel. Defaults to "no". An enabled
jitterbuffer will
                              ; be used only if the sending side can create
and the receiving
                              ; side can not accept jitter. The SIP channel
can accept jitter,
                              ; thus a jitterbuffer on the receive SIP side
will be used only
                              ; if it is forced and enabled.

; jbforce = no                ; Forces the use of a jitterbuffer on the
receive side of a SIP
                              ; channel. Defaults to "no".

I thought this meant that jbenable alone was not enough, and that you needed
to set jbforce=yes. Incorrect then?

Second, if I understand your statement correctly you say that the
jb-settings can be applied on peers as well as in the general context. As
the jb-settings are not a part of the list of peer-settings stated in
sip.conf I thought that it was a general-context-only setting, which is
actually why I am exploring the JITTERBUFFER function. If I can set the
jb-settings directly on the peer, things will be a lot easier. If the
settings are valid for peers, then maybe they should be added to the peer
settings list in sip.conf?

> > 2.       What is the preferred way to invoke this function? Say I have
> > channel A which is not in need of buffering, while channel B do need it.
> > A calls B and I do Set(JITTERBUFFER(fixed)=default), my guess is that it
> > will be attached to channel A:s read side. This is not the desired
> > as I would like to have it on B:s read side. How should I invoke this to
> > make the buffer belong to channel B? Maybe using b option to Dial? So
> > when a JB-enabled device (B) calls out one just calls JITTERBUFFER from
> > normal dialplan flow, and if there is a call to the device (B) one need
> > use b option? Sound correct?
> >
> Invocation examples are on the wiki:
> The JITTERBUFFER function only affects the channel it is placed on,
> and not any channel it may be bridged with. That means you have to
> place it on the correct channel and not expect some magicry inside
> Asterisk to try and manipulate things for you (which is almost always
> a bad implementation decision). If you need it on an outbound channel,
> that means using one of the pre-dial handlers
> (https://wiki.asterisk.org/wiki/display/AST/Pre-Dial+Handlers) to
> place the jitter buffer on the outbound channel after its creation.
> Example:
> [default]
> exten => set_up_outbound,1,NoOp()
>  same => n,Set(JITTERBUFFER(adaptive)=default)
>  same => n,Return()
> exten => outbound_dial,1,NoOp()
>  same => n,Dial(PJSIP/Alice,,b(default^set_up_outbound^1))
>  ...

Perfect, then I guessed correctly. :)

I actually looked at the JITTERBUFFER wiki page, and found the examples you
mention. But they are only examples of how to start the buffer on the
calling channel. Maybe adding what you just told me here to that page would
make it easier for others to grasp as well?

Anyway, thank you very much. Very appreciated!

Keep up the good work.

Torbjörn Abrahamsson

More information about the asterisk-users mailing list