]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Provide correct DTMF duration
authorPaul Cadach <paul@odt.east.telecom.kz>
Sat, 10 Feb 2007 09:07:11 +0000 (09:07 +0000)
committerPaul Cadach <paul@odt.east.telecom.kz>
Sat, 10 Feb 2007 09:07:11 +0000 (09:07 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@53879 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/channel.c

index 39c4e8e16e88538cf74dd7e9f38583a3f3239b8c..9f2c19d4debab057fc0ee2290ec2caf09cabd1e7 100644 (file)
@@ -2215,7 +2215,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
                        }
                        break;
                case AST_FRAME_DTMF_END:
-                       ast_log(LOG_DTMF, "DTMF end '%c' received on %s\n", f->subclass, chan->name);
+                       ast_log(LOG_DTMF, "DTMF end '%c' received on %s, duration %ld ms\n", f->subclass, chan->name, f->len);
                        /* Queue it up if DTMF is deffered, or if DTMF emulation is forced.
                         * However, only let emulation be forced if the other end cares about BEGIN frames */
                        if ( ast_test_flag(chan, AST_FLAG_DEFER_DTMF) ||
@@ -2238,7 +2238,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
                        } else {
                                ast_clear_flag(chan, AST_FLAG_IN_DTMF);
                                if (!f->len)
-                                       f->len = ast_tvdiff_ms(chan->dtmf_begin_tv, ast_tvnow());
+                                       f->len = ast_tvdiff_ms(ast_tvnow(), chan->dtmf_begin_tv);
                        }
                        break;
                case AST_FRAME_DTMF_BEGIN:
@@ -2269,6 +2269,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
                                        chan->emulate_dtmf_duration = 0;
                                        f->frametype = AST_FRAME_DTMF_END;
                                        f->subclass = chan->emulate_dtmf_digit;
+                                       f->len = ast_tvdiff_ms(ast_tvnow(), chan->dtmf_begin_tv);
                                } else {
                                        chan->emulate_dtmf_duration -= f->samples / 8; /* XXX 8kHz */
                                        ast_frfree(f);