[asterisk-commits] mmichelson: branch 12 r397955 - /branches/12/res/res_pjsip_pubsub.c

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


Author: mmichelson
Date: Thu Aug 29 17:24:30 2013
New Revision: 397955

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397955
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.


Modified:
    branches/12/res/res_pjsip_pubsub.c

Modified: branches/12/res/res_pjsip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_pubsub.c?view=diff&rev=397955&r1=397954&r2=397955
==============================================================================
--- branches/12/res/res_pjsip_pubsub.c (original)
+++ branches/12/res/res_pjsip_pubsub.c Thu Aug 29 17:24:30 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