summaryrefslogtreecommitdiff
path: root/res/res_musiconhold.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2011-08-08 20:54:14 +0000
committerKinsey Moore <kmoore@digium.com>2011-08-08 20:54:14 +0000
commit38efff0ca33ac1bf743843df7b6e7c19ac2599f4 (patch)
tree98b57db6e5f7b8ec720043e37be95ae87b1f1b25 /res/res_musiconhold.c
parent0f5ef2c7817186e2ef70ce4df0376c7ff352006b (diff)
Merged revisions 331039 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10 ................ r331039 | kmoore | 2011-08-08 15:53:30 -0500 (Mon, 08 Aug 2011) | 18 lines Merged revisions 331038 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r331038 | kmoore | 2011-08-08 15:52:45 -0500 (Mon, 08 Aug 2011) | 11 lines In-queue MOH stops after a periodic announcement If the seek value is past the end of file when resuming G.722 MOH, MOH will cease to function for the duration of the MOH session through all starts and stops until saved state is cleared. Adjusting the code to guarantee a single valid read (which is already assumed) fixes the bug. (closes issue ASTERISK-18077) Review: https://reviewboard.asterisk.org/r/1328/ Tested-by: Jonathan Rose <jrose@digium.com> ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@331040 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_musiconhold.c')
-rw-r--r--res/res_musiconhold.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 4a052d43d..c2207d6ce 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -340,7 +340,16 @@ 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) {
+ size_t loc;
+ /* seek *SHOULD* be good since it's from a known location */
ast_seekstream(chan->stream, state->samples, SEEK_SET);
+ /* if the seek failed then recover because if there is not a valid read,
+ * moh_files_generate will return -1 and MOH will stop */
+ loc = ast_tellstream(chan->stream);
+ if (state->samples > loc && loc) {
+ /* seek one sample from the end for one guaranteed valid read */
+ ast_seekstream(chan->stream, 1, SEEK_END);
+ }
}
return 0;