diff options
author | pabelanger <pabelanger@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-06-14 21:35:52 +0000 |
---|---|---|
committer | pabelanger <pabelanger@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-06-14 21:35:52 +0000 |
commit | 5340298fb87755fbc265af1b701358719e1caa98 (patch) | |
tree | a75236e54ad36894297c4f668c9220159aae4162 /res | |
parent | 3c639f74bf1422a1a6b6544790b34cadd9543b21 (diff) |
Merged revisions 270332 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r270332 | pabelanger | 2010-06-14 17:33:55 -0400 (Mon, 14 Jun 2010) | 21 lines
Merged revisions 270331 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r270331 | pabelanger | 2010-06-14 17:31:59 -0400 (Mon, 14 Jun 2010) | 14 lines
Properly play first file in sort list.
When using sort=alpha we would always skip the first file
in the list first time through. We now check for that
properly.
(closes issue #17470)
Reported by: pabelanger
Patches:
sort.aplha.patch uploaded by pabelanger (license 224)
Tested by: lmadsen
Review: https://reviewboard.asterisk.org/r/703/
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@270333 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_musiconhold.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index e530744cd..1599b26f6 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -269,16 +269,20 @@ static int ast_moh_files_next(struct ast_channel *chan) return -1; } - /* If a specific file has been saved confirm it still exists and that it is still valid */ - if (state->save_pos >= 0 && state->save_pos < state->class->total_files && state->class->filearray[state->save_pos] == state->save_pos_filename) { + if (state->pos == 0 && state->save_pos_filename == NULL) { + /* First time so lets play the file. */ + state->save_pos = -1; + } else if (state->save_pos >= 0 && state->save_pos < state->class->total_files && state->class->filearray[state->save_pos] == state->save_pos_filename) { + /* If a specific file has been saved confirm it still exists and that it is still valid */ state->pos = state->save_pos; state->save_pos = -1; } else if (ast_test_flag(state->class, MOH_RANDOMIZE)) { /* Get a random file and ensure we can open it */ for (tries = 0; tries < 20; tries++) { state->pos = ast_random() % state->class->total_files; - if (ast_fileexists(state->class->filearray[state->pos], NULL, NULL) > 0) + if (ast_fileexists(state->class->filearray[state->pos], NULL, NULL) > 0) { break; + } } state->save_pos = -1; state->samples = 0; @@ -302,8 +306,9 @@ static int ast_moh_files_next(struct ast_channel *chan) ast_debug(1, "%s Opened file %d '%s'\n", chan->name, state->pos, state->class->filearray[state->pos]); - if (state->samples) + if (state->samples) { ast_seekstream(chan->stream, state->samples, SEEK_SET); + } return 0; } |