[Home]

Summary:ASTERISK-11852: asterisk doesn't play MOH files randomly when "random=yes" is specified
Reporter:Richard Wilkinson (rickead2000)Labels:
Date Opened:2008-04-15 05:41:09Date Closed:2011-06-07 14:02:47
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_musiconhold
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) bug_12446.diff
Description:Asterisk doesn't seem to properly randomise the order of files it plays for music on hold when "random=yes" is specified.

It always plays the same file first, then appears to go random.

I can't seem to work out how it chooses which file to play first, but it's always the same one....

In this case, it always plays 05.mp3 first, then goes random.

****** ADDITIONAL INFORMATION ******

musiconhold.conf
---------------
[test]
mode=files
directory=/var/lib/asterisk/moh/test
random=yes
---------------

Directory listing of files....

drwxr-xr-x  2 root     root       4096 Apr 15 11:35 .
drwxr-xr-x 13 root     root       4096 Apr 15 11:35 ..
-rw-r--r--  1 astadmin astadmin 466988 Apr 15 11:27 01.mp3
-rw-r--r--  1 astadmin astadmin 170237 Apr 15 11:27 02.mp3
-rw-r--r--  1 astadmin astadmin 378381 Apr 15 11:27 03.mp3
-rw-r--r--  1 astadmin astadmin 376709 Apr 15 11:27 04.mp3
-rw-r--r--  1 astadmin astadmin 418505 Apr 15 11:28 05.mp3
-rw-r--r--  1 astadmin astadmin 424774 Apr 15 11:28 06.mp3
-rw-r--r--  1 astadmin astadmin 512963 Apr 15 11:28 07.mp3
-rw-r--r--  1 astadmin astadmin 413489 Apr 15 11:28 08.mp3
-rw-r--r--  1 astadmin astadmin 461554 Apr 15 11:28 09.mp3
-rw-r--r--  1 astadmin astadmin 340315 Apr 15 11:27 10.mp3

---------------




Comments:By: snuffy (snuffy) 2008-04-15 06:01:14

I changed the call to ast_random.
Let us know if there is any difference

By: Richard Wilkinson (rickead2000) 2008-04-15 06:10:21

Hi snuffy - I'll get this compiled and tested a bit later today and post back results

By: Jason Parker (jparker) 2008-04-15 13:02:25

I'm unable to reproduce this on 1.4.  While I do believe the attached patch is a good thing, I don't expect it to fix the problem (if anything, it would only randomly be not random...if that makes any sense).

What I would like to see, is console debug output that shows the class being used, and which file it is opening.

When are you seeing it get reset to file 05?

By: Joshua C. Colp (jcolp) 2008-04-18 14:58:38

I also tested this and confirmed the initial audio file was random.

By: Jason Parker (jparker) 2008-05-06 14:27:52

Closing, due to lack of response.

Patch will be committed shortly, regardless, since it is the right thing to do.

By: Digium Subversion (svnbot) 2008-05-06 14:29:17

Repository: asterisk
Revision: 115418

U   branches/1.4/res/res_musiconhold.c

------------------------------------------------------------------------
r115418 | qwell | 2008-05-06 14:29:17 -0500 (Tue, 06 May 2008) | 7 lines

Switch to using ast_random() rather than just rand().
This does not fix the bug reported, but I believe it is correct.

(from issue ASTERISK-11852)
Patches:
     bug_12446.diff uploaded by snuffy (license 35)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=115418

By: Digium Subversion (svnbot) 2008-05-06 14:33:09

Repository: asterisk
Revision: 115419

_U  trunk/
U   trunk/res/res_musiconhold.c

------------------------------------------------------------------------
r115419 | qwell | 2008-05-06 14:33:08 -0500 (Tue, 06 May 2008) | 15 lines

Merged revisions 115418 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115418 | qwell | 2008-05-06 14:34:58 -0500 (Tue, 06 May 2008) | 7 lines

Switch to using ast_random() rather than just rand().
This does not fix the bug reported, but I believe it is correct.

(from issue ASTERISK-11852)
Patches:
     bug_12446.diff uploaded by snuffy (license 35)

........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=115419

By: Digium Subversion (svnbot) 2008-05-06 14:33:28

Repository: asterisk
Revision: 115420

_U  branches/1.6.0/
U   branches/1.6.0/res/res_musiconhold.c

------------------------------------------------------------------------
r115420 | qwell | 2008-05-06 14:33:28 -0500 (Tue, 06 May 2008) | 23 lines

