[asterisk-commits] kmoore: branch kmoore/stasis-mwi r383100 - in /team/kmoore/stasis-mwi: channe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 14 13:41:44 CDT 2013


Author: kmoore
Date: Thu Mar 14 13:41:40 2013
New Revision: 383100

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383100
Log:
Address issues on another branch that also apply to this one

Modified:
    team/kmoore/stasis-mwi/channels/chan_dahdi.c
    team/kmoore/stasis-mwi/channels/chan_iax2.c
    team/kmoore/stasis-mwi/channels/chan_mgcp.c
    team/kmoore/stasis-mwi/channels/chan_sip.c
    team/kmoore/stasis-mwi/channels/chan_skinny.c
    team/kmoore/stasis-mwi/channels/chan_unistim.c
    team/kmoore/stasis-mwi/channels/sig_pri.c
    team/kmoore/stasis-mwi/include/asterisk/app.h
    team/kmoore/stasis-mwi/main/app.c
    team/kmoore/stasis-mwi/main/asterisk.c
    team/kmoore/stasis-mwi/res/res_jabber.c
    team/kmoore/stasis-mwi/res/res_xmpp.c

Modified: team/kmoore/stasis-mwi/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/chan_dahdi.c?view=diff&rev=383100&r1=383099&r2=383100
==============================================================================
--- team/kmoore/stasis-mwi/channels/chan_dahdi.c (original)
+++ team/kmoore/stasis-mwi/channels/chan_dahdi.c Thu Mar 14 13:41:40 2013
@@ -5414,7 +5414,7 @@
 	}
 
 	ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
-	mwi_message = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state(), ast_str_buffer(uniqueid));
+	mwi_message = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
 
 	if (mwi_message) {
 		struct stasis_mwi_state *mwi_state = stasis_message_data(mwi_message);
@@ -13218,13 +13218,19 @@
 		if (channel != CHAN_PSEUDO && !ast_strlen_zero(tmp->mailbox)) {
 			char *mailbox, *context;
 			struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
+			struct stasis_topic *mailbox_specific_topic;
+
 			mailbox = context = ast_strdupa(tmp->mailbox);
 			strsep(&context, "@");
 			if (ast_strlen_zero(context))
 				context = "default";
 
 			ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
-			tmp->mwi_event_sub = stasis_subscribe(stasis_mwi_topic(ast_str_buffer(uniqueid)), mwi_event_cb, NULL);
+
+			mailbox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
+			if (mailbox_specific_topic) {
+				tmp->mwi_event_sub = stasis_subscribe(mailbox_specific_topic, mwi_event_cb, NULL);
+			}
 		}
 #ifdef HAVE_DAHDI_LINEREVERSE_VMWI
 		tmp->mwisend_setting = conf->chan.mwisend_setting;

Modified: team/kmoore/stasis-mwi/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/chan_iax2.c?view=diff&rev=383100&r1=383099&r2=383100
==============================================================================
--- team/kmoore/stasis-mwi/channels/chan_iax2.c (original)
+++ team/kmoore/stasis-mwi/channels/chan_iax2.c Thu Mar 14 13:41:40 2013
@@ -8755,7 +8755,7 @@
 			}
 
 			ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
