]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fixify infinite DTMF in the case that no RFC2833 END event is ever received
authorRussell Bryant <russell@russellbryant.com>
Wed, 11 Feb 2009 23:56:37 +0000 (23:56 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 11 Feb 2009 23:56:37 +0000 (23:56 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@174985 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/rtp.c

index 5165ade83c96dd9209dc7b25bedaa0453cda56f8..c917e70b475cb21798c6b128b96df3c231025d63 100644 (file)
@@ -1299,6 +1299,18 @@ 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) {
+                       return send_dtmf(rtp, AST_FRAME_DTMF_END);
+               }
+       }
+
        rtp->f.mallocd = 0;
        rtp->f.datalen = res - hdrlen;
        rtp->f.data = rtp->rawdata + hdrlen + AST_FRIENDLY_OFFSET;