[asterisk-bugs] [JIRA] (ASTERISK-28029) [patch] res_musiconhold : music on hold will not start if previous hold just reached enf of file

Frederic LE FOLL (JIRA) noreply at issues.asterisk.org
Thu Aug 30 03:31:54 CDT 2018


     [ https://issues.asterisk.org/jira/browse/ASTERISK-28029?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Frederic LE FOLL updated ASTERISK-28029:
----------------------------------------

    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.

  was:
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.


> [patch] res_musiconhold : music on hold will not start if previous hold just reached enf of file
> ------------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-28029
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28029
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_musiconhold
>    Affects Versions: 13.13.0
>         Environment: Music on hold class=file
>            Reporter: Frederic LE FOLL
>            Severity: Minor
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list