[Home]

Summary:ASTERISK-28029: [patch] res_musiconhold : music on hold will not start if previous hold just reached end of file
Reporter:Frederic LE FOLL (flefoll)Labels:
Date Opened:2018-08-30 03:26:21Date Closed:2018-09-14 09:55:37
Priority:MinorRegression?
Status:Closed/CompleteComponents:Resources/res_musiconhold
Versions:13.13.0 Frequency of
Occurrence
Occasional
Related
Issues:
Environment:Music on hold class=fileAttachments:
Description:Observed randomly when a channel is put on hold and retrieved several times, music on hold won't play and CLI will display:
   -- Started music on hold, class '...', on channel '...'
immediately followed by:
   -- Stopped music on hold on ...

Analysis:

After adding a few logs, the problem appears to come from res_musiconhold.c moh_files_readframe() function.
This function is called for every sample reading. When sample reading fails, it calls ast_moh_files_next() to switch to next file.

But on MOH activation, moh_files_readframe() is called while current stream attached to channel is NULL and it calls ast_moh_files_next() immediatly, but it won't call ast_moh_files_next() again if sample reading fails. This may occur - because res_musiconhold retains last sample reading position in the channel data - if MOH during previous hold/retrieve just reached end of file (obviously, a bit of bad luck is required here).

I will propose a fix through Gerrit.

This problem was observed on Asterisk 13.13, but moh_files_readframe() has not changed much in time, including in more recent Asterisk versions. So, other versions should be affected too.
Comments:By: Asterisk Team (asteriskteam) 2018-08-30 03:26:23.076-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Friendly Automation (friendly-automation) 2018-09-14 09:55:41.255-0500

Change 10022 merged by Jenkins2:
res_musiconhold.c: Restart MOH if previous hold just reached end-of-file

[https://gerrit.asterisk.org/10022|https://gerrit.asterisk.org/10022]

By: Friendly Automation (friendly-automation) 2018-09-14 11:12:28.799-0500

Change 10057 merged by George Joseph:
res_musiconhold.c: Restart MOH if previous hold just reached end-of-file

[https://gerrit.asterisk.org/10057|https://gerrit.asterisk.org/10057]

By: Friendly Automation (friendly-automation) 2018-09-14 11:13:20.905-0500

Change 10056 merged by George Joseph:
res_musiconhold.c: Restart MOH if previous hold just reached end-of-file

[https://gerrit.asterisk.org/10056|https://gerrit.asterisk.org/10056]

By: Friendly Automation (friendly-automation) 2018-09-14 11:14:09.402-0500

Change 10055 merged by George Joseph:
res_musiconhold.c: Restart MOH if previous hold just reached end-of-file

[https://gerrit.asterisk.org/10055|https://gerrit.asterisk.org/10055]