-			msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state(), ast_str_buffer(uniqueid));
+			msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
 
 			if (msg) {
 				struct stasis_mwi_state *mwi_state = stasis_message_data(msg);
@@ -12669,6 +12669,7 @@
 	if (!ast_strlen_zero(peer->mailbox)) {
 		char *mailbox, *context;
 		struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
+		struct stasis_topic *mailbox_specific_topic;
 
 		context = mailbox = ast_strdupa(peer->mailbox);
 		strsep(&context, "@");
@@ -12678,7 +12679,10 @@
 
 		ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
 
-		peer->mwi_event_sub = stasis_subscribe(stasis_mwi_topic(ast_str_buffer(uniqueid)), mwi_event_cb, NULL);
+		mailbox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
+		if (mailbox_specific_topic) {
+			peer->mwi_event_sub = stasis_subscribe(mailbox_specific_topic, mwi_event_cb, NULL);
+		}
 	}
 
 	if (subscribe_acl_change) {

Modified: team/kmoore/stasis-mwi/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/chan_mgcp.c?view=diff&rev=383100&r1=383099&r2=383100
==============================================================================
--- team/kmoore/stasis-mwi/channels/chan_mgcp.c (original)
+++ team/kmoore/stasis-mwi/channels/chan_mgcp.c Thu Mar 14 13:41:40 2013
@@ -4172,6 +4172,8 @@
 				ast_copy_string(e->parkinglot, parkinglot, sizeof(e->parkinglot));
 				if (!ast_strlen_zero(e->mailbox)) {
 					char *mbox, *cntx;
+					struct stasis_topic *mailbox_specific_topic;
+
 					cntx = mbox = ast_strdupa(e->mailbox);
 					strsep(&cntx, "@");
 					if (ast_strlen_zero(cntx)) {
@@ -4179,7 +4181,11 @@
 					}
 					ast_str_reset(uniqueid);
 					ast_str_set(&uniqueid, 0, "%s@%s", mbox, cntx);
-					e->mwi_event_sub = stasis_subscribe(stasis_mwi_topic(ast_str_buffer(uniqueid)), mwi_event_cb, NULL);
+
+					maibox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
+					if (mailbox_specific_topic) {
+						e->mwi_event_sub = stasis_subscribe(mailbox_specific_topic, mwi_event_cb, NULL);
+					}
 				}
 				snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08lx", ast_random());
 				e->msgstate = -1;

Modified: team/kmoore/stasis-mwi/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/chan_sip.c?view=diff&rev=383100&r1=383099&r2=383100
==============================================================================
--- team/kmoore/stasis-mwi/channels/chan_sip.c (original)
+++ team/kmoore/stasis-mwi/channels/chan_sip.c Thu Mar 14 13:41:40 2013
@@ -16652,7 +16652,7 @@
 		ao2_cleanup(peer);
 		return;
 	}
-	if (stasis_mwi_state() == stasis_message_type(msg)) {
+	if (stasis_mwi_state_message() == stasis_message_type(msg)) {
 		sip_send_mwi_to_peer(peer, 0);
 	}
 }
@@ -27619,13 +27619,17 @@
 	struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
 
 	AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
+		struct stasis_topic *mailbox_specific_topic;
 		stasis_unsubscribe(mailbox->event_sub);
 
 		ast_str_reset(uniqueid);
 		ast_str_set(&uniqueid, 0, "%s@%s", mailbox->mailbox, S_OR(mailbox->context, "default"));
 
-		ao2_ref(peer, +1);
-		mailbox->event_sub = stasis_subscribe(stasis_mwi_topic(ast_str_buffer(uniqueid)), mwi_event_cb, peer);
+		mailbox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
+		if (mailbox_specific_topic) {
+			ao2_ref(peer, +1);
+			mailbox->event_sub = stasis_subscribe(mailbox_specific_topic, mwi_event_cb, peer);
+		}
 	}
 }
 
@@ -28841,7 +28845,7 @@
 		ast_str_reset(uniqueid);
 		ast_str_set(&uniqueid, 0, "%s@%s", mailbox->mailbox, S_OR(mailbox->context, "default"));
 
-		msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state(), ast_str_buffer(uniqueid));
+		msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
 		if (!msg) {
 			continue;
 		}

Modified: team/kmoore/stasis-mwi/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/chan_skinny.c?view=diff&rev=383100&r1=383099&r2=383100
==============================================================================
--- team/kmoore/stasis-mwi/channels/chan_skinny.c (original)
+++ team/kmoore/stasis-mwi/channels/chan_skinny.c Thu Mar 14 13:41:40 2013
@@ -3518,7 +3518,7 @@
 		return;
 	}
 
