aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-07 01:22:58 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-07 01:22:58 +0000
commit3df4bcbbd013238f06839fd595570874db5470a9 (patch)
tree4976268015eb3699b1c2b5ba4d762057c8975d2f /res
parentb5d6d74da5b833453f39e1263343a0319b35cb1a (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.2@47238 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_musiconhold.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 6c0c380bd..b9b7b8f17 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -297,6 +297,8 @@ static void *moh_files_alloc(struct ast_channel *chan, void *params)
/* initialize */
memset(state, 0, sizeof(struct moh_files_state));
state->class = class;
+ if (ast_test_flag(state->class, MOH_RANDOMIZE))
+ state->pos = rand() % class->total_files;
}
state->origwfmt = chan->writeformat;