MoH keeps restarting at the beginning - SOLVED

Hi everyone,

I’ve looked everywhere to try and work this out. For some reason, music on hold returns to the beginning each time I place a caller on hold. For example, if I need to place a caller on hold, speak to them and put them on hold again, they hear the first few seconds of the same song each time which I imagine is highly irritating!

I’ve played around to try and find a solution all day so I’m going a bit crazy!

In my log, I notice that hold music is stopped and started like this:

[2014-07-10 01:56:52] VERBOSE[2669][C-0000000b] res_musiconhold.c: -- Started music on hold, class 'default', on SIP/1000-00000012
[2014-07-10 01:56:52] VERBOSE[2669][C-0000000b] res_musiconhold.c: -- Stopped music on hold on SIP/1000-00000012
[2014-07-10 01:56:53] VERBOSE[2669][C-0000000b] res_musiconhold.c: -- Started music on hold, class 'default', on SIP/1000-00000012
[2014-07-10 01:56:58] VERBOSE[2669][C-0000000b] res_musiconhold.c: -- Stopped music on hold on SIP/1000-00000012

Seems sensible - if I place a caller on hold, they are played hold music and if I take them off hold, the music stops. When I put them on hold again, the music starts. However, the music starts from the beginning, as opposed to the previous position in the track.

I’m assuming that what I’m talking about is fairly standard? I have MOH continuing from it’s last position on 2 other FreePBX setups so I’m guessing I’m missing something stupid.

If anybody else has come across this and has an answer, I’d really appreciate it. Thank you.

Setup: FreePBX 2.11.0.38 running on a 64-bit CentOS 6.5 OpenVZ VPS

It is hold music not an iPod.

Usually you use generic “elevator” music that seamlessly loops and no one notices. Allison smith will do files with voiceover too

I don’t think that is true. It always restarts

Thanks for the replies. How weird - I’ve just tried it again on the other PBXs and it works really nicely. When I place a caller on hold, take them off and then put them on hold again, the music continues from the last position in the track.

I wonder if this is some sort of experimental feature which was implemented in Asterisk in an older version? Or perhaps my other PBXs are broken but providing me with the desired behaviour!

I’ve also noticed that when an announcement is played (for example, “you are in position one” etc.), the hold music returns to the beginning of the track. I know that this can’t be right - I have never had this happen with any implementation of Asterisk I’ve used in the past. Surely I’m not going completely mad?

OK, tried it again and it definitely works on my other FreePBX setups. The MoH configuration is identical so I can’t understand this. The log file on one of my other servers shows this:

> [2014-07-10 13:02:13] VERBOSE[3277][C-00000004] res_musiconhold.c: -- Started music on hold, class 'default', on SIP/1000-00000004
> [2014-07-10 13:02:20] VERBOSE[3277][C-00000004] res_musiconhold.c: -- Stopped music on hold on SIP/1000-00000004
> [2014-07-10 13:02:21] VERBOSE[3277][C-00000004] res_musiconhold.c: -- Started music on hold, class 'default', on SIP/1000-00000004
> [2014-07-10 13:02:23] VERBOSE[3277][C-00000004] res_musiconhold.c: -- Stopped music on hold on SIP/1000-00000004
> [2014-07-10 13:02:25] VERBOSE[3277][C-00000004] res_musiconhold.c: -- Started music on hold, class 'default', on SIP/1000-00000004
> [2014-07-10 13:03:10] VERBOSE[3277][C-00000004] res_musiconhold.c: -- Stopped music on hold on SIP/1000-00000004
> [2014-07-10 13:03:11] VERBOSE[3277][C-00000004] res_musiconhold.c: -- Started music on hold, class 'default', on SIP/1000-00000004
> [2014-07-10 13:03:14] VERBOSE[3277][C-00000004] res_musiconhold.c: -- Stopped music on hold on SIP/1000-00000004
> [2014-07-10 13:03:16] VERBOSE[3277][C-00000004] res_musiconhold.c: -- Started music on hold, class 'default', on SIP/1000-00000004
> [2014-07-10 13:03:19] VERBOSE[3277][C-00000004] res_musiconhold.c: -- Stopped music on hold on SIP/1000-00000004

I can’t see anything different in that. It works perfectly though - when a caller is placed on hold, they hear music, when they are taken off hold, the music stops and when they are put back on hold, they go back to the position in the song where they left it; exactly how it SHOULD work (in my opinion anyway!) This setup is running FreePBX 2.11.0.30.

Perhaps it is a bug in the res_musiconhold.c file? Where can I find this file and check (I’m guessing it’s an asterisk source file)?

I should add that I am NOT using streaming hold music or anything like that on my other PBXs. I’m using the same music files on what looks like an identical configuration (I think!)

Thanks

YES YES YES!!! I finally figured it out. I didn’t think that music was meant to restart each time - that would just be annoying! I’ve found a bug in the Asterisk code. From what I can tell, this affects 64-bit versions. The reason it worked on my other systems was because I was using a 32-bit compile.

For anyone who would like to fix it, you will need to replace res_musiconhold.so in /usr/lib64/asterisk/modules with the version found in this RPM: EDIT: See below

Remember to backup your old res_musiconhold.so (call it res_musiconhold.so.bak or something like that) just in case. ONLY copy res_musiconhold.so from the RPM - don’t replace anything else.

IMPORTANT: Only do this if you are having the same problem as me on a 64-bit compile and always make a backup of files. Try not to break your system!

Restart Asterisk by running “amportal restart”. That’s it - give it a test.

I’m so glad I worked this one out - I hope this helps everyone else.

EDIT: As the link has been removed, you can find the RPM by searching for something like “res_musiconhold.so 11.5.0 64bit rpm”. Always remember to check the source and do virus scans! The RPM that worked for me was Asterisk 11.5.0 x86_64. Remember, once you get the RPM, you only need the res_musiconhold.so file. Please understand the implications/risks of using precomplied files from previous versions of Asterisk.

This bug has now been filed with Asterisk:

https://issues.asterisk.org/jira/browse/ASTERISK-24019

have the same problem, can you help me?