aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-23 23:09:01 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-23 23:09:01 +0000
commit9f6d8c839079d2ff08766c53dc2e01406a875a6f (patch)
treee5a58705051e2ef6d56d793a60da32413a98d81a
parent3867d08940c1ae41e6f74b3c62956956c616204d (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.4@178141 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/rtp.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/main/rtp.c b/main/rtp.c
index b394cf285..8ac8d832d 100644
--- a/main/rtp.c
+++ b/main/rtp.c
@@ -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;
}