[svn-commits] file: branch file/gulp_fax r395495 - in /team/file/gulp_fax: include/asterisk...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jul 26 09:09:21 CDT 2013


Author: file
Date: Fri Jul 26 09:09:19 2013
New Revision: 395495

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395495
Log:
Incorporate review feedback.

Modified:
    team/file/gulp_fax/include/asterisk/res_sip_session.h
    team/file/gulp_fax/res/res_sip_session.c
    team/file/gulp_fax/res/res_sip_t38.c

Modified: team/file/gulp_fax/include/asterisk/res_sip_session.h
URL: http://svnview.digium.com/svn/asterisk/team/file/gulp_fax/include/asterisk/res_sip_session.h?view=diff&rev=395495&r1=395494&r2=395495
==============================================================================
--- team/file/gulp_fax/include/asterisk/res_sip_session.h (original)
+++ team/file/gulp_fax/include/asterisk/res_sip_session.h Fri Jul 26 09:09:19 2013
@@ -230,13 +230,16 @@
 	/*! An identifier for this handler */
 	const char *id;
 	/*!
-	 * \brief Defer re-invited stream
+	 * \brief Determine whether a stream requires that the re-invite be deferred.
+	 * If a stream can not be immediately negotiated the re-invite can be deferred and
+	 * resumed at a later time. It is up to the handler which caused deferral to occur
+	 * to resume it.
 	 * \param session The session for which the media is being re-invited
 	 * \param session_media The media being reinvited
 	 * \param sdp The entire SDP.
-	 * \retval 0 The stream was not handled by this handler. If there are other registered handlers for this stream type, they will be called.
-	 * \retval <0 Re-invite should be deferred. No further operation will take place.
-	 * \retval >0 The stream was explicitly not deferred by this handler. No further handler of this stream type will be called.
+	 * \retval 0 The stream was unhandled or does not need the re-invite to be deferred.
+	 * \retval 1 Re-invite should be deferred and will be resumed later. No further operations will take place.
+	 * \retval 0 The stream was not deferred by this handler. If there are other registered handlers for this stream type, they will be called.
 	 * \note This is optional, if not implemented the stream is assumed to not be deferred.
 	 */
 	int (*defer_incoming_sdp_stream)(struct ast_sip_session *session, struct ast_sip_session_media *session_media, const struct pjmedia_sdp_session *sdp, const struct pjmedia_sdp_media *stream);
@@ -551,7 +554,9 @@
  *
  * \param session The session which has a pending incoming re-invite
  *
- * \note It is possible for the defer_incoming_sdp_stream callback to be called yet again when this is invoked
+ * \note When resuming a re-invite it is given to the pjsip stack as if it
+ *       had just been received from a transport, this means that the deferral
+ *       callback will be called again.
  */
 void ast_sip_session_resume_reinvite(struct ast_sip_session *session);
 

Modified: team/file/gulp_fax/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/file/gulp_fax/res/res_sip_session.c?view=diff&rev=395495&r1=395494&r2=395495
==============================================================================
--- team/file/gulp_fax/res/res_sip_session.c (original)
+++ team/file/gulp_fax/res/res_sip_session.c Fri Jul 26 09:09:19 2013
@@ -780,11 +780,16 @@
 	.on_rx_request = session_on_rx_request,
 };
 
-static int handle_deferring_sdp(struct ast_sip_session *session, const pjmedia_sdp_session *sdp)
+/*! \brief Determine whether the SDP provided requires deferral of negotiating or not
+ *
+ * \retval 1 re-invite should be deferred and resumed later
+ * \retval 0 re-invite should not be deferred
+ */
+static int sdp_requires_deferral(struct ast_sip_session *session, const pjmedia_sdp_session *sdp)
 {
 	int i;
 	if (validate_incoming_sdp(sdp)) {
-		return -1;
+		return 0;
 	}
 
 	for (i = 0; i < sdp->media_count; ++i) {
@@ -809,12 +814,8 @@
 			handler = session_media->handler;
 			res = handler->defer_incoming_sdp_stream(
 				session, session_media, sdp, sdp->media[i]);
-			if (res <= 0) {
+			if (res) {
 				return 1;
-			}
-			if (res > 0) {
-				/* Handled by this handler. Move to the next stream */
-				continue;
 			}
 		}
 
@@ -834,13 +835,8 @@
 				continue;
 			}
 			res = handler->defer_incoming_sdp_stream(session, session_media, sdp, sdp->media[i]);
-			if (res < 0) {
+			if (res) {
 				return 1;
-			}
-			if (res > 0) {
-				/* Handled by this handler. Move to the next stream */
-				session_media->handler = handler;
-				break;
 			}
 		}
 	}
@@ -884,7 +880,7 @@
 	if (!(sdp_info = pjsip_rdata_get_sdp_info(rdata)) ||
 		(sdp_info->sdp_err != PJ_SUCCESS) ||
 		!sdp_info->sdp ||
-		!handle_deferring_sdp(session, sdp_info->sdp)) {
+		!sdp_requires_deferral(session, sdp_info->sdp)) {
 		return PJ_FALSE;
 	}
 

Modified: team/file/gulp_fax/res/res_sip_t38.c
URL: http://svnview.digium.com/svn/asterisk/team/file/gulp_fax/res/res_sip_t38.c?view=diff&rev=395495&r1=395494&r2=395495
==============================================================================
--- team/file/gulp_fax/res/res_sip_t38.c (original)
+++ team/file/gulp_fax/res/res_sip_t38.c Fri Jul 26 09:09:19 2013
@@ -309,8 +309,8 @@
 	struct t38_state *state = t38_state_get_or_alloc(data->session);
 	RAII_VAR(struct ast_sip_session_media *, session_media, ao2_find(data->session->media, "image", OBJ_KEY), ao2_cleanup);
 
-	/* Without state we can't interpret parameters */
-	if (!state) {
+	/* Without session media or state we can't interpret parameters */
+	if (!session_media || !state) {
 		return 0;
 	}
 
@@ -570,15 +570,15 @@
 	struct t38_state *state;
 
 	if (!session->endpoint->t38udptl) {
-		return 1;
+		return 0;
 	}
 
 	if (t38_initialize_session(session, session_media)) {
-		return 1;
+		return 0;
 	}
 
 	if (!(state = t38_state_get_or_alloc(session))) {
-		return 1;
+		return 0;
 	}
 
 	t38_interpret_sdp(state, session, session_media, stream);
@@ -586,7 +586,7 @@
 	/* If they are initiating the re-invite we need to defer responding until later */
 	if (session->t38state == T38_DISABLED) {
 		t38_change_state(session, session_media, state, T38_PEER_REINVITE);
-		return -1;
+		return 1;
 	}
 
 	return 0;
@@ -618,6 +618,13 @@
 	/* Ensure that the address provided is valid */
 	if (ast_sockaddr_resolve(&addrs, host, PARSE_PORT_FORBID, AST_AF_INET) <= 0) {
 		/* The provided host was actually invalid so we error out this negotiation */
+		return -1;
+	}
+
+	/* Check the address family to make sure it matches configured */
+	if ((ast_sockaddr_is_ipv6(addrs) && !session->endpoint->t38udptl_ipv6) ||
+		(ast_sockaddr_is_ipv4(addrs) && session->endpoint->t38udptl_ipv6)) {
+		/* The address does not match configured */
 		return -1;
 	}
 




More information about the svn-commits mailing list