From 67e35c7b4748c3cef954820a2b182e2a5edf8d98 Mon Sep 17 00:00:00 2001
From: Mark Michelson <mmichelson@digium.com>
Date: Fri, 14 Jun 2013 23:26:50 +0000
Subject: [PATCH] Fix regression in MWI stasis handling.

In revision 389733, mwi state allocation was placed into its
own function instead of performing the allocation in-line when
required. The issue was that in ast_publish_mwi_state_full(),
the local variable "uniqueid" was no longer being set, but it was
still being used as the topic for MWI. This meant that all MWI
publications ended up being published to the "" (empty string)
mailbox topic. Thus MWI subscriptions for specific mailboxes were
never notified of mailbox state changes.

This change fixes the issue by removing the local uniqueid variable
from ast_publish_mwi_state_full() and instead referencing the
mwi_state->uniqueid field since it has been properly set.

(closes issue ASTERISK-21913)
Reported by Malcolm Davenport



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391921 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 main/app.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/main/app.c b/main/app.c
index 0b829cc0e5..a7a9029c95 100644
--- a/main/app.c
+++ b/main/app.c
@@ -2727,7 +2727,6 @@ int ast_publish_mwi_state_full(
 {
 	RAII_VAR(struct ast_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;
 
 	mwi_state = ast_mwi_create(mailbox, context);
@@ -2758,7 +2757,7 @@ int ast_publish_mwi_state_full(
 
 	message = stasis_message_create(ast_mwi_state_type(), mwi_state);
 
-	mailbox_specific_topic = ast_mwi_topic(ast_str_buffer(uniqueid));
+	mailbox_specific_topic = ast_mwi_topic(mwi_state->uniqueid);
 	if (!mailbox_specific_topic) {
 		return -1;
 	}
-- 
GitLab