[asterisk-commits] mjordan: branch group/asterisk-13-sipit r424293 - /team/group/asterisk-13-sip...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 1 11:52:10 CDT 2014


Author: mjordan
Date: Wed Oct  1 11:52:07 2014
New Revision: 424293

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=424293
Log:
res/{res_pjsip_sdp_rtp|res_pjsip_session}: Decline media streams that are incompatible

Keep the streams that are incompatible; decline those that aren't. Only send a
488 if nothing in the offer is compatible.

Modified:
    team/group/asterisk-13-sipit/res/res_pjsip_sdp_rtp.c
    team/group/asterisk-13-sipit/res/res_pjsip_session.c

Modified: team/group/asterisk-13-sipit/res/res_pjsip_sdp_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/asterisk-13-sipit/res/res_pjsip_sdp_rtp.c?view=diff&rev=424293&r1=424292&r2=424293
==============================================================================
--- team/group/asterisk-13-sipit/res/res_pjsip_sdp_rtp.c (original)
+++ team/group/asterisk-13-sipit/res/res_pjsip_sdp_rtp.c Wed Oct  1 11:52:07 2014
@@ -247,9 +247,10 @@
 		struct ast_str *thembuf = ast_str_alloca(64);
 
 		ast_rtp_codecs_payloads_destroy(&codecs);
-		ast_log(LOG_WARNING, "No joint capabilities between our configuration(%s) and incoming SDP(%s)\n",
-			ast_format_cap_get_names(peer, &usbuf),
-			ast_format_cap_get_names(caps, &thembuf));
+		ast_log(LOG_NOTICE, "No joint capabilities for '%s' media stream between our configuration(%s) and incoming SDP(%s)\n",
+			session_media->stream_type,
+			ast_format_cap_get_names(caps, &usbuf),
+			ast_format_cap_get_names(peer, &thembuf));
 		return -1;
 	}
 
@@ -754,7 +755,7 @@
 	}
 
 	if (set_caps(session, session_media, stream)) {
-		return -1;
+		return 0;
 	}
 	return 1;
 }
@@ -1086,7 +1087,7 @@
 	ast_sockaddr_set_port(addrs, remote_stream->desc.port);
 	ast_rtp_instance_set_remote_address(session_media->rtp, addrs);
 	if (set_caps(session, session_media, local_stream)) {
-		return -1;
+		return 1;
 	}
 
 	if ((fdno = media_type_to_fdno(media_type)) < 0) {

Modified: team/group/asterisk-13-sipit/res/res_pjsip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/group/asterisk-13-sipit/res/res_pjsip_session.c?view=diff&rev=424293&r1=424292&r2=424293
==============================================================================
--- team/group/asterisk-13-sipit/res/res_pjsip_session.c (original)
+++ team/group/asterisk-13-sipit/res/res_pjsip_session.c Wed Oct  1 11:52:07 2014
@@ -189,6 +189,7 @@
 static int handle_incoming_sdp(struct ast_sip_session *session, const pjmedia_sdp_session *sdp)
 {
 	int i;
+	int handled = 0;
 
 	for (i = 0; i < sdp->media_count; ++i) {
 		/* See if there are registered handlers for this media stream type */
@@ -210,13 +211,20 @@
 
 		if (session_media->handler) {
 			handler = session_media->handler;
+			ast_debug(1, "Negotiating incoming SDP media stream '%s' using %s SDP handler\n",
+				session_media->stream_type,
+				session_media->handler->id);
 			res = handler->negotiate_incoming_sdp_stream(session, session_media, sdp,
 				sdp->media[i]);
 			if (res <= 0) {
 				/* Catastrophic failure or ignored by assigned handler. Abort! */
 				return -1;
 			}
+			ast_debug(1, "Media stream '%s' handled by %s\n",
+				session_media->stream_type,
+				session_media->handler->id);
 			/* Handled by this handler. Move to the next stream */
+			handled = 1;
 			continue;
 		}
 
@@ -226,6 +234,9 @@
 			continue;
 		}
 		AST_LIST_TRAVERSE(&handler_list->list, handler, next) {
+			ast_debug(1, "Negotiating incoming SDP media stream '%s' using %s SDP handler\n",
+				session_media->stream_type,
+				handler->id);
 			res = handler->negotiate_incoming_sdp_stream(session, session_media, sdp,
 				sdp->media[i]);
 			if (res < 0) {
@@ -233,11 +244,18 @@
 				return -1;
 			}
 			if (res > 0) {
+				ast_debug(1, "Media stream '%s' handled by %s\n",
+					session_media->stream_type,
+					handler->id);
 				/* Handled by this handler. Move to the next stream */
 				session_media->handler = handler;
+				handled = 1;
 				break;
 			}
 		}
+	}
+	if (!handled) {
+		return -1;
 	}
 	return 0;
 }
@@ -278,9 +296,15 @@
 
 		handler = session_media->handler;
 		if (handler) {
+			ast_debug(1, "Applying negotiated SDP media stream '%s' using %s SDP handler\n",
+				session_media->stream_type,
+				handler->id);
 			res = handler->apply_negotiated_sdp_stream(session, session_media, local,
 				local->media[i], remote, remote->media[i]);
 			if (res >= 0) {
+				ast_debug(1, "Applied negotiated SDP media stream '%s' using %s SDP handler\n",
+					session_media->stream_type,
+					handler->id);
 				return CMP_MATCH;
 			}
 			return 0;
@@ -292,6 +316,9 @@
 			continue;
 		}
 		AST_LIST_TRAVERSE(&handler_list->list, handler, next) {
+			ast_debug(1, "Applying negotiated SDP media stream '%s' using %s SDP handler\n",
+				session_media->stream_type,
+				handler->id);
 			res = handler->apply_negotiated_sdp_stream(session, session_media, local,
 				local->media[i], remote, remote->media[i]);
 			if (res < 0) {
@@ -299,6 +326,9 @@
 				return 0;
 			}
 			if (res > 0) {
+				ast_debug(1, "Applied negotiated SDP media stream '%s' using %s SDP handler\n",
+					session_media->stream_type,
+					handler->id);
 				/* Handled by this handler. Move to the next stream */
 				session_media->handler = handler;
 				return CMP_MATCH;




More information about the asterisk-commits mailing list