[asterisk-commits] mmichelson: branch mmichelson/pubsub_bodies r406073 - /team/mmichelson/pubsub...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 21 14:27:41 CST 2014


Author: mmichelson
Date: Tue Jan 21 14:27:39 2014
New Revision: 406073

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=406073
Log:
Correct bugs found in PIDF during testing.

* Ensure that all parts of exten_state_data are set.
* Send correct PIDF state when state is closed.


Modified:
    team/mmichelson/pubsub_bodies/res/res_pjsip_exten_state.c
    team/mmichelson/pubsub_bodies/res/res_pjsip_pidf_body_generator.c

Modified: team/mmichelson/pubsub_bodies/res/res_pjsip_exten_state.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pubsub_bodies/res/res_pjsip_exten_state.c?view=diff&rev=406073&r1=406072&r2=406073
==============================================================================
--- team/mmichelson/pubsub_bodies/res/res_pjsip_exten_state.c (original)
+++ team/mmichelson/pubsub_bodies/res/res_pjsip_exten_state.c Tue Jan 21 14:27:39 2014
@@ -233,6 +233,7 @@
 {
 	struct notify_task_data *task_data =
 		ao2_alloc(sizeof(*task_data), notify_task_data_destructor);
+	struct pjsip_dialog *dlg;
 
 	if (!task_data) {
 		ast_log(LOG_WARNING, "Unable to create notify task data\n");
@@ -252,6 +253,12 @@
 	if (task_data->exten_state_data.device_state_info) {
 		ao2_ref(task_data->exten_state_data.device_state_info, +1);
 	}
+
+	dlg = ast_sip_subscription_get_dlg(exten_state_sub->sip_sub);
+	ast_copy_pj_str(task_data->exten_state_data.local, &dlg->local.info_str,
+			sizeof(task_data->exten_state_data.local));
+	ast_copy_pj_str(task_data->exten_state_data.remote, &dlg->remote.info_str,
+			sizeof(task_data->exten_state_data.remote));
 
 	if ((info->exten_state == AST_EXTENSION_DEACTIVATED) ||
 	    (info->exten_state == AST_EXTENSION_REMOVED)) {
@@ -267,9 +274,16 @@
 {
 	RAII_VAR(struct notify_task_data *, task_data, obj, ao2_cleanup);
 
+	/* Pool allocation has to happen here so that we allocate within a PJLIB thread */
+	task_data->exten_state_data.pool = pjsip_endpt_create_pool(ast_sip_get_pjsip_endpoint(),
+			"exten_state", 1024, 1024);
+
 	create_send_notify(task_data->exten_state_sub, task_data->evsub_state ==
 			   PJSIP_EVSUB_STATE_TERMINATED ? "noresource" : NULL,
 			   task_data->evsub_state, &task_data->exten_state_data);
+
+	pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(),
+			task_data->exten_state_data.pool);
 	return 0;
 }
 

Modified: team/mmichelson/pubsub_bodies/res/res_pjsip_pidf_body_generator.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pubsub_bodies/res/res_pjsip_pidf_body_generator.c?view=diff&rev=406073&r1=406072&r2=406073
==============================================================================
--- team/mmichelson/pubsub_bodies/res/res_pjsip_pidf_body_generator.c (original)
+++ team/mmichelson/pubsub_bodies/res/res_pjsip_pidf_body_generator.c Tue Jan 21 14:27:39 2014
@@ -149,7 +149,7 @@
 	pjpidf_tuple_set_contact(state_data->pool, tuple, pj_cstr(&contact, sanitized));
 	pjpidf_tuple_set_contact_prio(state_data->pool, tuple, pj_cstr(&priority, "1"));
 	pjpidf_status_set_basic_open(pjpidf_tuple_get_status(tuple),
-				     (pidfstate[0] == 'b') || (local_state != NOTIFY_CLOSED));
+			local_state == NOTIFY_OPEN);
 
 	return 0;
 }




More information about the asterisk-commits mailing list