freeswitch
freeswitch copied to clipboard
Lost packets/jitter when using multiple play_and_get_digits
Hello,
Some jitter/lost packets seem to be introduced when playing multiple files with play_and_get_digits
one after another.
The jitter amount is between 0ms and 60ms.
The first file sounds fine, the problem appears with the next files.
According to Wireshark (capture on the host), there is 1s of missing packets for each file.
playback
application does not behave like this when playing the same files.
Additional info:
FreeSWITCH version: 1.10.6-release-18-1ff9d0a60e~64bit, from DEB package.
Debug logs does not show anything in particular.
The call is negociated for PCMU at 20ms. DTMF use RFC 2833 (the problem happens even when no DTMF is sent).
Tested with either WAV files from FreeSWITCH package or our files.
Simplified test dialplan:
<action application="play_and_get_digits" data="2 5 1 0 # /usr/share/freeswitch/sounds/en/us/callie/ivr/8000/ivr-provision_phone_permanently_to_extension.wav '' foobar \d+"/>
<action application="play_and_get_digits" data="2 5 1 0 # /usr/share/freeswitch/sounds/en/us/callie/ivr/8000/ivr-please_enjoy_music_while_party_reached.wav '' foobar \d+"/>
<action application="play_and_get_digits" data="2 5 1 0 # /usr/share/freeswitch/sounds/en/us/callie/ivr/8000/ivr-would_you_like_to_receive_a_call_at_this_number.wav '' foobar \d+"/>
<action application="play_and_get_digits" data="2 5 1 0 # /usr/share/freeswitch/sounds/en/us/callie/ivr/8000/ivr-phone_not_make_external_calls.wav '' foobar \d+"/>
and for playback
:
<action application="playback" data="/usr/share/freeswitch/sounds/en/us/callie/ivr/8000/ivr-provision_phone_permanently_to_extension.wav"/>
<action application="playback" data="/usr/share/freeswitch/sounds/en/us/callie/ivr/8000/ivr-please_enjoy_music_while_party_reached.wav"/>
<action application="playback" data="/usr/share/freeswitch/sounds/en/us/callie/ivr/8000/ivr-would_you_like_to_receive_a_call_at_this_number.wav"/>
<action application="playback" data="/usr/share/freeswitch/sounds/en/us/callie/ivr/8000/ivr-phone_not_make_external_calls.wav"/>
use the jitterbuffer. see if it still happens.
Hello and thanks for your answer. I tried with jitterbuffer without success, even with a 1s buffer. I think the delay is too big for jitterbuffer to help.
The first packet for each file is sent 1s after the previous file. I see these packets have the marker bit set (the sequence number and the timestamp have the next values). Some UA probably behave badly in this case (for instance Linphone has a really bad quality in this case while Jitsi has no problem).
Using send_silence_when_idle
does help, but the noise can be noticed compared to clean audio files, and the pause duration of 1s is meaningful in itself.
I don't known if this delay is part of a feature or not, it seems not to be linked to the values of either timeout
or digit_timeout
.
From the top of my head, I also used to run into this issue, when using LUA to call session:playAndGetDigits() multiple times.
The only workaround that I found and used back then, is to set the below variable before calling PlayAndGetDigits()...
session:setVariable("rtp_timer_name","none")
It seemed to work fine on a VM.
Thanks for the tip about rtp_timer_name
, it does not seem to make a difference in my case though.
We had the same issue on 1.10.7
, we only use session:playAndGetDigits()
once which works fine, the problem occurs when this is followed by session:streamFile()
or we transfer to the dialplan then use playback. There are no issues once we remove session:playAndGetDigits()
.
We tried the following variables and parameters but the problem was the same:
session:sleep(1000);
session:setVariable("rtp_timer_name","none")
rtp-autoflush=true
auto-rtp-bugs=clear
The timestamp in the RTP trace is continuously reset with the marker bit, which seems similar to these issues: https://github.com/signalwire/freeswitch/issues/146 https://github.com/signalwire/freeswitch/issues/949
Using send_silence_when_idle=400
fixed the problem for us, thanks @adrien-martin .
Thanks for this @adrien-martin
Using send_silence_when_idle=400
was the solution for this issue for us too!
There is still a very similar behavior that we get on our end in some cases when phrases are used, but that will probably warrant its own ticket since it's unrelated to session:playAndGetDigits().