Summary:ASTERISK-13836: [patch] Asterisk commands "moh reload" or "reload res_musiconhold.so" causes MOH not to work properly
Reporter:Joselito Tagarao (lidocaineus)Labels:
Date Opened:2009-03-26 00:53:39Date Closed:2009-06-01 15:09:58
Versions:Frequency of
Environment:Attachments:( 0) 20090518__issue14759.diff.txt
Description:This is the *exact* same bug as 0013222 ( http://bugs.digium.com/bug_view_advanced_page.php?bug_id=13222#91240 ) but I don't seem to have access to reopen the bug report and feedback has been closed.  The symptoms are the same, the reproducibility and behavior are all still there, exactly as described succinctly by urzedo in response #91240 ( http://bugs.digium.com/bug_view_advanced_page.php?bug_id=13222#91240 ).

From the previous bug report's description:

SIP peer A is calling SIP peer B. When A put B on hold, B starts to listen to the MOH configured in the parameter "mohsuggest" of the peer A. If I look at Asterisk's verbose, I can see "Started music on hold..." and "Stopped music on hold..." stuff while peer A press the hold button.

During the above conversation, if someone runs "moh reload" or "reload res_musiconhold.so", than peer B is not able anymore to listen to the MOH when A press the hold button. In the Asterisk's verbose, I cannot see "Started music on hold..." and "Stopped music on hold..." anymore.

If "moh reload" or "reload res_musiconhold.so" commands are executed again, than everything starts to work again. And so on...
Comments:By: urzedo (urzedo) 2009-03-30 08:30:49

Hi all,

I have created issue ASTERISK-12506 and I would like to share how I could finally resolve that issue.

It was very simple. The way we used to write the musiconhold.conf file was the same since asterisk 1.x. Recently, after moving to 1.4, we noticed that the way that file is written is a little different. We switched to the new 1.4 formatting and the issue never happened again! See bellow the "new" formatting I am talking about:

directory=/var/lib/asterisk/sounds/ --> (where the files are)

Hope it helps!

By: Joselito Tagarao (lidocaineus) 2009-03-30 11:53:38

urzedo - nice, that worked perfectly.

Did the old format of the config file lines get deprecated?  I didn't see that it did anywhere.  If it didn't, there's probably a bug in the parsing of the musiconhold.conf file.

By: Leif Madsen (lmadsen) 2009-04-01 13:44:24

What does the old configuration look like, and what does the current (working) configuration look like?

By: Joselito Tagarao (lidocaineus) 2009-04-01 13:45:58

Old way:

default => quietmp3:/var/lib/asterisk/mohmp3

Newer working way:

mode => quietmp3
directory => /var/lib/asterisk/mohmp3

By: Leif Madsen (lmadsen) 2009-05-15 09:05:39

OK I have finally come back to this and reproduced.

Using the old formatting in musiconhold.conf, when we do a reload oh the MOH system while the phone is on hold, we can't put them back on hold (with music).

I would agree this appears to be a problem with the way res_musiconhold.c parses the file on reload. This should work as the formatting is deprecated, but should still work.

BTW: It *is* mentioned as deprecated in the UPGRADE-1.2.txt file in the root of the asterisk source directory. Additionally, you get a WARNING on startup mentioning that the formatting of musiconhold.conf has changed.

By: Leif Madsen (lmadsen) 2009-05-15 09:06:14

Reassigned to Tilghman to look at when he has a chance.

By: Tilghman Lesher (tilghman) 2009-05-18 15:01:31

Patch uploaded, ready for testing.

By: Leif Madsen (lmadsen) 2009-06-01 11:14:39

Works for me!

By: Digium Subversion (svnbot) 2009-06-01 15:07:05

Repository: asterisk
Revision: 198665

U   branches/1.4/res/res_musiconhold.c

r198665 | tilghman | 2009-06-01 15:07:05 -0500 (Mon, 01 Jun 2009) | 7 lines

If using the old deprecated format, a reload would cause the class to disappear.
(closes issue ASTERISK-13836)
Reported by: lidocaineus
      20090518__issue14759.diff.txt uploaded by tilghman (license 14)
Tested by: lmadsen



By: Digium Subversion (svnbot) 2009-06-01 15:09:57

Repository: asterisk
Revision: 198666

_U  trunk/

r198666 | tilghman | 2009-06-01 15:09:57 -0500 (Mon, 01 Jun 2009) | 13 lines

Blocked revisions 198665 via svnmerge

 r198665 | tilghman | 2009-06-01 15:07:04 -0500 (Mon, 01 Jun 2009) | 7 lines
 If using the old deprecated format, a reload would cause the class to disappear.
 (closes issue ASTERISK-13836)
  Reported by: lidocaineus
        20090518__issue14759.diff.txt uploaded by tilghman (license 14)
  Tested by: lmadsen