]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
When waiting for a digit ensure that a begin frame was received with it, not just...
authorJoshua Colp <jcolp@digium.com>
Thu, 12 Jul 2007 17:16:28 +0000 (17:16 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 12 Jul 2007 17:16:28 +0000 (17:16 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@74888 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/channel.c

index 37fd2b45d564b1df75520634566e7a443422418d..dd2ed678184ad6fd5a99ea94b7563245826670bb 100644 (file)
@@ -2079,7 +2079,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);
@@ -2098,7 +2098,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;