From: Russell Bryant Date: Tue, 7 Nov 2006 01:22:58 +0000 (+0000) Subject: If random order is enabled for files mode music on hold, set a random initial X-Git-Tag: 1.2.14~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c651a64a77ee6fa3588587e294f9981d942afe2;p=thirdparty%2Fasterisk.git 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.2@47238 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 6c0c380bd1..b9b7b8f173 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;