[asterisk-commits] twilson: branch 1.4 r302087 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 17 11:45:45 CST 2011


Author: twilson
Date: Mon Jan 17 11:45:39 2011
New Revision: 302087

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=302087
Log:
Merged revisions 293493 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8 [^]

........
  r293493 | twilson | 2010-11-01 09:58:00 -0500 (Mon, 01 Nov 2010) | 14 lines
  
  Only offer codecs both sides support for directmedia
  
  When using directmedia, Asterisk needs to limit the codecs offered to just
  the ones that both sides recognize, otherwise they may end up sending audio
  that the other side doesn't understand.
  
  (closes issue 0017403)
  Reported by: one47
  Patches: 
        sip_codecs_simplified4 uploaded by one47 (license 23)
  Tested by: one47, falves11
  
  Review: https://reviewboard.asterisk.org/r/967/ [^]
........

Back port a fix that should have been included

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=302087&r1=302086&r2=302087
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Mon Jan 17 11:45:39 2011
@@ -7027,6 +7027,7 @@
 static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int add_audio, int add_t38)
 {
 	int alreadysent = 0;
+	int doing_directmedia = FALSE;
 
 	struct sockaddr_in sin;
 	struct sockaddr_in vsin;
@@ -7092,6 +7093,7 @@
 	if (p->redirip.sin_addr.s_addr) {
 		dest.sin_port = p->redirip.sin_port;
 		dest.sin_addr = p->redirip.sin_addr;
+		doing_directmedia = p->redircodecs ? TRUE : FALSE;
 	} else {
 		dest.sin_addr = p->ourip;
 		dest.sin_port = sin.sin_port;
@@ -7108,13 +7110,19 @@
 		hold = "a=sendrecv\r\n";
 
 	if (add_audio) {
+		char codecbuf[SIPBUFSIZE];
 		capability = p->jointcapability;
 
-
 		if (option_debug > 1) {
-			char codecbuf[SIPBUFSIZE];
 			ast_log(LOG_DEBUG, "** Our capability: %s Video flag: %s\n", ast_getformatname_multiple(codecbuf, sizeof(codecbuf), capability), ast_test_flag(&p->flags[0], SIP_NOVIDEO) ? "True" : "False");
 			ast_log(LOG_DEBUG, "** Our prefcodec: %s \n", ast_getformatname_multiple(codecbuf, sizeof(codecbuf), p->prefcodec));
+		}
+
+		if (doing_directmedia) {
+			capability &= p->redircodecs;
+			if (option_debug > 1) {
+				ast_log(LOG_NOTICE, "** Our native-bridge filtered capablity: %s\n", ast_getformatname_multiple(codecbuf, sizeof(codecbuf), capability));
+			}
 		}
 
 #ifdef WHEN_WE_HAVE_T38_FOR_OTHER_TRANSPORTS




More information about the asterisk-commits mailing list