Lost frame(s) from slin to opus/ulaw/alaw

Hello,

I am using Asterisk 20.4.0 and FreePBX along with wdoekes/asterisk-chan-dongle to handle calls on my SIM card via VoIP. The incoming audio from the dongle to my PJSIP extension is working perfectly. However, I’m encountering issues with outgoing audio from my PJSIP extension to the dongle, as it intermittently cuts in and out during calls, to a severe extent.

I have observed warnings like the following in the Asterisk console while on a call:

translate.c:603 ast_translate: 9540 lost frame(s) 9541/0 (slin@48000)->(opus@48000)

I attempted to address this issue by changing the audio codec in the SIP settings from Opus to ULAW and ALAW, but I’m still experiencing audio cuts and receiving similar warnings in the logs:

For ULAW:

translate.c:603 ast_translate: 2861 lost frame(s) 2862/0 (slin@8000)->(ulaw@8000)

For ALAW:

translate.c:603 ast_translate: 13543 lost frame(s) 13544/0 (slin@8000)->(alaw@8000)

I would greatly appreciate any insights or suggestions to resolve this issue.

You’re using a patched version of Asterisk (that log message isn’t in Asterisk - it’s from an outside patch) which alters translation and adds in some packet loss concealment stuff. This patch was actually reverted when it was attempted to be included due to test failures. I’d suggest trying without the patch.

I think that is from pjsip that was compiled as a requirement for compiling asterisk.

Anyways, I resolved the issue by following the Gain control and Jitter buffer section of wdoekes/asterisk-chan-dongle github repository.
They use AGC dialpan function in func_speex module to resolve the noise issue.

Despite this being marked as a solution I’m just adding a comment that the log message is NOT from PJSIP. It is from an Asterisk specific patch unrelated to PJSIP.