Index: main/rtp.c =================================================================== --- main/rtp.c (revision 178869) +++ main/rtp.c (working copy) @@ -746,6 +746,7 @@ if ((rtp->lastevent != timestamp) || (rtp->resp && rtp->resp != resp)) { rtp->resp = resp; rtp->dtmfcount = 0; + ast_log(LOG_NOTICE, "Doing DTMF compensation, setting dtmfcount to 0\n"); f = send_dtmf(rtp, AST_FRAME_DTMF_END); f->len = 0; rtp->lastevent = timestamp; @@ -755,11 +756,13 @@ rtp->resp = resp; f = send_dtmf(rtp, AST_FRAME_DTMF_BEGIN); rtp->dtmfcount = dtmftimeout; + ast_log(LOG_NOTICE, "Received a BEGIN, setting dtmfcount to %d\n", dtmftimeout); } else if ((event_end & 0x80) && (rtp->lastevent != seqno) && rtp->resp) { f = send_dtmf(rtp, AST_FRAME_DTMF_END); f->len = ast_tvdiff_ms(ast_samp2tv(samples, 8000), ast_tv(0, 0)); /* XXX hard coded 8kHz */ rtp->resp = 0; rtp->dtmfcount = 0; + ast_log(LOG_NOTICE, "Received an END, turning off the dtmfcount\n"); rtp->lastevent = seqno; } } @@ -1292,14 +1295,19 @@ rtp->rxseqno = seqno; if (rtp->dtmfcount) { + int old = rtp->dtmfcount; + rtp->dtmfcount -= (timestamp - rtp->lastrxts); if (rtp->dtmfcount < 0) { rtp->dtmfcount = 0; } + ast_log(LOG_NOTICE, "dtmfcount was '%d', is now '%d'\n", old, rtp->dtmfcount); + if (rtp->resp && !rtp->dtmfcount) { struct ast_frame *f; + ast_log(LOG_NOTICE, "Sending end of DTMF because of DTMF timeout\n"); f = send_dtmf(rtp, AST_FRAME_DTMF_END); rtp->resp = 0; return f;