It seems strange that you can label your MOH files as 01moh.wav, 02moh.wav, 03moh.wav etc… but when they’re uploaded they appear in a different sort order. What makes this even more strange is that there is an option to play them randomly, which would suggest that the opposite of random was sorted, and yet I can find no way to do this.
Incidentally, I can’t achieve a sort order using AsteriskNOW 1.7.1 with Asterisk 1.6 either.
This is from the documentation of Asterisk musiconhold:
Files are played in normal sorting order (same as a sorted directory listing)
If you set one if these options you can get some sort of sorting:
sort=random ; Sort the files in random order
sort=alpha ; Sort the files in alphabetical order. If this option is
; not specified, the sort order is undefined.
Unfortunately, you can’t do from FreePBX, you can try by adding the setting to musiconhold_additional.conf under one of your categories. Then you do a module reload in Asterisk CLI. Now try your Music on Hold and see if you get the desired result.
If you feel like it, please file a new ticket in the ticket system, setting it to a Feature Request, about these settings.
In Elastix, the files are actually sorted by FILE NAME LENGTH. Yes, that’s right. Just name the first file something like 01.wav, the next one 001.wav, and the next one 0001.wav, and you are good to go.
Putting sort = Alpha had no effect at all in musiconhold_custom.conf or musiconhold_additional.conf. But once I uploaded the 1st file with a shorter name, presto!
Just thought I’d share this with anyone hitting their head against the brick wall.
Suthern, could you help me? I am running Elastix 1.6-12 and I can’t get the MOH sorted. I have posted my question over at Elastix’s forum but haven’t gotten any replies yet. I am not sure what I am doing wrong.
This is the posting over at Elastix:
This seems like a easy task but I can’t get Elastix to play my 8 MOH files (1.wav, 2.wav, …8.wav) in ascending order. I tried using sort=alpha but still Asterisk play in some crazy order. Even the display of the files under the web interface is not correct.
OK, I got it working but under Elastix 2.0 not 1.6. Maybe there was a bug in the version.
FYI, I do need to add “sort=alpha” into the config file to make it work. I tried adding it to musiconhold_custom.conf but it didn’t sort correct.
This is my musiconhold_additional.conf
[acc_1]
mode=files
directory=/var/lib/asterisk/mohmp3/acc_1/
[default]
mode=files
directory=/var/lib/asterisk/mohmp3/
sort=alpha
[none]
mode=files
directory=/var/lib/asterisk/mohmp3/.nomusic_reserved
This doesn’t seem to work for me in FreePBX 2.9. Changing the sort to alpha in the conf file seems to get ignored. Wondering if anybody has it working in 2.9!