Fix infinite DTMF when a BEGIN is received without an END.

This commit is related to rev 175124 of 1.4 where a previous attempt was made
to fix this problem.  The problem with the previous patch was that the inserted
code needed to go _before_ setting the lastrxts to the current timestamp.
Because those were the same, the dtmfcount variable was never decremented, and
so the END was never sent.

In passing, I removed the dtmfsamples variable which was completed unused.  I
also removed a redundant setting of the lastrxts variable.

(closes issue #14460)
Reported by: moliveras


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@178141 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2009-02-23 23:09:01 +00:00
parent 4af0175285
commit aa5a927b69

View File

@@ -140,7 +140,6 @@ struct ast_rtp {
char resp;
unsigned int lastevent;
int dtmfcount;
unsigned int dtmfsamples;
/* DTMF Transmission Variables */
unsigned int lastdigitts;
char sending_digit; /*!< boolean - are we sending digits */
@@ -620,7 +619,6 @@ static struct ast_frame *send_dtmf(struct ast_rtp *rtp, enum ast_frame_type type
if (option_debug)
ast_log(LOG_DEBUG, "Ignore potential DTMF echo from '%s'\n", ast_inet_ntoa(rtp->them.sin_addr));
rtp->resp = 0;
rtp->dtmfsamples = 0;
return &ast_null_frame;
}
if (option_debug)
@@ -764,7 +762,6 @@ static struct ast_frame *process_rfc2833(struct ast_rtp *rtp, unsigned char *dat
}
rtp->dtmfcount = dtmftimeout;
rtp->dtmfsamples = samples;
return f;
}
@@ -1291,14 +1288,8 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
rtp->lastrxformat = rtp->f.subclass = rtpPT.code;
rtp->f.frametype = (rtp->f.subclass < AST_FORMAT_MAX_AUDIO) ? AST_FRAME_VOICE : AST_FRAME_VIDEO;
if (!rtp->lastrxts)
rtp->lastrxts = timestamp;
rtp->rxseqno = seqno;
/* Record received timestamp as last received now */
rtp->lastrxts = timestamp;
if (rtp->dtmfcount) {
rtp->dtmfcount -= (timestamp - rtp->lastrxts);
@@ -1314,6 +1305,9 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
}
}
/* Record received timestamp as last received now */
rtp->lastrxts = timestamp;
rtp->f.mallocd = 0;
rtp->f.datalen = res - hdrlen;
rtp->f.data = rtp->rawdata + hdrlen + AST_FRIENDLY_OFFSET;
@@ -2092,7 +2086,6 @@ void ast_rtp_reset(struct ast_rtp *rtp)
rtp->lasttxformat = 0;
rtp->lastrxformat = 0;
rtp->dtmfcount = 0;
rtp->dtmfsamples = 0;
rtp->seqno = 0;
rtp->rxseqno = 0;
}