Tweak the DTMF muting stuff a bit to take into account VLDTMF and compensation.
authorJoshua Colp <jcolp@digium.com>
Thu, 31 Aug 2006 21:00:16 +0000 (21:00 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 31 Aug 2006 21:00:16 +0000 (21:00 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@41632 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/rtp.c

index 619acc3..b62ed14 100644 (file)
@@ -545,7 +545,8 @@ void ast_rtp_setdtmfcompensate(struct ast_rtp *rtp, int compensate)
 
 static struct ast_frame *send_dtmf(struct ast_rtp *rtp, enum ast_frame_type type)
 {
-       if (ast_tvcmp(ast_tvnow(), rtp->dtmfmute) < 0) {
+       if (((ast_test_flag(rtp, FLAG_DTMF_COMPENSATE) && type == AST_FRAME_DTMF_END) ||
+            (type == AST_FRAME_DTMF_BEGIN)) && ast_tvcmp(ast_tvnow(), rtp->dtmfmute) < 0) {
                if (option_debug)
                        ast_log(LOG_DEBUG, "Ignore potential DTMF echo from '%s'\n", ast_inet_ntoa(rtp->them.sin_addr));
                rtp->resp = 0;
@@ -2078,6 +2079,8 @@ int ast_rtp_senddigit_end(struct ast_rtp *rtp, char digit)
        if (digit_convert(digit))
                return -1;
 
+       rtp->dtmfmute = ast_tvadd(ast_tvnow(), ast_tv(0, 500000));
+
        rtpheader = (unsigned int *)data;
        rtpheader[0] = htonl((2 << 30) | (1 << 23) | (rtp->send_payload << 16) | (rtp->seqno));
        rtpheader[1] = htonl(rtp->lastdigitts);