Merged revisions 61763 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Mon, 23 Apr 2007 17:58:15 +0000 (17:58 +0000)
committerRussell Bryant <russell@russellbryant.com>
Mon, 23 Apr 2007 17:58:15 +0000 (17:58 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61763 | russell | 2007-04-23 12:57:32 -0500 (Mon, 23 Apr 2007) | 4 lines

Ensure that digits passing through Asterisk have a reasonable minimum length.
It is currently 100 ms.  If someone thinks this should be different, feel free
to speak up.  (related to issues #8944, #9250, and #9348)

........

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

main/channel.c

index dd79c6f..a77aa94 100644 (file)
@@ -2226,7 +2226,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
                                ast_set_flag(chan, AST_FLAG_EMULATE_DTMF);
                                chan->emulate_dtmf_digit = f->subclass;
                                chan->dtmf_begin_tv = ast_tvnow();
-                               if (f->len)
+                               if (f->len && f->len > AST_DEFAULT_EMULATE_DTMF_DURATION)
                                        chan->emulate_dtmf_duration = f->len;
                                else
                                        chan->emulate_dtmf_duration = AST_DEFAULT_EMULATE_DTMF_DURATION;
@@ -2234,6 +2234,12 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
                                ast_clear_flag(chan, AST_FLAG_IN_DTMF);
                                if (!f->len)
                                        f->len = ast_tvdiff_ms(ast_tvnow(), chan->dtmf_begin_tv);
+                               if (f->len < AST_DEFAULT_EMULATE_DTMF_DURATION) {
+                                       ast_set_flag(chan, AST_FLAG_EMULATE_DTMF);
+                                       chan->emulate_dtmf_digit = f->subclass;
+                                       chan->emulate_dtmf_duration = AST_DEFAULT_EMULATE_DTMF_DURATION - f->len;
+                                       f = &ast_null_frame;
+                               }
                        }
                        break;
                case AST_FRAME_DTMF_BEGIN: