[asterisk-commits] bebuild: tag 13.0.1 r428443 - in /tags/13.0.1: ./ channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 20 11:04:39 CST 2014


Author: bebuild
Date: Thu Nov 20 11:04:36 2014
New Revision: 428443

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=428443
Log:
Merge r428302 for AST-2014-015

Modified:
    tags/13.0.1/   (props changed)
    tags/13.0.1/ChangeLog
    tags/13.0.1/channels/chan_pjsip.c

Propchange: tags/13.0.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 20 11:04:36 2014
@@ -1,1 +1,1 @@
-/branches/13:428343,428413,428425
+/branches/13:428302,428343,428413,428425

Modified: tags/13.0.1/ChangeLog
URL: http://svnview.digium.com/svn/asterisk/tags/13.0.1/ChangeLog?view=diff&rev=428443&r1=428442&r2=428443
==============================================================================
--- tags/13.0.1/ChangeLog (original)
+++ tags/13.0.1/ChangeLog Thu Nov 20 11:04:36 2014
@@ -21,6 +21,21 @@
 
 	  ASTERISK-24531 #close
 	  Reported by: Matt Jordan
+
+	* AST-2014-015: Fix race condition in chan_pjsip when sending responses
+	  after a CANCEL has been received.
+
+	  Due to the serialized architecture of chan_pjsip there exists a race
+	  condition where a CANCEL may be received and processed before
+	  responses (such as 180 Ringing, 183 Session Progress, and 200 OK)
+	  are sent. Since the session is in an unexpected state PJSIP will
+	  assert when this is attempted.
+
+	  This change makes it so that these responses are not sent on
+	  disconnected sessions.
+
+	  ASTERISK-24471 #close
+	  Reported by: yaron nahum
 
 	* AST-2014-018 - func_db: DB Dialplan function permission escalation
 	  via AMI.

Modified: tags/13.0.1/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/tags/13.0.1/channels/chan_pjsip.c?view=diff&rev=428443&r1=428442&r2=428443
==============================================================================
--- tags/13.0.1/channels/chan_pjsip.c (original)
+++ tags/13.0.1/channels/chan_pjsip.c Thu Nov 20 11:04:36 2014
@@ -489,6 +489,11 @@
 	pjsip_tx_data *packet = NULL;
 	struct ast_sip_session *session = data;
 
+	if (session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
+		ao2_ref(session, -1);
+		return 0;
+	}
+
 	pjsip_dlg_inc_lock(session->inv_session->dlg);
 	if (session->inv_session->invite_tsx) {
 		status = pjsip_inv_answer(session->inv_session, 200, NULL, NULL, &packet);
@@ -1001,7 +1006,8 @@
 	struct ast_sip_session *session = ind_data->session;
 	int response_code = ind_data->response_code;
 
-	if (pjsip_inv_answer(session->inv_session, response_code, NULL, NULL, &packet) == PJ_SUCCESS) {
+	if ((session->inv_session->state != PJSIP_INV_STATE_DISCONNECTED) &&
+		(pjsip_inv_answer(session->inv_session, response_code, NULL, NULL, &packet) == PJ_SUCCESS)) {
 		ast_sip_session_send_response(session, packet);
 	}
 
@@ -1052,6 +1058,10 @@
 
 	if ((ast_channel_state(session->channel) != AST_STATE_UP) && (session->inv_session->role == PJSIP_UAS_ROLE)) {
 		int response_code = 0;
+
+		if (session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
+			return 0;
+		}
 
 		if (ast_channel_state(session->channel) == AST_STATE_RING) {
 			response_code = !session->endpoint->inband_progress ? 180 : 183;




More information about the asterisk-commits mailing list