aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-12 17:08:25 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-12 17:08:25 +0000
commit10b34f8628cdc198b3164ad8a96a43b343f1d06e (patch)
tree0bcf107d42adc029d53d2c8038141c64c2bd7752 /main
parent6adb3f0fcd96acf49691376358b63fdef6713cc0 (diff)
Merged revisions 175125 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r175125 | russell | 2009-02-12 10:57:25 -0600 (Thu, 12 Feb 2009) | 35 lines Merged revisions 175124 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r175124 | russell | 2009-02-12 10:51:13 -0600 (Thu, 12 Feb 2009) | 27 lines Don't send DTMF for infinite time if we do not receive an END event. I thought that this was going to end up being a pretty gnarly fix, but it turns out that there was actually already a configuration option in rtp.conf, dtmftimeout, that was intended to handle this situation. However, in between Asterisk 1.2 and Asterisk 1.4, the code that processed the option got lost. So, this commit brings it back to life. The default timeout is 3 seconds. However, it is worth noting that having this be configurable at all is not really the recommended behavior in RFC 2833. From Section 3.5 of RFC 2833: Limiting the time period of extending the tone is necessary to avoid that a tone "gets stuck". Regardless of the algorithm used, the tone SHOULD NOT be extended by more than three packet interarrival times. A slight extension of tone durations and shortening of pauses is generally harmless. Three seconds will pretty much _always_ be far more than three packet interarrival times. However, that behavior is not required, so I'm going to leave it with our legacy behavior for now. Code from svn/asterisk/team/russell/issue_14460 (closes issue #14460) Reported by: moliveras ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@175129 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/rtp.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/rtp.c b/main/rtp.c
index 5a3b6dec3..376221a83 100644
--- a/main/rtp.c
+++ b/main/rtp.c
@@ -1749,6 +1749,21 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
/* Record received timestamp as last received now */
rtp->lastrxts = timestamp;
+ if (rtp->dtmfcount) {
+ rtp->dtmfcount -= (timestamp - rtp->lastrxts);
+
+ if (rtp->dtmfcount < 0) {
+ rtp->dtmfcount = 0;
+ }
+
+ if (rtp->resp && !rtp->dtmfcount) {
+ struct ast_frame *f;
+ f = send_dtmf(rtp, AST_FRAME_DTMF_END);
+ rtp->resp = 0;
+ return f;
+ }
+ }
+
rtp->f.mallocd = 0;
rtp->f.datalen = res - hdrlen;
rtp->f.data.ptr = rtp->rawdata + hdrlen + AST_FRIENDLY_OFFSET;