[asterisk-commits] russell: branch 1.4 r178141 - /branches/1.4/main/rtp.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 23 17:09:01 CST 2009


Author: russell
Date: Mon Feb 23 17:09:01 2009
New Revision: 178141

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=178141
Log:
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

Modified:
    branches/1.4/main/rtp.c

Modified: branches/1.4/main/rtp.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/main/rtp.c?view=diff&rev=178141&r1=178140&r2=178141
==============================================================================
--- branches/1.4/main/rtp.c (original)
+++ branches/1.4/main/rtp.c Mon Feb 23 17:09:01 2009
@@ -140,7 +140,6 @@
 	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 @@
 		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 @@
 	}
 
 	rtp->dtmfcount = dtmftimeout;
-	rtp->dtmfsamples = samples;
 
 	return f;
 }
@@ -1291,13 +1288,7 @@
 	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);
@@ -1313,6 +1304,9 @@
 			return f;
 		}
 	}
+
+	/* Record received timestamp as last received now */
+	rtp->lastrxts = timestamp;
 
 	rtp->f.mallocd = 0;
 	rtp->f.datalen = res - hdrlen;
@@ -2092,7 +2086,6 @@
 	rtp->lasttxformat = 0;
 	rtp->lastrxformat = 0;
 	rtp->dtmfcount = 0;
-	rtp->dtmfsamples = 0;
 	rtp->seqno = 0;
 	rtp->rxseqno = 0;
 }




More information about the asterisk-commits mailing list