Merged revisions 115419 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r115419 | qwell | 2008-05-06 14:38:44 -0500 (Tue, 06 May 2008) | 15 lines

Merged revisions 115418 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115418 | qwell | 2008-05-06 14:34:58 -0500 (Tue, 06 May 2008) | 7 lines

Switch to using ast_random() rather than just rand().
This does not fix the bug reported, but I believe it is correct.

(from issue ASTERISK-11852)
Patches:
     bug_12446.diff uploaded by snuffy (license 35)

........

................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=115420

By: Digium Subversion (svnbot) 2008-05-06 18:07:11

Repository: asterisk
Revision: 115504

_U  team/seanbright/resolve-shadow-warnings/
U   team/seanbright/resolve-shadow-warnings/Makefile
U   team/seanbright/resolve-shadow-warnings/UPGRADE.txt
U   team/seanbright/resolve-shadow-warnings/apps/app_queue.c
U   team/seanbright/resolve-shadow-warnings/build_tools/menuselect-deps.in
U   team/seanbright/resolve-shadow-warnings/channels/chan_iax2.c
U   team/seanbright/resolve-shadow-warnings/channels/chan_sip.c
U   team/seanbright/resolve-shadow-warnings/codecs/codec_speex.c
U   team/seanbright/resolve-shadow-warnings/configure
U   team/seanbright/resolve-shadow-warnings/configure.ac
U   team/seanbright/resolve-shadow-warnings/contrib/scripts/get_ilbc_source.sh
U   team/seanbright/resolve-shadow-warnings/funcs/func_speex.c
U   team/seanbright/resolve-shadow-warnings/include/asterisk/autoconfig.h.in
U   team/seanbright/resolve-shadow-warnings/include/asterisk/res_odbc.h
U   team/seanbright/resolve-shadow-warnings/main/asterisk.c
U   team/seanbright/resolve-shadow-warnings/main/config.c
U   team/seanbright/resolve-shadow-warnings/main/event.c
U   team/seanbright/resolve-shadow-warnings/main/logger.c
U   team/seanbright/resolve-shadow-warnings/res/res_musiconhold.c
U   team/seanbright/resolve-shadow-warnings/res/res_odbc.c
U   team/seanbright/resolve-shadow-warnings/utils/refcounter.c

------------------------------------------------------------------------
r115504 | seanbright | 2008-05-06 18:07:08 -0500 (Tue, 06 May 2008) | 221 lines

Merged revisions 115302,115305,115309,115313,115315,115321,115324,115328-115329,115334,115337,115342,115344,115416,115419,115423,115473 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r115302 | tilghman | 2008-05-05 15:42:36 -0400 (Mon, 05 May 2008) | 2 lines

Note change for ExecIf syntax (caught by jmls on IRC)

................
r115305 | russell | 2008-05-05 15:50:24 -0400 (Mon, 05 May 2008) | 13 lines

Merged revisions 115304 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115304 | russell | 2008-05-05 14:49:25 -0500 (Mon, 05 May 2008) | 5 lines

Avoid putting opaque="" in Digest authentication.  This patch came from switchvox.
It fixes authentication with Primus in Canada, and has been in use for a very long
time without causing problems with any other providers.
(closes issue AST-36)

........

................
r115309 | tilghman | 2008-05-05 15:57:28 -0400 (Mon, 05 May 2008) | 10 lines

Merged revisions 115308 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115308 | tilghman | 2008-05-05 14:55:55 -0500 (Mon, 05 May 2008) | 2 lines

Err, the documentation on the return value of ast_odbc_backslash_is_escape is exactly backwards.

........

................
r115313 | tilghman | 2008-05-05 16:22:08 -0400 (Mon, 05 May 2008) | 10 lines

Merged revisions 115312 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115312 | tilghman | 2008-05-05 15:17:55 -0500 (Mon, 05 May 2008) | 2 lines

Reverse order, such that user configs override default selections

........

................
r115315 | russell | 2008-05-05 16:28:17 -0400 (Mon, 05 May 2008) | 2 lines

Remove my rant, since I have now replaced the rant with code.

................
r115321 | mmichelson | 2008-05-05 17:43:21 -0400 (Mon, 05 May 2008) | 21 lines

Merged revisions 115320 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115320 | mmichelson | 2008-05-05 16:41:34 -0500 (Mon, 05 May 2008) | 13 lines

