Index: main/channel.c =================================================================== --- main/channel.c (revision 119891) +++ main/channel.c (working copy) @@ -2172,7 +2172,14 @@ ast_log(LOG_DTMF, "DTMF end '%c' has duration %ld but want minimum %d, emulating on %s\n", f->subclass, f->len, AST_MIN_DTMF_DURATION, chan->name); ast_set_flag(chan, AST_FLAG_EMULATE_DTMF); chan->emulate_dtmf_digit = f->subclass; - chan->emulate_dtmf_duration = AST_MIN_DTMF_DURATION - f->len; + // instead of shortening the min duration, + // set the start time in the past, this will + // result in more accurate dtmf values + chan->emulate_dtmf_duration = AST_MIN_DTMF_DURATION; + // in DTMF_END_ONLY we don't set the start + // so we need to do it now + chan->dtmf_tv = ast_tvsub(now, ast_tv(0, f->len*1000)); + ast_frfree(f); f = &ast_null_frame; } else {