[asterisk-commits] file: trunk r395455 - /trunk/res/res_sip_session.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 25 15:54:19 CDT 2013


Author: file
Date: Thu Jul 25 15:54:17 2013
New Revision: 395455

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395455
Log:
Fix crash due to trying to send a re-invite while in the incorrect state.

This crash would occur if a re-invite was queued while the initial INVITE
transaction was still occurring and the response to the INVITE was not ACKed.
This lack of ACK would cause the INVITE session state to never reach confirmed.
Once the transaction terminated, however, the queued re-invite would occur and
cause a crash due to this lack of state change.

This fix checks the INVITE session state before performing the re-invite to
ensure it is in the required confirmed state.

Modified:
    trunk/res/res_sip_session.c

Modified: trunk/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_sip_session.c?view=diff&rev=395455&r1=395454&r2=395455
==============================================================================
--- trunk/res/res_sip_session.c (original)
+++ trunk/res/res_sip_session.c Thu Jul 25 15:54:17 2013
@@ -716,11 +716,20 @@
 		return 0;
 	}
 
-	if ((method == AST_SIP_SESSION_REFRESH_METHOD_INVITE) && inv_session->invite_tsx) {
-		/* We can't send a reinvite yet, so delay it */
-		ast_debug(3, "Delaying sending reinvite to %s because of outstanding transaction...\n",
-				ast_sorcery_object_get_id(session->endpoint));
-		return delay_request(session, on_request_creation, on_response, "INVITE", NULL);
+	if (method == AST_SIP_SESSION_REFRESH_METHOD_INVITE) {
+		if (inv_session->invite_tsx) {
+			/* We can't send a reinvite yet, so delay it */
+			ast_debug(3, "Delaying sending reinvite to %s because of outstanding transaction...\n",
+					ast_sorcery_object_get_id(session->endpoint));
+			return delay_request(session, on_request_creation, on_response, "INVITE", NULL);
+		} else if (inv_session->state != PJSIP_INV_STATE_CONFIRMED) {
+			/* Initial INVITE transaction failed to progress us to a confirmed state
+			 * which means re-invites are not possible
+			 */
+			ast_debug(3, "Not sending reinvite to %s because not in confirmed state...\n",
+					ast_sorcery_object_get_id(session->endpoint));
+			return 0;
+		}
 	}
 
 	if (generate_new_sdp) {




More information about the asterisk-commits mailing list