[svn-commits] twilson: branch group/srtp_reboot r253916 - /team/group/srtp_reboot/channels/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Mar 22 18:03:49 CDT 2010


Author: twilson
Date: Mon Mar 22 18:03:45 2010
New Revision: 253916

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=253916
Log:
First attempt at fixing video support

My test client that supports video seems to crash when making SRTP calls, so I
have not been able to test this very well.

Modified:
    team/group/srtp_reboot/channels/chan_sip.c

Modified: team/group/srtp_reboot/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/srtp_reboot/channels/chan_sip.c?view=diff&rev=253916&r1=253915&r2=253916
==============================================================================
--- team/group/srtp_reboot/channels/chan_sip.c (original)
+++ team/group/srtp_reboot/channels/chan_sip.c Mon Mar 22 18:03:45 2010
@@ -6989,8 +6989,6 @@
 		if (numberofports > 1)
 			ast_log(LOG_WARNING, "SDP offered %d ports for media, not supported by Asterisk. Will try anyway...\n", numberofports);
 		
-
-
 		/* Media stream specific parameters */
 		while ((type = get_sdp_line(&iterator, next - 1, req, &value)) != '\0') {
 			int processed = FALSE;
@@ -7066,14 +7064,18 @@
 		return -1;
 	}
 
-	if (portno == -1 && vportno == -1 && udptlportno == -1  && tportno == -1)
+	if (portno == -1 && vportno == -1 && udptlportno == -1  && tportno == -1) {
 		/* No acceptable offer found in SDP  - we have no ports */
 		/* Do not change RTP or VRTP if this is a re-invite */
+		ast_log(LOG_WARNING, "Failing due to no acceptable offer found\n");
 		return -2;
-
-	if (numberofmediastreams > 3)
+	}
+
+	if (numberofmediastreams > 3) {
 		/* We have too many fax, audio and/or video and/or text media streams, fail this offer */
+		ast_log(LOG_WARNING, "Faling due to too many media streams\n");
 		return -3;
+	}
 
 	if (secure_audio && !(p->srtp && (ast_test_flag(p->srtp, SRTP_CRYPTO_OFFER_OK)))) {
 		ast_log(LOG_WARNING, "Can't provide secure audio requested in SDP offer\n");
@@ -9288,9 +9290,13 @@
 	if (add_t38)
 		len += m_modem->used + a_modem->used;
 	if (a_crypto) {
-		len += strlen(a_crypto);
-	}
-
+		if (needaudio) {
+			len += strlen(a_crypto);
+		}
+		if (needvideo) {
+			len += strlen(a_crypto);
+		}
+	}
 	add_header(resp, "Content-Type", "application/sdp");
 	add_header_contentLength(resp, len);
 	add_line(resp, version);
@@ -9304,14 +9310,21 @@
 		add_line(resp, m_audio->str);
 		add_line(resp, a_audio->str);
 		add_line(resp, hold);
+		if (a_crypto) {
+			add_line(resp, a_crypto);
+		}
 	} else if (p->offered_media[SDP_AUDIO].offered) {
 		snprintf(dummy_answer, sizeof(dummy_answer), "m=audio 0 RTP/AVP %s\r\n", p->offered_media[SDP_AUDIO].codecs);
 		add_line(resp, dummy_answer);
 	}
 	if (needvideo) { /* only if video response is appropriate */
+		ast_log(LOG_NOTICE, "Hey, we need video!\n");
 		add_line(resp, m_video->str);
 		add_line(resp, a_video->str);
 		add_line(resp, hold);	/* Repeat hold for the video stream */
+		if (a_crypto) {
+			add_line(resp, a_crypto);
+		}
 	} else if (p->offered_media[SDP_VIDEO].offered) {
 		snprintf(dummy_answer, sizeof(dummy_answer), "m=video 0 RTP/AVP %s\r\n", p->offered_media[SDP_VIDEO].codecs);
 		add_line(resp, dummy_answer);
@@ -9329,9 +9342,6 @@
 		add_line(resp, a_modem->str);
 	} else if (p->offered_media[SDP_IMAGE].offered) {
 		add_line(resp, "m=image 0 udptl t38\r\n");
-	}
-	if (a_crypto) {
-		add_line(resp, a_crypto);
 	}
 
 	/* Update lastrtprx when we send our SDP */




More information about the svn-commits mailing list