[svn-commits] mmichelson: branch mmichelson/subscription_abstraction r416652 - in /team/mmi...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jun 18 15:54:58 CDT 2014


Author: mmichelson
Date: Wed Jun 18 15:54:51 2014
New Revision: 416652

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=416652
Log:
Fix whitespace problems. Add off-nominal handling for notify_required() callbacks.


Modified:
    team/mmichelson/subscription_abstraction/include/asterisk/res_pjsip_pubsub.h
    team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c
    team/mmichelson/subscription_abstraction/res/res_pjsip_mwi.c
    team/mmichelson/subscription_abstraction/res/res_pjsip_pubsub.c

Modified: team/mmichelson/subscription_abstraction/include/asterisk/res_pjsip_pubsub.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/subscription_abstraction/include/asterisk/res_pjsip_pubsub.h?view=diff&rev=416652&r1=416651&r2=416652
==============================================================================
--- team/mmichelson/subscription_abstraction/include/asterisk/res_pjsip_pubsub.h (original)
+++ team/mmichelson/subscription_abstraction/include/asterisk/res_pjsip_pubsub.h Wed Jun 18 15:54:51 2014
@@ -349,7 +349,7 @@
  * \param size The size of the buffer.
  */
 void ast_sip_subscription_get_local_uri(struct ast_sip_subscription *sub, char *buf, size_t size);
- 
+
 /*!
  * \brief Retrive the remote URI for this subscription
  *
@@ -373,7 +373,7 @@
  * are stored on the subscription. This method allows access to the header. The
  * return is the same as pjsip_msg_find_hdr_by_name(), meaning that it is dependent
  * on the header being searched for.
- * 
+ *
  * \param sub The subscription to search in.
  * \param header The name of the header to search for.
  * \return The discovered header, or NULL if the header cannot be found.

Modified: team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c?view=diff&rev=416652&r1=416651&r2=416652
==============================================================================
--- team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c (original)
+++ team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c Wed Jun 18 15:54:51 2014
@@ -131,7 +131,7 @@
 		struct ast_sip_subscription *sip_sub, struct ast_sip_endpoint *endpoint)
 {
 	struct exten_state_subscription * exten_state_sub;
-	
+
 	exten_state_sub = ao2_alloc(sizeof(*exten_state_sub), exten_state_subscription_destructor);
 	if (!exten_state_sub) {
 		return NULL;

Modified: team/mmichelson/subscription_abstraction/res/res_pjsip_mwi.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/subscription_abstraction/res/res_pjsip_mwi.c?view=diff&rev=416652&r1=416651&r2=416652
==============================================================================
--- team/mmichelson/subscription_abstraction/res/res_pjsip_mwi.c (original)
+++ team/mmichelson/subscription_abstraction/res/res_pjsip_mwi.c Wed Jun 18 15:54:51 2014
@@ -656,7 +656,7 @@
 	}
 
 	aor = ast_sip_location_retrieve_aor(resource);
-	
+
 	if (!aor) {
 		ast_log(LOG_WARNING, "Unable to locate aor %s. MWI "
 			"subscription failed.\n", resource);
@@ -714,11 +714,11 @@
 	case AST_SIP_SUBSCRIPTION_NOTIFY_REASON_TERMINATED:
 	case AST_SIP_SUBSCRIPTION_NOTIFY_REASON_OTHER:
 		mwi_datastore = ast_sip_subscription_get_datastore(sip_sub, "MWI datastore");
-	
+
 		if (!mwi_datastore) {
 			return -1;
 		}
-	
+
 		mwi_sub = mwi_datastore->data;
 
 		send_mwi_notify(mwi_sub);

Modified: team/mmichelson/subscription_abstraction/res/res_pjsip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/subscription_abstraction/res/res_pjsip_pubsub.c?view=diff&rev=416652&r1=416651&r2=416652
==============================================================================
--- team/mmichelson/subscription_abstraction/res/res_pjsip_pubsub.c (original)
+++ team/mmichelson/subscription_abstraction/res/res_pjsip_pubsub.c Wed Jun 18 15:54:51 2014
@@ -998,7 +998,7 @@
 	pjsip_dialog *dlg = sip_subscription_get_dlg(sub);
 	ast_copy_pj_str(buf, &dlg->local.info_str, size);
 }
- 
+
 void ast_sip_subscription_get_remote_uri(struct ast_sip_subscription *sub, char *buf, size_t size)
 {
 	pjsip_dialog *dlg = sip_subscription_get_dlg(sub);
@@ -1359,7 +1359,9 @@
 		sub->persistence = subscription_persistence_create(sub);
 		subscription_persistence_update(sub, rdata);
 		sip_subscription_accept(sub, rdata, resp);
-		handler->notifier->notify_required(sub, AST_SIP_SUBSCRIPTION_NOTIFY_REASON_STARTED);
+		if (handler->notifier->notify_required(sub, AST_SIP_SUBSCRIPTION_NOTIFY_REASON_STARTED)) {
+			pjsip_evsub_terminate(sip_subscription_get_evsub, PJ_TRUE);
+		}
 	}
 
 	return PJ_TRUE;
@@ -1482,7 +1484,7 @@
 	if (pjsip_tsx_send_msg(tsx, tdata) != PJ_SUCCESS) {
 		return -1;
 	}
-	
+
 	return 0;
 }
 
@@ -1494,12 +1496,12 @@
 	size_t resource_size;
 	pjsip_sip_uri *request_uri;
 	int resp;
-	
+
 	request_uri = pjsip_uri_get_uri(rdata->msg_info.msg->line.req.uri);
 	resource_size = pj_strlen(&request_uri->user) + 1;
 	resource = alloca(resource_size);
 	ast_copy_pj_str(resource, &request_uri->user, resource_size);
-	
+
 	resp = handler->new_publication(endpoint, resource);
 
 	if (PJSIP_IS_STATUS_IN_CLASS(resp, 200)) {
@@ -1819,7 +1821,9 @@
 	} else {
 		reason = AST_SIP_SUBSCRIPTION_NOTIFY_REASON_RENEWED;
 	}
-	sub->handler->notifier->notify_required(sub, reason);
+	if (sub->handler->notifier->notify_required(sub, reason)) {
+		*p_st_code = 500;
+	}
 }
 
 static void pubsub_on_rx_notify(pjsip_evsub *evsub, pjsip_rx_data *rdata, int *p_st_code,




More information about the svn-commits mailing list