diff --git a/main/file.c b/main/file.c index ca70703513..c89cee97c4 100644 --- a/main/file.c +++ b/main/file.c @@ -1227,7 +1227,14 @@ static int waitstream_core(struct ast_channel *c, const char *breakon, } else { res = fr->subclass; if (strchr(forward, res)) { + int eoftest; ast_stream_fastforward(c->stream, skip_ms); + eoftest = fgetc(c->stream->f); + if (feof(c->stream->f)) { + ast_stream_rewind(c->stream, skip_ms); + } else { + ungetc(eoftest, c->stream->f); + } } else if (strchr(reverse, res)) { ast_stream_rewind(c->stream, skip_ms); } else if (strchr(breakon, res)) {