[asterisk-commits] file: branch 1.4 r58240 - in /branches/1.4: channels/chan_sip.c main/rtp.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Mar 7 10:52:58 MST 2007


Author: file
Date: Wed Mar  7 11:52:58 2007
New Revision: 58240

URL: http://svn.digium.com/view/asterisk?view=rev&rev=58240
Log:
Ensure we have (or should have) at least one matching codec before attempting early bridge SDP seeding. (issue #9221 reported by marcelbarbulescu)

Modified:
    branches/1.4/channels/chan_sip.c
    branches/1.4/main/rtp.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=58240&r1=58239&r2=58240
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Wed Mar  7 11:52:58 2007
@@ -17056,7 +17056,7 @@
 static int sip_get_codec(struct ast_channel *chan)
 {
 	struct sip_pvt *p = chan->tech_pvt;
-	return p->peercapability;	
+	return p->peercapability ? p->peercapability : p->capability;	
 }
 
 /*! \brief Send a poke to all known peers 

Modified: branches/1.4/main/rtp.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/rtp.c?view=diff&rev=58240&r1=58239&r2=58240
==============================================================================
--- branches/1.4/main/rtp.c (original)
+++ branches/1.4/main/rtp.c Wed Mar  7 11:52:58 2007
@@ -1445,7 +1445,7 @@
 	struct ast_rtp_protocol *destpr = NULL, *srcpr = NULL;
 	enum ast_rtp_get_result audio_dest_res = AST_RTP_GET_FAILED, video_dest_res = AST_RTP_GET_FAILED;
 	enum ast_rtp_get_result audio_src_res = AST_RTP_GET_FAILED, video_src_res = AST_RTP_GET_FAILED;
-	int srccodec, nat_active = 0;
+	int srccodec, destcodec, nat_active = 0;
 
 	/* Lock channels */
 	ast_channel_lock(dest);
@@ -1498,6 +1498,17 @@
 		srccodec = srcpr->get_codec(src);
 	else
 		srccodec = 0;
+	if (audio_dest_res == AST_RTP_TRY_NATIVE && destpr->get_codec)
+		destcodec = destpr->get_codec(dest);
+	else
+		destcodec = 0;
+	/* Ensure we have at least one matching codec */
+	if (!(srccodec & destcodec)) {
+		ast_channel_unlock(dest);
+		if (src)
+			ast_channel_unlock(src);
+		return 0;
+	}
 	/* Consider empty media as non-existant */
 	if (audio_src_res == AST_RTP_TRY_NATIVE && !srcp->them.sin_addr.s_addr)
 		srcp = NULL;



More information about the asterisk-commits mailing list