[asterisk-commits] mmichelson: trunk r397957 - in /trunk: ./ res/res_pjsip_pubsub.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 29 17:26:05 CDT 2013


Author: mmichelson
Date: Thu Aug 29 17:26:03 2013
New Revision: 397957

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397957
Log:
Fix when the subscription_terminated callback is called for subscription handlers.

The previous placement would result in the resubscribe() callback called instead of
the subscription_terminated() callback being called when a subscription was ended
via a SUBSCRIBE request. This would result in confusing PJSIP and having it throw
an assertion.
........

Merged revisions 397955 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/res/res_pjsip_pubsub.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Thu Aug 29 17:26:03 2013
@@ -1,1 +1,1 @@
-/branches/12:1-397927,397938,397945-397946
+/branches/12:1-397927,397938,397945-397946,397955

Modified: trunk/res/res_pjsip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip_pubsub.c?view=diff&rev=397957&r1=397956&r2=397957
==============================================================================
--- trunk/res/res_pjsip_pubsub.c (original)
+++ trunk/res/res_pjsip_pubsub.c Thu Aug 29 17:26:03 2013
@@ -962,15 +962,6 @@
 		return;
 	}
 
-	if (event->type == PJSIP_EVENT_RX_MSG) {
-		sub->handler->subscription_terminated(sub, event->body.rx_msg.rdata);
-	}
-
-	if (event->type == PJSIP_EVENT_TSX_STATE &&
-			event->body.tsx_state.type == PJSIP_EVENT_RX_MSG) {
-		sub->handler->subscription_terminated(sub, event->body.tsx_state.src.rdata);
-	}
-
 	if (sub->handler->subscription_shutdown) {
 		sub->handler->subscription_shutdown(sub);
 	}
@@ -1052,6 +1043,11 @@
 		return;
 	}
 
+	if (pjsip_evsub_get_state(sub->evsub) == PJSIP_EVSUB_STATE_TERMINATED) {
+		sub->handler->subscription_terminated(sub, rdata);
+		return;
+	}
+
 	sub->handler->resubscribe(sub, rdata, &response_data);
 
 	if (!response_data_changed(&response_data)) {




More information about the asterisk-commits mailing list