Tweak the DTMF muting stuff a bit to take into account VLDTMF and compensation.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@41632 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Joshua Colp 2006-08-31 21:00:16 +00:00
parent 7399d40ec7
commit f2b836ff4f
1 changed files with 4 additions and 1 deletions

View 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);