Merged revisions 74888 via svnmerge from
authorJoshua Colp <jcolp@digium.com>
Thu, 12 Jul 2007 17:17:56 +0000 (17:17 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 12 Jul 2007 17:17:56 +0000 (17:17 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r74888 | file | 2007-07-12 14:16:28 -0300 (Thu, 12 Jul 2007) | 2 lines

When waiting for a digit ensure that a begin frame was received with it, not just an end frame. (issue #10084 reported by rushowr)

........

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

main/channel.c

index a39a3ad..b8dbc22 100644 (file)
@@ -1999,7 +1999,7 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
        /* Wait for a digit, no more than ms milliseconds total. */
        while (ms) {
                struct ast_channel *rchan;
-               int outfd;
+               int outfd, begin_digit = 0;
 
                errno = 0;
                rchan = ast_waitfor_nandfds(&c, 1, &cmdfd, (cmdfd > -1) ? 1 : 0, NULL, &outfd, &ms);
@@ -2018,7 +2018,12 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
                                return -1;
 
                        switch (f->frametype) {
-                       case AST_FRAME_DTMF:
+                       case AST_FRAME_DTMF_BEGIN:
+                               begin_digit = f->subclass;
+                               break;
+                       case AST_FRAME_DTMF_END:
+                               if (begin_digit != f->subclass)
+                                       break;
                                res = f->subclass;
                                ast_frfree(f);
                                return res;