[asterisk-commits] branch oej/sdpcleanup r30011 - /team/oej/sdpcleanup/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed May 24 11:18:12 MST 2006


Author: oej
Date: Wed May 24 13:18:11 2006
New Revision: 30011

URL: http://svn.digium.com/view/asterisk?rev=30011&view=rev
Log:
Update to not break the call any more...

Modified:
    team/oej/sdpcleanup/channels/chan_sip.c

Modified: team/oej/sdpcleanup/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/channels/chan_sip.c?rev=30011&r1=30010&r2=30011&view=diff
==============================================================================
--- team/oej/sdpcleanup/channels/chan_sip.c (original)
+++ team/oej/sdpcleanup/channels/chan_sip.c Wed May 24 13:18:11 2006
@@ -1251,9 +1251,6 @@
 static int sip_get_codec(struct ast_channel *chan);
 static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p);
 
-/*----- SDP handling functions */
-static int add_sdp(struct sip_request *resp, struct sip_pvt *p);
-static int process_sdp(struct sip_pvt *p, struct sip_request *req);
 
 /*! \brief Definition of this channel for PBX channel registration */
 static const struct ast_channel_tech sip_tech = {
@@ -3230,15 +3227,6 @@
 	else
 		what = global_capability;
 
-	needvideo = what & AST_FORMAT_VIDEO_MASK;
-
-	if (option_debug) {
-		if (needvideo) 
-			ast_log(LOG_DEBUG, "This call needs video! HOLLYWOOD next!\n");
-		else
-			ast_log(LOG_DEBUG, "This call does not need video.\n");
-	}
-
 	tmp->nativeformats = ast_codec_choose(&i->prefs, what, 1) | (i->jointcapability & AST_FORMAT_VIDEO_MASK);
 	if (option_debug) {
 		char buf[BUFSIZ];
@@ -3246,6 +3234,16 @@
 	}
 
 	fmt = ast_best_codec(tmp->nativeformats);
+
+	needvideo = tmp->nativeformats & AST_FORMAT_VIDEO_MASK;
+
+	if (option_debug) {
+		if (needvideo) 
+			ast_log(LOG_DEBUG, "This call can handle video! HOLLYWOOD next!\n");
+		else
+			ast_log(LOG_DEBUG, "This call will not be able to handle video.\n");
+	}
+
 
 	if (title)
 		ast_string_field_build(tmp, name, "SIP/%s-%04lx", title, ast_random() & 0xffff);
@@ -5035,8 +5033,13 @@
 		dest.sin_addr = p->ourip;
 		dest.sin_port = sin.sin_port;
 	}
-
-	if((capability & AST_FORMAT_VIDEO_MASK) && ast_test_flag(&p->flags[0], SIP_NOVIDEO)) {
+	if (option_debug) {
+		char codecbuf[BUFSIZ];
+		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");
+	}
+
+	if( p->owner->nativeformats & AST_FORMAT_VIDEO_MASK) {
+	// if((capability & AST_FORMAT_VIDEO_MASK) && !ast_test_flag(&p->flags[0], SIP_NOVIDEO)) {
 		if (p->vrtp) {
 			needvideo = TRUE;
 			if (option_debug)
@@ -5095,6 +5098,7 @@
 					 debug);
 		alreadysent |= p->prefcodec;
 	}
+	ast_log(LOG_DEBUG, "**** ONE ************* \n");
 
 	/* Start by sending our preferred codecs */
 	for (x = 0; x < 32; x++) {
@@ -5119,11 +5123,10 @@
 					 debug);
 		alreadysent |= pref_codec;
 	}
+	ast_log(LOG_DEBUG, "**** TWO ************* \n");
 
 	/* Now send any other common codecs, and non-codec formats: */
-	for (x = 1;
-	     x <= needvideo ? AST_FORMAT_MAX_VIDEO : AST_FORMAT_MAX_AUDIO;
-	     x <<= 1) {
+	for (x = 1; x <= (needvideo ? AST_FORMAT_MAX_VIDEO : AST_FORMAT_MAX_AUDIO); x <<= 1) {
 		if (!(capability & x))	/* Codec not requested */
 			continue;
 
@@ -5141,6 +5144,7 @@
 					 &a_video_next, &a_video_left,
 					 debug);
 	}
+	ast_log(LOG_DEBUG, "**** THREE ************* \n");
 
 	for (x = 1; x <= AST_RTP_MAX; x <<= 1) {
 		if (!(p->noncodeccapability & x))
@@ -5151,6 +5155,9 @@
 				    &a_audio_next, &a_audio_left,
 				    debug);
 	}
+	ast_log(LOG_DEBUG, "**** FOUR ************* \n");
+	if (option_debug > 2)
+		ast_log(LOG_DEBUG, "Done with adding codecs to SDP\n");
 
 	if(!ast_internal_timing_enabled(p->owner))
 		ast_build_string(&a_audio_next, &a_audio_left, "a=silenceSupp:off - - - -\r\n");
@@ -5162,9 +5169,7 @@
 	ast_build_string(&m_video_next, &m_video_left, "\r\n");
 
 	len = strlen(v) + strlen(s) + strlen(o) + strlen(c) + strlen(t) + strlen(m_audio) + strlen(a_audio) + strlen(hold);
-	if ((p->vrtp) &&
-	    (!ast_test_flag(&p->flags[0], SIP_NOVIDEO)) &&
-	    (capability & VIDEO_CODEC_MASK)) /* only if video response is appropriate */
+	if (needvideo)
 		len += strlen(m_video) + strlen(a_video) + strlen(b) + strlen(hold);
 
 	len = strlen(v) + strlen(s) + strlen(o) + strlen(c) + strlen(t) + strlen(m_audio) + strlen(a_audio) + strlen(hold);
@@ -5196,6 +5201,8 @@
 		char buf[BUFSIZ];
 		ast_log(LOG_DEBUG, "We're settling with offering these formats: %s\n", ast_getformatname_multiple(buf, BUFSIZ, capability));
 	}
+	if (option_debug > 2)
+		ast_log(LOG_DEBUG, "Done building SDP\n");
 
 	return 0;
 }



More information about the asterisk-commits mailing list