]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
For pass through DTMF tones, measure the actual duration between the begin and end...
authorMatthew Nicholson <mnicholson@digium.com>
Fri, 16 Jul 2010 17:29:57 +0000 (17:29 +0000)
committerMatthew Nicholson <mnicholson@digium.com>
Fri, 16 Jul 2010 17:29:57 +0000 (17:29 +0000)
AST-362

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

main/channel.c

index af501c146d6fad97b5d25a73f4710f04494ac1dc..5134cefc18c122dcb41c03731724773577922ad3 100644 (file)
@@ -2406,6 +2406,19 @@ 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(now, chan->dtmf_tv);
+
+                                       /* detect tones that were received on
+                                        * the wire with durations shorter than
+                                        * AST_MIN_DTMF_DURATION and set f->len
+                                        * to the actual duration of the DTMF
+                                        * frames on the wire.  This will cause
+                                        * dtmf emulation to be triggered later
+                                        * on.
+                                        */
+                                       if (ast_tvdiff_ms(now, chan->dtmf_tv) < AST_MIN_DTMF_DURATION) {
+                                               f->len = ast_tvdiff_ms(now, chan->dtmf_tv);
+                                               ast_log(LOG_DTMF, "DTMF end '%c' detected to have actual duration %ld on the wire, emulation will be triggered on %s\n", f->subclass, f->len, chan->name);
+                                       }
                                } else if (!f->len) {
                                        ast_log(LOG_DTMF, "DTMF end accepted without begin '%c' on %s\n", f->subclass, chan->name);
                                        f->len = AST_MIN_DTMF_DURATION;