[asterisk-commits] file: branch 1.4 r98325 - /branches/1.4/main/rtp.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 11 13:51:11 CST 2008


Author: file
Date: Fri Jan 11 13:51:10 2008
New Revision: 98325

URL: http://svn.digium.com/view/asterisk?view=rev&rev=98325
Log:
If the incoming RTP stream changes codec force the bridge to break if the other side does not support it.
(closes issue #11729)
Reported by: tsearle
Patches:
      new_codec_patch_udiff.patch uploaded by tsearle (license 373)

Modified:
    branches/1.4/main/rtp.c

Modified: branches/1.4/main/rtp.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/rtp.c?view=diff&rev=98325&r1=98324&r2=98325
==============================================================================
--- branches/1.4/main/rtp.c (original)
+++ branches/1.4/main/rtp.c Fri Jan 11 13:51:10 2008
@@ -1061,6 +1061,10 @@
 
 	/* Check what the payload value should be */
 	rtpPT = ast_rtp_lookup_pt(rtp, payload);
+
+	/* If the payload coming in is not one of the negotiated ones then send it to the core, this will cause formats to change and the bridge to break */
+	if (!bridged->current_RTP_PT[payload].code)
+		return -1;
 
 	/* If the payload is DTMF, and we are listening for DTMF - then feed it into the core */
 	if (ast_test_flag(rtp, FLAG_P2P_NEED_DTMF) && !rtpPT.isAstFormat && rtpPT.code == AST_RTP_DTMF)
@@ -3142,6 +3146,12 @@
 	cs[1] = c1;
 	cs[2] = NULL;
 	for (;;) {
+		/* If the underlying formats have changed force this bridge to break */
+		if ((c0->rawreadformat != c1->rawwriteformat) || (c1->rawreadformat != c0->rawwriteformat)) {
+			ast_log(LOG_DEBUG, "Oooh, formats changed, backing out\n");
+			res = AST_BRIDGE_FAILED_NOWARN;
+			break;
+		}
 		/* Check if anything changed */
 		if ((c0->tech_pvt != pvt0) ||
 		    (c1->tech_pvt != pvt1) ||




More information about the asterisk-commits mailing list