]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 47238 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Tue, 7 Nov 2006 01:25:10 +0000 (01:25 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 7 Nov 2006 01:25:10 +0000 (01:25 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r47238 | russell | 2006-11-06 20:22:58 -0500 (Mon, 06 Nov 2006) | 5 lines

If random order is enabled for files mode music on hold, set a random initial
position, instead of always starting at the first file, and doing the random
operation only when switching to the next file.
(bug reported by John Lange on the asterisk-dev mailing list)

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@47239 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_musiconhold.c

index 56e8a1d289952575e3e57936d3483f440601ff58..ccdf9fa488cb11790c6fec306e06056c3c4967b7 100644 (file)
@@ -311,6 +311,8 @@ static void *moh_files_alloc(struct ast_channel *chan, void *params)
                        /* initialize */
                        memset(state, 0, sizeof(*state));
                        state->class = class;
+                       if (ast_test_flag(state->class, MOH_RANDOMIZE))
+                               state->pos = ast_random() % class->total_files;
                }
 
                state->origwfmt = chan->writeformat;