Don't consider a caller "handled" until the caller is bridged with
a queue member. There was too much of an opportunity for the member
to hang up (either during a delay, announcement, or overly long
agi) between the time that he answered the phone and the time when
he actually was bridged with the caller. The consequence of this
was that if the member hung up in that interval, then proper
abandonment details would not be noted in the queue log if the caller
were to hang up at any point after the member hangup.

(closes issue ASTERISK-11950)
Reported by: ablackthorn


........

................
r115324 | russell | 2008-05-05 18:01:56 -0400 (Mon, 05 May 2008) | 2 lines

Simplify code by using a taskprocessor for dispatching events in the Asterisk core.

................
r115328 | file | 2008-05-05 18:13:57 -0400 (Mon, 05 May 2008) | 10 lines

Merged revisions 115327 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115327 | file | 2008-05-05 19:10:05 -0300 (Mon, 05 May 2008) | 2 lines

Make sure that either the main speex library contains preprocess functions or that speexdsp does. If both fail then speex stuff can not be built.

........

................
r115329 | mmichelson | 2008-05-05 18:14:06 -0400 (Mon, 05 May 2008) | 15 lines

#execing the same file multiple times led to warning messages saying that the same file was
being #included twice. This was due to the fact that #exec created a temporary file which
was then #included. The name of the temporary file was the name of the #exec'd file, with
the Unix timestamp and thread ID concatenated. The issue was that if multiple #exec statements
of the same file were reached in the same second, then the result was that the temporary files
would have duplicate names. To resolve this, the temporary file now has microsecond resolution
for the timestamp portion.

(closes issue ASTERISK-11962)
Reported by: jmls
Patches:
     12574.patch uploaded by putnopvut (license 60)
Tested by: jmls, putnopvut


................
r115334 | tilghman | 2008-05-05 19:00:31 -0400 (Mon, 05 May 2008) | 15 lines

Merged revisions 115333 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115333 | tilghman | 2008-05-05 17:50:31 -0500 (Mon, 05 May 2008) | 7 lines

Separate verbose output from CLI output, by using a preamble.
(closes issue ASTERISK-11815)
Reported by: Corydon76
Patches:
      20080410__no_verbose_in_rx_output.diff.txt uploaded by Corydon76 (license 14)
      20080501__no_verbose_in_rx_output__1.4.diff.txt uploaded by Corydon76 (license 14)

........

................
r115337 | tilghman | 2008-05-05 19:38:15 -0400 (Mon, 05 May 2008) | 2 lines

Merge refcounting of res_odbc

................
r115342 | file | 2008-05-06 09:55:44 -0400 (Tue, 06 May 2008) | 10 lines

Merged revisions 115341 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115341 | file | 2008-05-06 10:54:15 -0300 (Tue, 06 May 2008) | 2 lines

Add in missing argument.

........

................
r115344 | russell | 2008-05-06 11:14:55 -0400 (Tue, 06 May 2008) | 2 lines

Change some NOTICE log messages to debug.

................
r115416 | tilghman | 2008-05-06 15:32:29 -0400 (Tue, 06 May 2008) | 10 lines

Merged revisions 115415 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115415 | tilghman | 2008-05-06 14:31:39 -0500 (Tue, 06 May 2008) | 2 lines

Don't print the terminating NUL.  (Closes issue ASTERISK-11977)

........

................
r115419 | qwell | 2008-05-06 15:38:44 -0400 (Tue, 06 May 2008) | 15 lines

Merged revisions 115418 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115418 | qwell | 2008-05-06 14:34:58 -0500 (Tue, 06 May 2008) | 7 lines

Switch to using ast_random() rather than just rand().
This does not fix the bug reported, but I believe it is correct.

(from issue ASTERISK-11852)
Patches:
     bug_12446.diff uploaded by snuffy (license 35)

........

................
r115423 | qwell | 2008-05-06 15:55:45 -0400 (Tue, 06 May 2008) | 23 lines

Merged revisions 115422 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r115422 | qwell | 2008-05-06 14:55:29 -0500 (Tue, 06 May 2008) | 15 lines

Merged revisions 115421 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r115421 | qwell | 2008-05-06 14:54:57 -0500 (Tue, 06 May 2008) | 7 lines

read requires an argument on some non-bash shells

(closes issue ASTERISK-11981)
Reported by: bkruse
Patches:
     getilbc.sh_12593_v1.diff uploaded by bkruse (license 132)

........

................

................
r115473 | mmichelson | 2008-05-06 16:15:02 -0400 (Tue, 06 May 2008) | 3 lines

Get refcounter to build with LOW_MEMORY defined


................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=115504