I’ve been trying to apply a jitter buffer to the B-Leg or device side of calls for some time now without any success. I’ve set the jitter buffer to something very large just to test, using an echo test on a call to *43. My audio is repeated to me instantly which is not what I expect, instead the audio back to me should be delayed by 4000ms.
In sip_general_custom.conf, this setting seems to apply to the receive of the TRUNK, even though that has separate jbenable / jb… settings of just 64 ms fixed jitter buffer. The trunk is not the issue as its fibre from the hosting provider to the trunk.
It’s the devices out in the field that are sending auto back over wifi, 3g or satellite (remote phones). I know this configuration only applied to a CHANSIP extension and that’s what it’s been setup as. Any solution for sip or pjsip is ok.
Calling from the device: 613 791 8378, 4000 ms delay in the echo test because the jitter buffer is on the receive of a SIP channel, but its from the trunk.
Calling *43 from the device, zero delay in the echo test.
Check in the comments too, and you’ll see an example of adding a jitterbuffer on the outgoing channel, but I’ll post it here too just in case. You can add a jitter buffer to the outbound channel by using a pre-dial handler:
; outbound pre-dial handler
exten => predial_outbound,1,NoOp()
same => n,Set(JITTERBUFFER(adaptive)=default)
same => n,Return()
exten => 101,1,NoOp()
same => n,Dial(PJSIP/${EXTEN},20,b(default^predial_outbound^1))
same => n,Hangup()
In Asterisk jitterbuffers only ever work on the read side of a channel. So if Alice is calling Bob, and you want to add a jitterbuffer to the Alice channel you can do that in the dialplan before dialing Bob:
exten => bob,1,NoOp()
; This adds a jitterbuffer on the channel that's about to dial Bob, Alice in this case
same => n,Set(JITTERBUFFER(adaptive)=default)
same => n,Dial(${TECH}/bob)
same => n,Hangup()
In this scenario just before Alice dials Bob and a jitterbuffer gets added to Alice’s channel. This means that all audio coming from Alice (the endpoint) gets read through her jitterbuffer. In this setup when Bob is dialed no jitterbuffer is added to his read channel. Meaning audio coming from Bob (the endpoint) does not get passed though a jitterbuffer. If you want a jitterbuffer applied to Bob’s read queue then you need to add that using the predial handler:
exten => predial_outbound,1,NoOp()
; This adds a jitterbuffer to the channel being dialed, Bob in this case
same => n,Set(JITTERBUFFER(adaptive)=default)
same => n,Return()
exten => bob,1,NoOp()
; This adds a jitterbuffer on the channel that's about to dial Bob, Alice in this case
same => n,Set(JITTERBUFFER(adaptive)=default)
same => n,Dial(${TECH}/${EXTEN},20,b(default^predial_outbound^1))
same => n,Hangup()
If you want similar to occur when Bob calls Alice then you have to do the same thing when Alice is dialed.
Thanks, so I did get this working but my context’s must be wrong (under FreePBX) [macro-dialout-one-predial-hook] works for the dialer jitter buffer but the only and obviously wrong place I could get this working for the receiver was in [func-apply-sipheaders].
[from-internal] and [from-internal-custom] didn’t work surprisingly…
Also this does not work when the Trunk and the Extension share the same codec (in this case G.711u). When the device codec is G722, it does work for both devices (caller and callee).