Summary:ASTERISK-18077: When in queue on g722 with interruptions, music on hold can get stuck and no longer play
Reporter:Jonathan Rose (jrose)Labels:
Date Opened:2011-06-30 09:55:03Date Closed:2011-08-08 15:55:45
Status:Closed/CompleteComponents:Applications/app_queue Codecs/codec_g722 Formats/format_pcm Resources/res_musiconhold
Versions:Frequency of
is related toASTERISK-27232 When in queue on g722 with interruptions, music on hold can get stuck and no longer play
Environment:Ubuntu 10.04 32 bitAttachments:( 0) extensions.conf
( 1) jrose_Jun30_2011_g722_moh_patch.diff
( 2) queuemohstop.diff
( 3) queuemohstop.diff
( 4) queues.conf
( 5) sip.conf
Description:With a g722 call connected to the queue in the attached file, after listening up to the end of the second song, the music on hold will be interrupted by a generic Allison message about representatives being busy and once the message concludes, the following error will show up:

WARNING[16606]: format_pcm.c:140 pcm_seek: offset too large 2303040, truncating to 2232088

and at this point, the music will not resume and interruptions will continue as normal.  That message will continue to play with those same values after each interruption.

I'm including a patch which fixes the issue, but I don't really believe this is necessarily the correct approach.  I think it would probably be more prudent to detect when the file is being started at the end and begin at the beginning of the next file instead.

Comments:By: Jonathan Rose (jrose) 2011-06-30 09:55:46.176-0500

Possible solution, but probably the wrong approach.

By: Kinsey Moore (kmoore) 2011-07-19 16:00:15.339-0500

Attached is a patch that should address the issue.  When MOH resumes playing, it assumes it is at a known good seek location and that it can make at least a single read with no problem.  If this is not the case, the NULL frame causes moh_files_generate to return -1 which kills playback.  The attached patch ensures that there is at least a single good read for any format on resume since this could conceivably happen to any format.

By: Kinsey Moore (kmoore) 2011-07-21 14:43:48.693-0500

Fixed version of the patch, confirmed functional by jrose.

By: Kinsey Moore (kmoore) 2011-08-08 15:55:45.597-0500

Fix committed.

By: Jens T. (sesom42) 2017-08-29 17:33:47.942-0500

The same bug occurs again on Asterisk version 13.17.0 (used by FreePBX). After a certain amount of time MOH will not be played if the codec used is other than PCMA or PCMU, in my case G722.

[2017-08-29 21:28:24] VERBOSE[16086][C-00000036] res_musiconhold.c: Started music on hold, class 'default', on channel 'PJSIP/Telekom_XXXXXXXX-00000058'
[2017-08-29 21:28:24] WARNING[16086][C-00000036] format_pcm.c: offset too large 655360, truncating to 640523

By: Joshua C. Colp (jcolp) 2017-08-29 17:37:34.227-0500

[~sesom42] Please file a new issue with details instead of commenting on this.