]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Don't fast forward past the end of a message.
authorRussell Bryant <russell@russellbryant.com>
Fri, 26 Jun 2009 21:16:39 +0000 (21:16 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 26 Jun 2009 21:16:39 +0000 (21:16 +0000)
This is nice change for users of the voicemail application.  If someone gets a
little carried away with fast forwarding through a message, they can easily
get to the end and accidentally exit the voicemail application by hitting the
fast forward key during the following prompt.

This adds some safety by not allowing a fast forward past the end of a message.

(closes issue #14554)
Reported by: lacoursj
Patches:
      21761.patch uploaded by lacoursj (license 707)
Tested by: lacoursj

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@203785 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/file.c

index eaee042204ec528f0c99408f23797ba9605b4601..f39268fe370eb0b8f544d84ef5b15ca129f1bd3b 100644 (file)
@@ -1236,7 +1236,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(rewind,res)) {
                                                ast_stream_rewind(c->stream, skip_ms);
                                        } else if (strchr(breakon, res)) {