-	if (msg && stasis_mwi_state() == stasis_message_type(msg)) {
+	if (msg && stasis_mwi_state_message() == stasis_message_type(msg)) {
 		struct stasis_mwi_state *mwi_state = stasis_message_data(msg);
 		l->newmsgs = mwi_state->new_msgs;
 	}
@@ -8252,6 +8252,7 @@
 	if (!ast_strlen_zero(l->mailbox)) {
 		char *cfg_mailbox, *cfg_context;
 		struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
+		struct stasis_topic *mailbox_specific_topic;
 
 		cfg_context = cfg_mailbox = ast_strdupa(l->mailbox);
 		ast_verb(3, "Setting mailbox '%s' on line %s\n", cfg_mailbox, l->name);
@@ -8262,7 +8263,10 @@
 
 		ast_str_set(&uniqueid, 0, "%s@%s", cfg_mailbox, cfg_context);
 
-		l->mwi_event_sub = stasis_subscribe(stasis_mwi_topic(ast_str_buffer(uniqueid)), mwi_event_cb, l);
+		mailbox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
+		if (mailbox_specific_topic) {
+			l->mwi_event_sub = stasis_subscribe(mailbox_specific_topic, mwi_event_cb, l);
+		}
 	}
 
 	if (!ast_strlen_zero(vmexten) && ast_strlen_zero(l->vmexten)) {

Modified: team/kmoore/stasis-mwi/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/chan_unistim.c?view=diff&rev=383100&r1=383099&r2=383100
==============================================================================
--- team/kmoore/stasis-mwi/channels/chan_unistim.c (original)
+++ team/kmoore/stasis-mwi/channels/chan_unistim.c Thu Mar 14 13:41:40 2013
@@ -5513,7 +5513,7 @@
 
 	ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
 
-	msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state(), ast_str_buffer(uniqueid));
+	msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
 
 	if (msg) {
 		struct stasis_mwi_state *mwi_state = stasis_message_data(msg);

Modified: team/kmoore/stasis-mwi/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/sig_pri.c?view=diff&rev=383100&r1=383099&r2=383100
==============================================================================
--- team/kmoore/stasis-mwi/channels/sig_pri.c (original)
+++ team/kmoore/stasis-mwi/channels/sig_pri.c Thu Mar 14 13:41:40 2013
@@ -8761,7 +8761,7 @@
 	int idx;
 	struct stasis_mwi_state *mwi_state;
 
-	if (stasis_mwi_state() != stasis_message_type(msg)) {
+	if (stasis_mwi_state_message() != stasis_message_type(msg)) {
 		return;
 	}
 
@@ -8819,7 +8819,7 @@
 		ast_str_reset(uniqueid);
 		ast_str_set(&uniqueid, 0, "%s@%s", pri->mbox[idx].number, pri->mbox[idx].context);
 
-		msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state(), ast_str_buffer(uniqueid));
+		msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
 		if (!msg) {
 			/* No cached event for this mailbox. */
 			continue;
@@ -8962,6 +8962,7 @@
 	for (i = 0; i < ARRAY_LEN(pri->mbox); ++i) {
 		char *mbox_number;
 		char *mbox_context;
+		struct stasis_topic *mailbox_specific_topic;
 
 		mbox_number = strsep(&saveptr, ",");
 		if (!mbox_number) {
@@ -8993,7 +8994,11 @@
 
 		ast_str_set(&mwi_description, -1, "%s span %d[%d] MWI mailbox %s@%s",
 			sig_pri_cc_type_name, pri->span, i, mbox_number, mbox_context);
-		pri->mbox[i].sub = stasis_subscribe(stasis_mwi_topic(ast_str_buffer(uniqueid)), sig_pri_mwi_event_cb, pri);
+
+		mailbox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
+		if (mailbox_specific_topic) {
+			pri->mbox[i].sub = stasis_subscribe(mailbox_specific_topic, sig_pri_mwi_event_cb, pri);
+		}
 		if (!pri->mbox[i].sub) {
 			ast_log(LOG_ERROR, "%s span %d could not subscribe to MWI events for %s@%s.",
 				sig_pri_cc_type_name, pri->span, mbox_number, mbox_context);

Modified: team/kmoore/stasis-mwi/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/include/asterisk/app.h?view=diff&rev=383100&r1=383099&r2=383100
==============================================================================
--- team/kmoore/stasis-mwi/include/asterisk/app.h (original)
+++ team/kmoore/stasis-mwi/include/asterisk/app.h Thu Mar 14 13:41:40 2013
@@ -1166,7 +1166,7 @@
  * \retval NULL if it has not been allocated
  * \since 12
  */
-struct stasis_message_type *stasis_mwi_state(void);
+struct stasis_message_type *stasis_mwi_state_message(void);
 
 /*!
  * \brief Initialize the application core

Modified: team/kmoore/stasis-mwi/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/main/app.c?view=diff&rev=383100&r1=383099&r2=383100
==============================================================================
--- team/kmoore/stasis-mwi/main/app.c (original)
+++ team/kmoore/stasis-mwi/main/app.c Thu Mar 14 13:41:40 2013
@@ -69,6 +69,8 @@
 #include "asterisk/astobj2.h"
 #include "asterisk/stasis.h"
 
+#define MWI_TOPIC_BUCKETS 57
+
 AST_THREADSTORAGE_PUBLIC(ast_str_thread_global_buf);
 
 static pthread_t shaun_of_the_dead_thread = AST_PTHREADT_NULL;
@@ -80,11 +82,12 @@
 
 static AST_LIST_HEAD_STATIC(zombies, zombie);
 
-static struct stasis_topic *__mwi_topic_all;
-static struct stasis_caching_topic *__mwi_topic_cached;
-static struct stasis_message_type *__mwi_message_type;
-static struct ao2_container *__mwi_topics;
-
+static struct stasis_topic *mwi_topic_all;
+static struct stasis_caching_topic *mwi_topic_cached;
+static struct stasis_message_type *mwi_message_type;
+static struct ao2_container *mwi_topics;
+
+/* container for dynamically generated mailbox-specific topics */
 struct mwi_topic {
 	char *uniqueid;
 	struct stasis_subscription *forward;
@@ -2671,22 +2674,22 @@
 
 struct stasis_topic *stasis_mwi_topic_all(void)
 {
-	return __mwi_topic_all;
+	return mwi_topic_all;
 }
 
 struct stasis_caching_topic *stasis_mwi_topic_cached(void)
 {
-	return __mwi_topic_cached;
-}
-
-struct stasis_message_type *stasis_mwi_state(void)
-{
-	return __mwi_message_type;
+	return mwi_topic_cached;
+}
+
+struct stasis_message_type *stasis_mwi_state_message(void)
+{
+	return mwi_message_type;
 }
 
 struct stasis_topic *stasis_mwi_topic(const char *uniqueid)
 {
-	RAII_VAR(struct mwi_topic *, mwi_topic, ao2_find(__mwi_topics, uniqueid, OBJ_KEY), ao2_cleanup);
+	RAII_VAR(struct mwi_topic *, mwi_topic, ao2_find(mwi_topics, uniqueid, OBJ_KEY), ao2_cleanup);
 
 	if (mwi_topic) {
 		return mwi_topic->topic;
@@ -2713,7 +2716,7 @@
 		return NULL;
 	}
 
-	ao2_link(__mwi_topics, mwi_topic);
+	ao2_link(mwi_topics, mwi_topic);
 
 	return mwi_topic->topic;
 }
@@ -2728,6 +2731,7 @@
 	RAII_VAR(struct stasis_mwi_state *, mwi_state, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
 	struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
+	struct stasis_topic *mailbox_specific_topic;
 
 	ast_assert(!ast_strlen_zero(mailbox));
 	ast_assert(!ast_strlen_zero(context));
@@ -2750,17 +2754,21 @@
 		ast_set_default_eid(&mwi_state->eid);
 	}
 
-	message = stasis_message_create(stasis_mwi_state(), mwi_state);
-
-	ast_assert(stasis_mwi_topic(ast_str_buffer(uniqueid)) != NULL);
-	stasis_publish(stasis_mwi_topic(ast_str_buffer(uniqueid)), message);
+	message = stasis_message_create(stasis_mwi_state_message(), mwi_state);
+
+	mailbox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
+	if (!mailbox_specific_topic) {
+		return -1;
+	}
+
+	stasis_publish(mailbox_specific_topic, message);
 
 	return 0;
 }
 
 static const char *mwi_state_get_id(struct stasis_message *message)
 {
-	if (stasis_mwi_state() == stasis_message_type(message)) {
+	if (stasis_mwi_state_message() == stasis_message_type(message)) {
 		struct stasis_mwi_state *mwi_state = stasis_message_data(message);
 		return mwi_state->uniqueid;
 	} else if (stasis_subscription_change() == stasis_message_type(message)) {
@@ -2786,37 +2794,36 @@
 
 static void app_exit(void)
 {
-	ao2_cleanup(__mwi_topic_all);
-	__mwi_topic_all = NULL;
-	stasis_caching_unsubscribe(__mwi_topic_cached);
-	__mwi_topic_cached = NULL;
-	ao2_cleanup(__mwi_message_type);
-	__mwi_message_type = NULL;
-	ao2_cleanup(__mwi_topics);
-	__mwi_topics = NULL;
-}
-
-#define MWI_TOPIC_BUCKETS 57
+	ao2_cleanup(mwi_topic_all);
+	mwi_topic_all = NULL;
+	stasis_caching_unsubscribe(mwi_topic_cached);
+	mwi_topic_cached = NULL;
+	ao2_cleanup(mwi_message_type);
+	mwi_message_type = NULL;
+	ao2_cleanup(mwi_topics);
+	mwi_topics = NULL;
+}
 
 int app_init(void)
 {
+	mwi_topic_all = stasis_topic_create("stasis_mwi_topic");
+	if (!mwi_topic_all) {
+		return -1;
+	}
+	mwi_topic_cached = stasis_caching_topic_create(mwi_topic_all, mwi_state_get_id);
+	if (!mwi_topic_cached) {
+		return -1;
+	}
+	mwi_message_type = stasis_message_type_create("stasis_mwi_state");
+	if (!mwi_message_type) {
+		return -1;
+	}
+	mwi_topics = ao2_container_alloc(MWI_TOPIC_BUCKETS, mwi_topic_hash, mwi_topic_cmp);
+	if (!mwi_topics) {
+		return -1;
+	}
+
 	ast_register_atexit(app_exit);
-	__mwi_topic_all = stasis_topic_create("stasis_mwi_topic");
-	if (!__mwi_topic_all) {
-		return -1;
-	}
-	__mwi_topic_cached = stasis_caching_topic_create(__mwi_topic_all, mwi_state_get_id);
-	if (!__mwi_topic_cached) {
-		return -1;
-	}
-	__mwi_message_type = stasis_message_type_create("stasis_mwi_state");
-	if (!__mwi_message_type) {
-		return -1;
-	}
-	__mwi_topics = ao2_container_alloc(MWI_TOPIC_BUCKETS, mwi_topic_hash, mwi_topic_cmp);
-	if (!__mwi_topics) {
-		return -1;
-	}
 	return 0;
 }
 

Modified: team/kmoore/stasis-mwi/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/main/asterisk.c?view=diff&rev=383100&r1=383099&r2=383100
==============================================================================
--- team/kmoore/stasis-mwi/main/asterisk.c (original)
+++ team/kmoore/stasis-mwi/main/asterisk.c Thu Mar 14 13:41:40 2013
@@ -4126,11 +4126,6 @@
 		exit(1);
 	}
 
-	if (app_init()) {
-		printf("App core initialization failed.\n%s", term_quit());
-		exit(1);
-	}
-
 	ast_makesocket();
 	sigemptyset(&sigs);
 	sigaddset(&sigs, SIGHUP);
@@ -4183,6 +4178,11 @@
 
 	aco_init();
 
+	if (app_init()) {
+		printf("App core initialization failed.\n%s", term_quit());
+		exit(1);
+	}
+
 	if (astdb_init()) {
 		printf("%s", term_quit());
 		exit(1);

Modified: team/kmoore/stasis-mwi/res/res_jabber.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/res/res_jabber.c?view=diff&rev=383100&r1=383099&r2=383100
==============================================================================
--- team/kmoore/stasis-mwi/res/res_jabber.c (original)
+++ team/kmoore/stasis-mwi/res/res_jabber.c Thu Mar 14 13:41:40 2013
@@ -3249,9 +3249,7 @@
 	struct aji_client *client = data;
 	struct stasis_mwi_state *mwi_state;
 
-	if (stasis_subscription_final_message(sub, msg)) {
-		ASTOBJ_UNREF(client, ast_aji_client_destroy);
-	} else if (stasis_mwi_state() != stasis_message_type(msg)) {
+	if (!stasis_subscription_is_subscribed(sub) || stasis_mwi_state() != stasis_message_type(msg)) {
 		return;
 	}
 
@@ -3305,7 +3303,6 @@
 static void aji_init_event_distribution(struct aji_client *client)
 {
 	if (!mwi_sub) {
-		client = ASTOBJ_REF(client);
 		mwi_sub = stasis_subscribe(stasis_mwi_topic_all(), aji_mwi_cb, client);
 	}
 	if (!device_state_sub) {

Modified: team/kmoore/stasis-mwi/res/res_xmpp.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/res/res_xmpp.c?view=diff&rev=383100&r1=383099&r2=383100
==============================================================================
--- team/kmoore/stasis-mwi/res/res_xmpp.c (original)
+++ team/kmoore/stasis-mwi/res/res_xmpp.c Thu Mar 14 13:41:40 2013
@@ -1326,10 +1326,7 @@
 	char oldmsgs[10], newmsgs[10];
 	struct stasis_mwi_state *mwi_state;
 
-	if (stasis_subscription_final_message(sub, msg)) {
-		ao2_cleanup(client);
-		return;
-	} else if (stasis_mwi_state() != stasis_message_type(msg)) {
+	if (!stasis_subscription_is_subscribed(sub) || stasis_mwi_state_message() != stasis_message_type(msg)) {
 		return;
 	}
 
@@ -1595,8 +1592,6 @@
 	if (!(client->mwi_sub = stasis_subscribe(stasis_mwi_topic_all(), xmpp_pubsub_mwi_cb, client))) {
 		return;
 	}
-	/* bump the ref held by the subscription */
-	ao2_ref(client, +1);
 
 	if (ast_enable_distributed_devstate()) {
 		return;




More information about the asterisk-commits mailing list