Page 1 of 1

MOH incorrect play order

PostPosted: Fri Dec 06, 2013 11:21 am
by PierreDeux
VERSION: 2.8-417a BUILD: 131019-0849 built using Vicibox 5.0.3, no extra anything.

I'm trying to create some custom MOH entries and seems that either my version has some kind of a bug or I dunno what else I should check. Here is what I did (basically I've already done this on another vicidial verion and it worked fine):
1. I took a couple of recordings, cut them by several 9-seconds pieces and uploaded them to Audio store
2. Created MOH entry with random = N, added my .wav pieces one by one making sure that the order is correct.
3. Saving everything, waiting for a minute till MOH entries will get updated.
However when trying to make a test call I'm always getting my recordings played in the wrong order. My MOH plays the 3rd piece before any other. It's not random, it's the same every time. Once I have less, than 2 pieces in my MOH entry - they play fine, however every time I add third piece - it stats mixing them.

I've double checked the configs:
Code: Select all
; Go Down Moses - Louis Armstrong
[louis_armstrong]
mode=files
directory=/var/lib/asterisk/louis_armstrong

; La boheme- Charles Aznavour
[french]
mode=files
directory=/var/lib/asterisk/french


and files:
Code: Select all
voip13:/var/lib/asterisk/french # ls -l
total 724
-rw-r--r-- 1 root root     33 Dec  6 11:06 0000_sip-silence.gsm
-rw-r--r-- 1 root root 144312 Dec  6 11:06 0001_boheme9.wav
-rw-r--r-- 1 root root 144312 Dec  6 11:06 0002_boheme18.wav
-rw-r--r-- 1 root root 144312 Dec  6 12:00 0003_boheme27.wav
-rw-r--r-- 1 root root 144312 Dec  6 12:00 0004_boheme36.wav
-rw-r--r-- 1 root root 144312 Dec  6 12:01 0005_boheme45.wav

voip13:/var/lib/asterisk/louis_armstrong # ls -l
total 580
-rw-r--r-- 1 root root     33 Dec  5 11:13 0000_sip-silence.gsm
-rw-r--r-- 1 root root 144200 Dec  6 09:56 0001_1godown.wav
-rw-r--r-- 1 root root 144200 Dec  6 09:57 0002_2godown.wav
-rw-r--r-- 1 root root 144200 Dec  6 09:59 0003_3godown.wav
-rw-r--r-- 1 root root 144200 Dec  6 09:59 0004_4godown.wav


Files are good too: playing them manually one by one proves that they are properly cut and named.
Any ideas?

Re: MOH incorrect play order

PostPosted: Fri Dec 06, 2013 11:58 am
by PierreDeux
As a part of my experiment I've added the same MOH entry to another vicidial server (VERSION: 2.8-403a BUILD: 130510-1350, asterisk 1.4) and it's working fine.

Re: MOH incorrect play order

PostPosted: Tue Dec 10, 2013 9:53 am
by PierreDeux
Bump! Still fighting with the issue :(

Re: MOH incorrect play order

PostPosted: Tue Dec 10, 2013 10:14 am
by DomeDan
try
sort=alpha
in the config file

or rename the files because apparently the files is sorted by file-name length
(in elastix at least, according to this post: http://www.freepbx.org/forum/freepbx/ti ... here-a-way)

Re: MOH incorrect play order

PostPosted: Tue Dec 10, 2013 12:11 pm
by PierreDeux
DomeDan wrote:try
sort=alpha
in the config file

or rename the files because apparently the files is sorted by file-name length
(in elastix at least, according to this post: http://www.freepbx.org/forum/freepbx/ti ... here-a-way)



You are my saver :) It works with sort=alpha, but: considering "french" context had different file names length - it could be the reason of such behavior, so what's wrong with another context? (that was also buggy and got fixed with "alpha" sorting) All file names are of the same length there:
-rw-r--r-- 1 root root 144200 Dec 6 09:56 0001_1godown.wav
-rw-r--r-- 1 root root 144200 Dec 6 09:57 0002_2godown.wav
-rw-r--r-- 1 root root 144200 Dec 6 09:59 0003_3godown.wav
-rw-r--r-- 1 root root 144200 Dec 6 09:59 0004_4godown.wav

Re: MOH incorrect play order

PostPosted: Wed Dec 11, 2013 5:30 am
by DomeDan
Good you had it solved!

the reason for the strange order might be that asterisk takes the files in the order they appear on disk, do a:
ls -f
to list files with no sorting order

Re: MOH incorrect play order

PostPosted: Wed Dec 11, 2013 8:41 am
by PierreDeux
Looks like you are right :(
-rw-r--r-- 1 root root 144200 Dec 6 09:59 0004_4godown.wav
-rw-r--r-- 1 root root 144200 Dec 6 09:57 0002_2godown.wav
-rw-r--r-- 1 root root 33 Dec 5 11:13 0000_sip-silence.gsm
drwxr-xr-x 2 root root 4096 Dec 6 09:59 .
-rw-r--r-- 1 root root 144200 Dec 6 09:56 0001_1godown.wav
drwxr-xr-x 13 root root 4096 Dec 11 08:15 ..
-rw-r--r-- 1 root root 144200 Dec 6 09:59 0003_3godown.wav

Do you know which script modifies musiconhold-vicidial.conf? It's obviously easier to modify the scrip, rather then do full disk defrag every time I modify MOH entry :(

Re: MOH incorrect play order

PostPosted: Wed Dec 11, 2013 9:44 am
by DomeDan
You could edit ADMIN_keepalive_ALL.pl like this:
Code: Select all
--- ADMIN_keepalive_ALL.pl.orig 2013-12-11 15:40:12.605636652 +0100
+++ ADMIN_keepalive_ALL.pl      2013-12-11 15:41:21.930993143 +0100
@@ -2860,7 +2860,7 @@
                $moh  .= "mode=files\n";
                $moh  .= "directory=/var/lib/asterisk/$moh_id[$j]\n";
                if ($random[$j] =~ /Y/)
-                       {$moh  .= "random=yes\n";}
+                       {$moh  .= "random=yes\n";} else { $moh  .= "sort=alpha\n";}
                $moh  .= "\n";
 
                $j++;

Then if random is not Y, it will be set to sort=alpha in the config file.

edit: just tested it and it works for me

Re: MOH incorrect play order

PostPosted: Wed Dec 11, 2013 1:06 pm
by PierreDeux
Thanks, Dan, works for me too :) I suggest vicidial group should update ADMIN_keepalive_ALL.pl in the next release

Re: MOH incorrect play order

PostPosted: Sun Jan 12, 2014 7:40 pm
by mflorell
Fixed in svn trunk now.

Thanks!