[Asterisk-code-review] app.[ch], mwi core: Move core MWI functionality into its own files (...asterisk[13])

Kevin Harwell asteriskteam at digium.com
Tue Apr 9 15:08:16 CDT 2019


Kevin Harwell has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11250


Change subject: app.[ch], mwi core: Move core MWI functionality into its own files
......................................................................

app.[ch], mwi core: Move core MWI functionality into its own files

There is enough MWI functionality to warrant it having its own 'c' and header
files. This patch moves all current core MWI data structures, and functions
into the following files:

main/mwi.h
main/mwi.c

Note, code was simply moved, and not modified. However, this patch is also in
preparation for core MWI changes, and additions to come.

Change-Id: I9dde8bfae1e7ec254fa63166e090f77e4d3097e0
---
M apps/app_minivm.c
M apps/app_voicemail.c
M channels/chan_dahdi.c
M channels/chan_iax2.c
M channels/chan_mgcp.c
M channels/chan_sip.c
M channels/chan_skinny.c
M channels/chan_unistim.c
M include/asterisk/app.h
A include/asterisk/mwi.h
M main/app.c
M main/asterisk.c
M main/manager.c
M main/manager_mwi.c
A main/mwi.c
M res/res_mwi_devstate.c
M res/res_mwi_external.c
M res/res_pjsip_mwi.c
M res/res_pjsip_publish_asterisk.c
M res/res_pjsip_pubsub.c
M res/res_smdi.c
M res/res_xmpp.c
22 files changed, 630 insertions(+), 531 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/50/11250/1

diff --git a/apps/app_minivm.c b/apps/app_minivm.c
index ef73cab..dae033f 100644
--- a/apps/app_minivm.c
+++ b/apps/app_minivm.c
@@ -166,6 +166,7 @@
 #include "asterisk/say.h"
 #include "asterisk/module.h"
 #include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/dsp.h"
 #include "asterisk/localtime.h"
 #include "asterisk/cli.h"
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 64167d1..d83587f 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -122,6 +122,7 @@
 #include "asterisk/module.h"
 #include "asterisk/adsi.h"
 #include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/manager.h"
 #include "asterisk/dsp.h"
 #include "asterisk/localtime.h"
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 1f769c9..d425b32 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -110,7 +110,7 @@
 #include "asterisk/musiconhold.h"
 #include "asterisk/say.h"
 #include "asterisk/tdd.h"
-#include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/dsp.h"
 #include "asterisk/astdb.h"
 #include "asterisk/manager.h"
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index b485fd1..83d9711 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -95,6 +95,7 @@
 #include "asterisk/manager.h"
 #include "asterisk/callerid.h"
 #include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/astdb.h"
 #include "asterisk/musiconhold.h"
 #include "asterisk/features.h"
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 5b3089b..c0f522d 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -71,6 +71,7 @@
 #include "asterisk/astdb.h"
 #include "asterisk/features.h"
 #include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/musiconhold.h"
 #include "asterisk/utils.h"
 #include "asterisk/netsock2.h"
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 6836db3..7c8928d 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -276,7 +276,7 @@
 #include "sip/include/security_events.h"
 #include "sip/include/route.h"
 #include "asterisk/sip_api.h"
-#include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/bridge.h"
 #include "asterisk/stasis.h"
 #include "asterisk/stasis_endpoints.h"
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 9c63da9..c3044c2 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -71,6 +71,7 @@
 #include "asterisk/causes.h"
 #include "asterisk/pickup.h"
 #include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/musiconhold.h"
 #include "asterisk/utils.h"
 #include "asterisk/dsp.h"
diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index 1809c8a..b846585 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -69,6 +69,7 @@
 #include "asterisk/callerid.h"
 #include "asterisk/cli.h"
 #include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/musiconhold.h"
 #include "asterisk/causes.h"
 #include "asterisk/indications.h"
diff --git a/include/asterisk/app.h b/include/asterisk/app.h
index 0865121..df3990f 100644
--- a/include/asterisk/app.h
+++ b/include/asterisk/app.h
@@ -1470,200 +1470,6 @@
 int ast_app_parse_timelen(const char *timestr, int *result, enum ast_timelen defunit);
 
 /*!
- * \since 12
- * \brief Publish a MWI state update via stasis
- *
- * \param[in] mailbox The mailbox identifier string.
- * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
- * \param[in] new_msgs The number of new messages in this mailbox
- * \param[in] old_msgs The number of old messages in this mailbox
- *
- * \retval 0 Success
- * \retval -1 Failure
- */
-#define ast_publish_mwi_state(mailbox, context, new_msgs, old_msgs) \
-	ast_publish_mwi_state_full(mailbox, context, new_msgs, old_msgs, NULL, NULL)
-
-/*!
- * \since 12
- * \brief Publish a MWI state update associated with some channel
- *
- * \param[in] mailbox The mailbox identifier string.
- * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
- * \param[in] new_msgs The number of new messages in this mailbox
- * \param[in] old_msgs The number of old messages in this mailbox
- * \param[in] channel_id A unique identifier for a channel associated with this
- * change in mailbox state
- *
- * \retval 0 Success
- * \retval -1 Failure
- */
-#define ast_publish_mwi_state_channel(mailbox, context, new_msgs, old_msgs, channel_id) \
-	ast_publish_mwi_state_full(mailbox, context, new_msgs, old_msgs, channel_id, NULL)
-
-/*!
- * \since 12
- * \brief Publish a MWI state update via stasis with all parameters
- *
- * \param[in] mailbox The mailbox identifier string.
- * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
- * \param[in] new_msgs The number of new messages in this mailbox
- * \param[in] old_msgs The number of old messages in this mailbox
- * \param[in] channel_id A unique identifier for a channel associated with this
- * change in mailbox state
- * \param[in] eid The EID of the server that originally published the message
- *
- * \retval 0 Success
- * \retval -1 Failure
- */
-int ast_publish_mwi_state_full(
-	const char *mailbox,
-	const char *context,
-	int new_msgs,
-	int old_msgs,
-	const char *channel_id,
-	struct ast_eid *eid);
-
-/*!
- * \since 12.2.0
- * \brief Delete MWI state cached by stasis
- *
- * \param[in] mailbox The mailbox identifier string.
- * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
- *
- * \retval 0 Success
- * \retval -1 Failure
- */
-#define ast_delete_mwi_state(mailbox, context) \
-	ast_delete_mwi_state_full(mailbox, context, NULL)
-
-/*!
- * \since 12.2.0
- * \brief Delete MWI state cached by stasis with all parameters
- *
- * \param[in] mailbox The mailbox identifier string.
- * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
- * \param[in] eid The EID of the server that originally published the message
- *
- * \retval 0 Success
- * \retval -1 Failure
- */
-int ast_delete_mwi_state_full(const char *mailbox, const char *context, struct ast_eid *eid);
-
-/*! \addtogroup StasisTopicsAndMessages
- * @{
- */
-
-/*!
- * \brief The structure that contains MWI state
- * \since 12
- */
-struct ast_mwi_state {
-	AST_DECLARE_STRING_FIELDS(
-		AST_STRING_FIELD(uniqueid);  /*!< Unique identifier for this mailbox */
-	);
-	int new_msgs;                    /*!< The current number of new messages for this mailbox */
-	int old_msgs;                    /*!< The current number of old messages for this mailbox */
-	/*! If applicable, a snapshot of the channel that caused this MWI change */
-	struct ast_channel_snapshot *snapshot;
-	struct ast_eid eid;              /*!< The EID of the server where this message originated */
-};
-
-/*!
- * \brief Object that represents an MWI update with some additional application
- * defined data
- */
-struct ast_mwi_blob {
-	struct ast_mwi_state *mwi_state;    /*!< MWI state */
-	struct ast_json *blob;              /*!< JSON blob of data */
-};
-
-/*!
- * \since 12
- * \brief Create a \ref ast_mwi_state object
- *
- * \param[in] mailbox The mailbox identifier string.
- * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
- *
- * \retval \ref ast_mwi_state object on success
- * \retval NULL on error
- */
-struct ast_mwi_state *ast_mwi_create(const char *mailbox, const char *context);
-
-/*!
- * \since 12
- * \brief Creates a \ref ast_mwi_blob message.
- *
- * The \a blob JSON object requires a \c "type" field describing the blob. It
- * should also be treated as immutable and not modified after it is put into the
- * message.
- *
- * \param mwi_state MWI state associated with the update
- * \param message_type The type of message to create
- * \param blob JSON object representing the data.
- * \return \ref ast_mwi_blob message.
- * \return \c NULL on error
- */
-struct stasis_message *ast_mwi_blob_create(struct ast_mwi_state *mwi_state,
-					   struct stasis_message_type *message_type,
-					   struct ast_json *blob);
-
-/*!
- * \brief Get the \ref stasis topic for MWI messages
- * \retval The topic structure for MWI messages
- * \retval NULL if it has not been allocated
- * \since 12
- */
-struct stasis_topic *ast_mwi_topic_all(void);
-
-/*!
- * \brief Get the \ref stasis topic for MWI messages on a unique ID
- * \param uniqueid The unique id for which to get the topic
- * \retval The topic structure for MWI messages for a given uniqueid
- * \retval NULL if it failed to be found or allocated
- * \since 12
- */
-struct stasis_topic *ast_mwi_topic(const char *uniqueid);
-
-/*!
- * \brief Get the \ref stasis caching topic for MWI messages
- * \retval The caching topic structure for MWI messages
- * \retval NULL if it has not been allocated
- * \since 12
- */
-struct stasis_topic *ast_mwi_topic_cached(void);
-
-/*!
- * \brief Backend cache for ast_mwi_topic_cached().
- * \retval Cache of \ref ast_mwi_state.
- */
-struct stasis_cache *ast_mwi_state_cache(void);
-
-/*!
- * \brief Get the \ref stasis message type for MWI messages
- * \retval The message type structure for MWI messages
- * \retval NULL on error
- * \since 12
- */
-struct stasis_message_type *ast_mwi_state_type(void);
-
-/*!
- * \brief Get the \ref stasis message type for voicemail application specific messages
- *
- * This message type exists for those messages a voicemail application may wish to send
- * that have no logical relationship with other voicemail applications. Voicemail apps
- * that use this message type must pass a \ref ast_mwi_blob. Any extraneous information
- * in the JSON blob must be packed as key/value pair tuples of strings.
- *
- * At least one key/value tuple must have a key value of "Event".
- *
- * \retval The \ref stasis_message_type for voicemail application specific messages
- * \retval NULL on error
- * \since 12
- */
-struct stasis_message_type *ast_mwi_vm_app_type(void);
-
-/*!
  * \brief Get the \ref stasis topic for queue messages
  * \retval The topic structure for queue messages
  * \retval NULL if it has not been allocated
@@ -1689,7 +1495,6 @@
  */
 int app_init(void);
 
-#define AST_MAX_MAILBOX_UNIQUEID (AST_MAX_EXTENSION + AST_MAX_CONTEXT + 2)
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif
diff --git a/include/asterisk/mwi.h b/include/asterisk/mwi.h
new file mode 100644
index 0000000..9e463d2
--- /dev/null
+++ b/include/asterisk/mwi.h
@@ -0,0 +1,242 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2019, Digium, Inc.
+ *
+ * Kevin Harwell <kharwell at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+#ifndef _ASTERISK_MWI_H
+#define _ASTERISK_MWI_H
+
+#include "asterisk/utils.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+struct ast_json;
+struct stasis_message_type;
+
+/*!
+ * \since 12
+ * \brief Publish a MWI state update via stasis
+ *
+ * \param[in] mailbox The mailbox identifier string.
+ * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
+ * \param[in] new_msgs The number of new messages in this mailbox
+ * \param[in] old_msgs The number of old messages in this mailbox
+ *
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+#define ast_publish_mwi_state(mailbox, context, new_msgs, old_msgs) \
+	ast_publish_mwi_state_full(mailbox, context, new_msgs, old_msgs, NULL, NULL)
+
+/*!
+ * \since 12
+ * \brief Publish a MWI state update associated with some channel
+ *
+ * \param[in] mailbox The mailbox identifier string.
+ * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
+ * \param[in] new_msgs The number of new messages in this mailbox
+ * \param[in] old_msgs The number of old messages in this mailbox
+ * \param[in] channel_id A unique identifier for a channel associated with this
+ * change in mailbox state
+ *
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+#define ast_publish_mwi_state_channel(mailbox, context, new_msgs, old_msgs, channel_id) \
+	ast_publish_mwi_state_full(mailbox, context, new_msgs, old_msgs, channel_id, NULL)
+
+/*!
+ * \since 12
+ * \brief Publish a MWI state update via stasis with all parameters
+ *
+ * \param[in] mailbox The mailbox identifier string.
+ * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
+ * \param[in] new_msgs The number of new messages in this mailbox
+ * \param[in] old_msgs The number of old messages in this mailbox
+ * \param[in] channel_id A unique identifier for a channel associated with this
+ * change in mailbox state
+ * \param[in] eid The EID of the server that originally published the message
+ *
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+int ast_publish_mwi_state_full(
+	const char *mailbox,
+	const char *context,
+	int new_msgs,
+	int old_msgs,
+	const char *channel_id,
+	struct ast_eid *eid);
+
+/*!
+ * \since 12.2.0
+ * \brief Delete MWI state cached by stasis
+ *
+ * \param[in] mailbox The mailbox identifier string.
+ * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
+ *
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+#define ast_delete_mwi_state(mailbox, context) \
+	ast_delete_mwi_state_full(mailbox, context, NULL)
+
+/*!
+ * \since 12.2.0
+ * \brief Delete MWI state cached by stasis with all parameters
+ *
+ * \param[in] mailbox The mailbox identifier string.
+ * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
+ * \param[in] eid The EID of the server that originally published the message
+ *
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+int ast_delete_mwi_state_full(const char *mailbox, const char *context, struct ast_eid *eid);
+
+/*! \addtogroup StasisTopicsAndMessages
+ * @{
+ */
+
+/*!
+ * \brief The structure that contains MWI state
+ * \since 12
+ */
+struct ast_mwi_state {
+	AST_DECLARE_STRING_FIELDS(
+		AST_STRING_FIELD(uniqueid);  /*!< Unique identifier for this mailbox */
+	);
+	int new_msgs;                    /*!< The current number of new messages for this mailbox */
+	int old_msgs;                    /*!< The current number of old messages for this mailbox */
+	/*! If applicable, a snapshot of the channel that caused this MWI change */
+	struct ast_channel_snapshot *snapshot;
+	struct ast_eid eid;              /*!< The EID of the server where this message originated */
+};
+
+/*!
+ * \brief Object that represents an MWI update with some additional application
+ * defined data
+ */
+struct ast_mwi_blob {
+	struct ast_mwi_state *mwi_state;    /*!< MWI state */
+	struct ast_json *blob;              /*!< JSON blob of data */
+};
+
+/*!
+ * \since 12
+ * \brief Create a \ref ast_mwi_state object
+ *
+ * \param[in] mailbox The mailbox identifier string.
+ * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
+ *
+ * \retval \ref ast_mwi_state object on success
+ * \retval NULL on error
+ */
+struct ast_mwi_state *ast_mwi_create(const char *mailbox, const char *context);
+
+/*!
+ * \since 12
+ * \brief Creates a \ref ast_mwi_blob message.
+ *
+ * The \a blob JSON object requires a \c "type" field describing the blob. It
+ * should also be treated as immutable and not modified after it is put into the
+ * message.
+ *
+ * \param mwi_state MWI state associated with the update
+ * \param message_type The type of message to create
+ * \param blob JSON object representing the data.
+ * \return \ref ast_mwi_blob message.
+ * \return \c NULL on error
+ */
+struct stasis_message *ast_mwi_blob_create(struct ast_mwi_state *mwi_state,
+					   struct stasis_message_type *message_type,
+					   struct ast_json *blob);
+
+/*!
+ * \brief Get the \ref stasis topic for MWI messages
+ * \retval The topic structure for MWI messages
+ * \retval NULL if it has not been allocated
+ * \since 12
+ */
+struct stasis_topic *ast_mwi_topic_all(void);
+
+/*!
+ * \brief Get the \ref stasis topic for MWI messages on a unique ID
+ * \param uniqueid The unique id for which to get the topic
+ * \retval The topic structure for MWI messages for a given uniqueid
+ * \retval NULL if it failed to be found or allocated
+ * \since 12
+ */
+struct stasis_topic *ast_mwi_topic(const char *uniqueid);
+
+/*!
+ * \brief Get the \ref stasis caching topic for MWI messages
+ * \retval The caching topic structure for MWI messages
+ * \retval NULL if it has not been allocated
+ * \since 12
+ */
+struct stasis_topic *ast_mwi_topic_cached(void);
+
+/*!
+ * \brief Backend cache for ast_mwi_topic_cached().
+ * \retval Cache of \ref ast_mwi_state.
+ */
+struct stasis_cache *ast_mwi_state_cache(void);
+
+/*!
+ * \brief Get the \ref stasis message type for MWI messages
+ * \retval The message type structure for MWI messages
+ * \retval NULL on error
+ * \since 12
+ */
+struct stasis_message_type *ast_mwi_state_type(void);
+
+/*!
+ * \brief Get the \ref stasis message type for voicemail application specific messages
+ *
+ * This message type exists for those messages a voicemail application may wish to send
+ * that have no logical relationship with other voicemail applications. Voicemail apps
+ * that use this message type must pass a \ref ast_mwi_blob. Any extraneous information
+ * in the JSON blob must be packed as key/value pair tuples of strings.
+ *
+ * At least one key/value tuple must have a key value of "Event".
+ *
+ * \retval The \ref stasis_message_type for voicemail application specific messages
+ * \retval NULL on error
+ * \since 12
+ */
+struct stasis_message_type *ast_mwi_vm_app_type(void);
+
+/*!
+ * \brief Initialize the mwi core
+ *
+ * \retval 0 Success
+ * \retval -1 Failure
+ *
+ * \since 13.26.0
+ * \since 16.4.0
+ */
+int mwi_init(void);
+
+#define AST_MAX_MAILBOX_UNIQUEID (AST_MAX_EXTENSION + AST_MAX_CONTEXT + 2)
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* _ASTERISK_MWI_H */
diff --git a/main/app.c b/main/app.c
index 623843a..5fb81ba 100644
--- a/main/app.c
+++ b/main/app.c
@@ -72,8 +72,6 @@
 #include "asterisk/json.h"
 #include "asterisk/format_cache.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;
@@ -88,57 +86,10 @@
 /*
  * @{ \brief Define \ref stasis topic objects
  */
-static struct stasis_topic *mwi_topic_all;
-static struct stasis_cache *mwi_state_cache;
-static struct stasis_caching_topic *mwi_topic_cached;
-static struct stasis_topic_pool *mwi_topic_pool;
-
 static struct stasis_topic *queue_topic_all;
 static struct stasis_topic_pool *queue_topic_pool;
 /* @} */
 
-/*! \brief Convert a MWI \ref stasis_message to a \ref ast_event */
-static struct ast_event *mwi_to_event(struct stasis_message *message)
-{
-	struct ast_event *event;
-	struct ast_mwi_state *mwi_state;
-	char *mailbox;
-	char *context;
-
-	if (!message) {
-		return NULL;
-	}
-
-	mwi_state = stasis_message_data(message);
-
-	/* Strip off @context */
-	context = mailbox = ast_strdupa(mwi_state->uniqueid);
-	strsep(&context, "@");
-	if (ast_strlen_zero(context)) {
-		context = "default";
-	}
-
-	event = ast_event_new(AST_EVENT_MWI,
-				AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
-				AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
-				AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_UINT, mwi_state->new_msgs,
-				AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_UINT, mwi_state->old_msgs,
-				AST_EVENT_IE_EID, AST_EVENT_IE_PLTYPE_RAW, &mwi_state->eid, sizeof(mwi_state->eid),
-				AST_EVENT_IE_END);
-
-	return event;
-}
-
-/*
- * @{ \brief Define \ref stasis message types for MWI
- */
-STASIS_MESSAGE_TYPE_DEFN(ast_mwi_state_type,
-	.to_event = mwi_to_event, );
-STASIS_MESSAGE_TYPE_DEFN(ast_mwi_vm_app_type);
-/* @} */
-
-
-
 static void *shaun_of_the_dead(void *data)
 {
 	struct zombie *cur;
@@ -3161,255 +3112,6 @@
 	return 0;
 }
 
-
-
-static void mwi_state_dtor(void *obj)
-{
-	struct ast_mwi_state *mwi_state = obj;
-	ast_string_field_free_memory(mwi_state);
-	ao2_cleanup(mwi_state->snapshot);
-	mwi_state->snapshot = NULL;
-}
-
-struct stasis_topic *ast_mwi_topic_all(void)
-{
-	return mwi_topic_all;
-}
-
-struct stasis_cache *ast_mwi_state_cache(void)
-{
-	return mwi_state_cache;
-}
-
-struct stasis_topic *ast_mwi_topic_cached(void)
-{
-	return stasis_caching_get_topic(mwi_topic_cached);
-}
-
-struct stasis_topic *ast_mwi_topic(const char *uniqueid)
-{
-	return stasis_topic_pool_get_topic(mwi_topic_pool, uniqueid);
-}
-
-struct ast_mwi_state *ast_mwi_create(const char *mailbox, const char *context)
-{
-	struct ast_mwi_state *mwi_state;
-
-	ast_assert(!ast_strlen_zero(mailbox));
-
-	mwi_state = ao2_alloc(sizeof(*mwi_state), mwi_state_dtor);
-	if (!mwi_state) {
-		return NULL;
-	}
-
-	if (ast_string_field_init(mwi_state, 256)) {
-		ao2_ref(mwi_state, -1);
-		return NULL;
-	}
-	if (!ast_strlen_zero(context)) {
-		ast_string_field_build(mwi_state, uniqueid, "%s@%s", mailbox, context);
-	} else {
-		ast_string_field_set(mwi_state, uniqueid, mailbox);
-	}
-
-	return mwi_state;
-}
-
-/*!
- * \internal
- * \brief Create a MWI state snapshot message.
- * \since 12.2.0
- *
- * \param[in] mailbox The mailbox identifier string.
- * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
- * \param[in] new_msgs The number of new messages in this mailbox
- * \param[in] old_msgs The number of old messages in this mailbox
- * \param[in] channel_id A unique identifier for a channel associated with this
- * change in mailbox state
- * \param[in] eid The EID of the server that originally published the message
- *
- * \retval message on success.  Use ao2_cleanup() when done with it.
- * \retval NULL on error.
- */
-static struct stasis_message *mwi_state_create_message(
-	const char *mailbox,
-	const char *context,
-	int new_msgs,
-	int old_msgs,
-	const char *channel_id,
-	struct ast_eid *eid)
-{
-	struct ast_mwi_state *mwi_state;
-	struct stasis_message *message;
-
-	if (!ast_mwi_state_type()) {
-		return NULL;
-	}
-
-	mwi_state = ast_mwi_create(mailbox, context);
-	if (!mwi_state) {
-		return NULL;
-	}
-
-	mwi_state->new_msgs = new_msgs;
-	mwi_state->old_msgs = old_msgs;
-
-	if (!ast_strlen_zero(channel_id)) {
-		struct stasis_message *chan_message;
-
-		chan_message = stasis_cache_get(ast_channel_cache(), ast_channel_snapshot_type(),
-			channel_id);
-		if (chan_message) {
-			mwi_state->snapshot = stasis_message_data(chan_message);
-			ao2_ref(mwi_state->snapshot, +1);
-		}
-		ao2_cleanup(chan_message);
-	}
-
-	if (eid) {
-		mwi_state->eid = *eid;
-	} else {
-		mwi_state->eid = ast_eid_default;
-	}
-
-	/*
-	 * XXX As far as stasis is concerned, all MWI events are local.
-	 *
-	 * We may in the future want to make MWI aggregate local/remote
-	 * message counts similar to how device state aggregates state.
-	 */
-	message = stasis_message_create_full(ast_mwi_state_type(), mwi_state, &ast_eid_default);
-	ao2_cleanup(mwi_state);
-	return message;
-}
-
-int ast_publish_mwi_state_full(
-	const char *mailbox,
-	const char *context,
-	int new_msgs,
-	int old_msgs,
-	const char *channel_id,
-	struct ast_eid *eid)
-{
-	struct ast_mwi_state *mwi_state;
-	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
-	struct stasis_topic *mailbox_specific_topic;
-
-	message = mwi_state_create_message(mailbox, context, new_msgs, old_msgs, channel_id, eid);
-	if (!message) {
-		return -1;
-	}
-
-	mwi_state = stasis_message_data(message);
-	mailbox_specific_topic = ast_mwi_topic(mwi_state->uniqueid);
-	if (!mailbox_specific_topic) {
-		return -1;
-	}
-
-	stasis_publish(mailbox_specific_topic, message);
-
-	return 0;
-}
-
-int ast_delete_mwi_state_full(const char *mailbox, const char *context, struct ast_eid *eid)
-{
-	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
-	struct stasis_message *cached_msg;
-	struct stasis_message *clear_msg;
-	struct ast_mwi_state *mwi_state;
-	struct stasis_topic *mailbox_specific_topic;
-
-	msg = mwi_state_create_message(mailbox, context, 0, 0, NULL, eid);
-	if (!msg) {
-		return -1;
-	}
-
-	mwi_state = stasis_message_data(msg);
-
-	/*
-	 * XXX As far as stasis is concerned, all MWI events are local.
-	 *
-	 * For now, it is assumed that there is only one entity
-	 * maintaining the state of a particular mailbox.
-	 *
-	 * If we ever have multiple MWI event entities maintaining
-	 * the same mailbox that wish to delete their cached entry
-	 * we will need to do something about the race condition
-	 * potential between checking the cache and removing the
-	 * cache entry.
-	 */
-	cached_msg = stasis_cache_get_by_eid(ast_mwi_state_cache(),
-		ast_mwi_state_type(), mwi_state->uniqueid, &ast_eid_default);
-	if (!cached_msg) {
-		/* Nothing to clear */
-		return -1;
-	}
-	ao2_cleanup(cached_msg);
-
-	mailbox_specific_topic = ast_mwi_topic(mwi_state->uniqueid);
-	if (!mailbox_specific_topic) {
-		return -1;
-	}
-
-	clear_msg = stasis_cache_clear_create(msg);
-	if (clear_msg) {
-		stasis_publish(mailbox_specific_topic, clear_msg);
-	}
-
-	ao2_cleanup(clear_msg);
-	return 0;
-}
-
-static const char *mwi_state_get_id(struct stasis_message *message)
-{
-	if (ast_mwi_state_type() == stasis_message_type(message)) {
-		struct ast_mwi_state *mwi_state = stasis_message_data(message);
-		return mwi_state->uniqueid;
-	} else if (stasis_subscription_change_type() == stasis_message_type(message)) {
-		struct stasis_subscription_change *change = stasis_message_data(message);
-		return change->uniqueid;
-	}
-
-	return NULL;
-}
-
-static void mwi_blob_dtor(void *obj)
-{
-	struct ast_mwi_blob *mwi_blob = obj;
-
-	ao2_cleanup(mwi_blob->mwi_state);
-	ast_json_unref(mwi_blob->blob);
-}
-
-struct stasis_message *ast_mwi_blob_create(struct ast_mwi_state *mwi_state,
-					       struct stasis_message_type *message_type,
-					       struct ast_json *blob)
-{
-	struct ast_mwi_blob *obj;
-	struct stasis_message *msg;
-
-	ast_assert(blob != NULL);
-
-	if (!message_type) {
-		return NULL;
-	}
-
-	obj = ao2_alloc(sizeof(*obj), mwi_blob_dtor);
-	if (!obj) {
-		return NULL;
-	}
-
-	obj->mwi_state = mwi_state;
-	ao2_ref(obj->mwi_state, +1);
-	obj->blob = ast_json_ref(blob);
-
-	/* This is not a normal MWI event.  Only used by the MinivmNotify app. */
-	msg = stasis_message_create(message_type, obj);
-	ao2_ref(obj, -1);
-
-	return msg;
-}
-
 struct stasis_topic *ast_queue_topic_all(void)
 {
 	return queue_topic_all;
@@ -3426,43 +3128,12 @@
 	queue_topic_pool = NULL;
 	ao2_cleanup(queue_topic_all);
 	queue_topic_all = NULL;
-	ao2_cleanup(mwi_topic_pool);
-	mwi_topic_pool = NULL;
-	ao2_cleanup(mwi_topic_all);
-	mwi_topic_all = NULL;
-	ao2_cleanup(mwi_state_cache);
-	mwi_state_cache = NULL;
-	mwi_topic_cached = stasis_caching_unsubscribe_and_join(mwi_topic_cached);
-	STASIS_MESSAGE_TYPE_CLEANUP(ast_mwi_state_type);
-	STASIS_MESSAGE_TYPE_CLEANUP(ast_mwi_vm_app_type);
 }
 
 int app_init(void)
 {
 	ast_register_cleanup(app_cleanup);
 
-	if (STASIS_MESSAGE_TYPE_INIT(ast_mwi_state_type) != 0) {
-		return -1;
-	}
-	if (STASIS_MESSAGE_TYPE_INIT(ast_mwi_vm_app_type) != 0) {
-		return -1;
-	}
-	mwi_topic_all = stasis_topic_create("mwi:all");
-	if (!mwi_topic_all) {
-		return -1;
-	}
-	mwi_state_cache = stasis_cache_create(mwi_state_get_id);
-	if (!mwi_state_cache) {
-		return -1;
-	}
-	mwi_topic_cached = stasis_caching_topic_create(mwi_topic_all, mwi_state_cache);
-	if (!mwi_topic_cached) {
-		return -1;
-	}
-	mwi_topic_pool = stasis_topic_pool_create(mwi_topic_all);
-	if (!mwi_topic_pool) {
-		return -1;
-	}
 	queue_topic_all = stasis_topic_create("queue:all");
 	if (!queue_topic_all) {
 		return -1;
diff --git a/main/asterisk.c b/main/asterisk.c
index ac5b1d6..30b84e6 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -217,6 +217,7 @@
 #include "asterisk/http.h"
 #include "asterisk/udptl.h"
 #include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/lock.h"
 #include "asterisk/utils.h"
 #include "asterisk/file.h"
@@ -4245,6 +4246,7 @@
 	read_pjproject_startup_options();
 	check_init(ast_pj_init(), "Embedded PJProject");
 	check_init(app_init(), "App Core");
+	check_init(mwi_init(), "MWI Core");
 	check_init(devstate_init(), "Device State Core");
 	check_init(ast_msg_init(), "Messaging API");
 	check_init(ast_data_init(), "Data Retrieval API");
diff --git a/main/manager.c b/main/manager.c
index cb9a713..0cd9ed5 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -73,6 +73,7 @@
 #include "asterisk/lock.h"
 #include "asterisk/cli.h"
 #include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/pbx.h"
 #include "asterisk/md5.h"
 #include "asterisk/acl.h"
diff --git a/main/manager_mwi.c b/main/manager_mwi.c
index 8facc90..b8bc594 100644
--- a/main/manager_mwi.c
+++ b/main/manager_mwi.c
@@ -29,6 +29,7 @@
 
 #include "asterisk/manager.h"
 #include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/channel.h"
 #include "asterisk/stasis_message_router.h"
 #include "asterisk/stasis.h"
diff --git a/main/mwi.c b/main/mwi.c
new file mode 100644
index 0000000..28a493d
--- /dev/null
+++ b/main/mwi.c
@@ -0,0 +1,369 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2019, Digium, Inc.
+ *
+ * Kevin Harwell <kharwell at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*** MODULEINFO
+	<support_level>core</support_level>
+ ***/
+
+#include "asterisk.h"
+
+#include "asterisk/mwi.h"
+#include "asterisk/stasis_channels.h"
+
+/*
+ * @{ \brief Define \ref stasis topic objects
+ */
+static struct stasis_topic *mwi_topic_all;
+static struct stasis_cache *mwi_state_cache;
+static struct stasis_caching_topic *mwi_topic_cached;
+static struct stasis_topic_pool *mwi_topic_pool;
+/* @} */
+
+/*! \brief Convert a MWI \ref stasis_message to a \ref ast_event */
+static struct ast_event *mwi_to_event(struct stasis_message *message)
+{
+	struct ast_event *event;
+	struct ast_mwi_state *mwi_state;
+	char *mailbox;
+	char *context;
+
+	if (!message) {
+		return NULL;
+	}
+
+	mwi_state = stasis_message_data(message);
+
+	/* Strip off @context */
+	context = mailbox = ast_strdupa(mwi_state->uniqueid);
+	strsep(&context, "@");
+	if (ast_strlen_zero(context)) {
+		context = "default";
+	}
+
+	event = ast_event_new(AST_EVENT_MWI,
+				AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
+				AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
+				AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_UINT, mwi_state->new_msgs,
+				AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_UINT, mwi_state->old_msgs,
+				AST_EVENT_IE_EID, AST_EVENT_IE_PLTYPE_RAW, &mwi_state->eid, sizeof(mwi_state->eid),
+				AST_EVENT_IE_END);
+
+	return event;
+}
+
+/*
+ * @{ \brief Define \ref stasis message types for MWI
+ */
+STASIS_MESSAGE_TYPE_DEFN(ast_mwi_state_type,
+	.to_event = mwi_to_event, );
+STASIS_MESSAGE_TYPE_DEFN(ast_mwi_vm_app_type);
+/* @} */
+
+static void mwi_state_dtor(void *obj)
+{
+	struct ast_mwi_state *mwi_state = obj;
+	ast_string_field_free_memory(mwi_state);
+	ao2_cleanup(mwi_state->snapshot);
+	mwi_state->snapshot = NULL;
+}
+
+struct stasis_topic *ast_mwi_topic_all(void)
+{
+	return mwi_topic_all;
+}
+
+struct stasis_cache *ast_mwi_state_cache(void)
+{
+	return mwi_state_cache;
+}
+
+struct stasis_topic *ast_mwi_topic_cached(void)
+{
+	return stasis_caching_get_topic(mwi_topic_cached);
+}
+
+struct stasis_topic *ast_mwi_topic(const char *uniqueid)
+{
+	return stasis_topic_pool_get_topic(mwi_topic_pool, uniqueid);
+}
+
+struct ast_mwi_state *ast_mwi_create(const char *mailbox, const char *context)
+{
+	struct ast_mwi_state *mwi_state;
+
+	ast_assert(!ast_strlen_zero(mailbox));
+
+	mwi_state = ao2_alloc(sizeof(*mwi_state), mwi_state_dtor);
+	if (!mwi_state) {
+		return NULL;
+	}
+
+	if (ast_string_field_init(mwi_state, 256)) {
+		ao2_ref(mwi_state, -1);
+		return NULL;
+	}
+	if (!ast_strlen_zero(context)) {
+		ast_string_field_build(mwi_state, uniqueid, "%s@%s", mailbox, context);
+	} else {
+		ast_string_field_set(mwi_state, uniqueid, mailbox);
+	}
+
+	return mwi_state;
+}
+
+/*!
+ * \internal
+ * \brief Create a MWI state snapshot message.
+ * \since 12.2.0
+ *
+ * \param[in] mailbox The mailbox identifier string.
+ * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
+ * \param[in] new_msgs The number of new messages in this mailbox
+ * \param[in] old_msgs The number of old messages in this mailbox
+ * \param[in] channel_id A unique identifier for a channel associated with this
+ * change in mailbox state
+ * \param[in] eid The EID of the server that originally published the message
+ *
+ * \retval message on success.  Use ao2_cleanup() when done with it.
+ * \retval NULL on error.
+ */
+static struct stasis_message *mwi_state_create_message(
+	const char *mailbox,
+	const char *context,
+	int new_msgs,
+	int old_msgs,
+	const char *channel_id,
+	struct ast_eid *eid)
+{
+	struct ast_mwi_state *mwi_state;
+	struct stasis_message *message;
+
+	if (!ast_mwi_state_type()) {
+		return NULL;
+	}
+
+	mwi_state = ast_mwi_create(mailbox, context);
+	if (!mwi_state) {
+		return NULL;
+	}
+
+	mwi_state->new_msgs = new_msgs;
+	mwi_state->old_msgs = old_msgs;
+
+	if (!ast_strlen_zero(channel_id)) {
+		struct stasis_message *chan_message;
+
+		chan_message = stasis_cache_get(ast_channel_cache(), ast_channel_snapshot_type(),
+			channel_id);
+		if (chan_message) {
+			mwi_state->snapshot = stasis_message_data(chan_message);
+			ao2_ref(mwi_state->snapshot, +1);
+		}
+		ao2_cleanup(chan_message);
+	}
+
+	if (eid) {
+		mwi_state->eid = *eid;
+	} else {
+		mwi_state->eid = ast_eid_default;
+	}
+
+	/*
+	 * XXX As far as stasis is concerned, all MWI events are local.
+	 *
+	 * We may in the future want to make MWI aggregate local/remote
+	 * message counts similar to how device state aggregates state.
+	 */
+	message = stasis_message_create_full(ast_mwi_state_type(), mwi_state, &ast_eid_default);
+	ao2_cleanup(mwi_state);
+	return message;
+}
+
+int ast_publish_mwi_state_full(
+	const char *mailbox,
+	const char *context,
+	int new_msgs,
+	int old_msgs,
+	const char *channel_id,
+	struct ast_eid *eid)
+{
+	struct ast_mwi_state *mwi_state;
+	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+	struct stasis_topic *mailbox_specific_topic;
+
+	message = mwi_state_create_message(mailbox, context, new_msgs, old_msgs, channel_id, eid);
+	if (!message) {
+		return -1;
+	}
+
+	mwi_state = stasis_message_data(message);
+	mailbox_specific_topic = ast_mwi_topic(mwi_state->uniqueid);
+	if (!mailbox_specific_topic) {
+		return -1;
+	}
+
+	stasis_publish(mailbox_specific_topic, message);
+
+	return 0;
+}
+
+int ast_delete_mwi_state_full(const char *mailbox, const char *context, struct ast_eid *eid)
+{
+	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+	struct stasis_message *cached_msg;
+	struct stasis_message *clear_msg;
+	struct ast_mwi_state *mwi_state;
+	struct stasis_topic *mailbox_specific_topic;
+
+	msg = mwi_state_create_message(mailbox, context, 0, 0, NULL, eid);
+	if (!msg) {
+		return -1;
+	}
+
+	mwi_state = stasis_message_data(msg);
+
+	/*
+	 * XXX As far as stasis is concerned, all MWI events are local.
+	 *
+	 * For now, it is assumed that there is only one entity
+	 * maintaining the state of a particular mailbox.
+	 *
+	 * If we ever have multiple MWI event entities maintaining
+	 * the same mailbox that wish to delete their cached entry
+	 * we will need to do something about the race condition
+	 * potential between checking the cache and removing the
+	 * cache entry.
+	 */
+	cached_msg = stasis_cache_get_by_eid(ast_mwi_state_cache(),
+		ast_mwi_state_type(), mwi_state->uniqueid, &ast_eid_default);
+	if (!cached_msg) {
+		/* Nothing to clear */
+		return -1;
+	}
+	ao2_cleanup(cached_msg);
+
+	mailbox_specific_topic = ast_mwi_topic(mwi_state->uniqueid);
+	if (!mailbox_specific_topic) {
+		return -1;
+	}
+
+	clear_msg = stasis_cache_clear_create(msg);
+	if (clear_msg) {
+		stasis_publish(mailbox_specific_topic, clear_msg);
+	}
+
+	ao2_cleanup(clear_msg);
+	return 0;
+}
+
+static const char *mwi_state_get_id(struct stasis_message *message)
+{
+	if (ast_mwi_state_type() == stasis_message_type(message)) {
+		struct ast_mwi_state *mwi_state = stasis_message_data(message);
+		return mwi_state->uniqueid;
+	} else if (stasis_subscription_change_type() == stasis_message_type(message)) {
+		struct stasis_subscription_change *change = stasis_message_data(message);
+		return change->uniqueid;
+	}
+
+	return NULL;
+}
+
+static void mwi_blob_dtor(void *obj)
+{
+	struct ast_mwi_blob *mwi_blob = obj;
+
+	ao2_cleanup(mwi_blob->mwi_state);
+	ast_json_unref(mwi_blob->blob);
+}
+
+struct stasis_message *ast_mwi_blob_create(struct ast_mwi_state *mwi_state,
+	struct stasis_message_type *message_type, struct ast_json *blob)
+{
+	struct ast_mwi_blob *obj;
+	struct stasis_message *msg;
+
+	ast_assert(blob != NULL);
+
+	if (!message_type) {
+		return NULL;
+	}
+
+	obj = ao2_alloc(sizeof(*obj), mwi_blob_dtor);
+	if (!obj) {
+		return NULL;
+	}
+
+	obj->mwi_state = mwi_state;
+	ao2_ref(obj->mwi_state, +1);
+	obj->blob = ast_json_ref(blob);
+
+	/* This is not a normal MWI event.  Only used by the MinivmNotify app. */
+	msg = stasis_message_create(message_type, obj);
+	ao2_ref(obj, -1);
+
+	return msg;
+}
+
+static void mwi_cleanup(void)
+{
+	ao2_cleanup(mwi_topic_pool);
+	mwi_topic_pool = NULL;
+	ao2_cleanup(mwi_topic_all);
+	mwi_topic_all = NULL;
+	ao2_cleanup(mwi_state_cache);
+	mwi_state_cache = NULL;
+	mwi_topic_cached = stasis_caching_unsubscribe_and_join(mwi_topic_cached);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_mwi_state_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_mwi_vm_app_type);
+}
+
+int mwi_init(void)
+{
+	ast_register_cleanup(mwi_cleanup);
+
+	if (STASIS_MESSAGE_TYPE_INIT(ast_mwi_state_type) != 0) {
+		return -1;
+	}
+
+	if (STASIS_MESSAGE_TYPE_INIT(ast_mwi_vm_app_type) != 0) {
+		return -1;
+	}
+
+	mwi_topic_all = stasis_topic_create("mwi:all");
+	if (!mwi_topic_all) {
+		return -1;
+	}
+
+	mwi_state_cache = stasis_cache_create(mwi_state_get_id);
+	if (!mwi_state_cache) {
+		return -1;
+	}
+
+	mwi_topic_cached = stasis_caching_topic_create(mwi_topic_all, mwi_state_cache);
+	if (!mwi_topic_cached) {
+		return -1;
+	}
+
+	mwi_topic_pool = stasis_topic_pool_create(mwi_topic_all);
+	if (!mwi_topic_pool) {
+		return -1;
+	}
+
+	return 0;
+}
diff --git a/res/res_mwi_devstate.c b/res/res_mwi_devstate.c
index ff23a8d..deef55d 100644
--- a/res/res_mwi_devstate.c
+++ b/res/res_mwi_devstate.c
@@ -22,7 +22,7 @@
 
 #include "asterisk.h"
 
-#include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/devicestate.h"
 #include "asterisk/module.h"
 #include "asterisk/stasis_message_router.h"
diff --git a/res/res_mwi_external.c b/res/res_mwi_external.c
index 9ded0d9..d01838e 100644
--- a/res/res_mwi_external.c
+++ b/res/res_mwi_external.c
@@ -56,7 +56,7 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
-#include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/module.h"
 #include "asterisk/res_mwi_external.h"
 #include "asterisk/sorcery.h"
diff --git a/res/res_pjsip_mwi.c b/res/res_pjsip_mwi.c
index 7f86d98..e157d72 100644
--- a/res/res_pjsip_mwi.c
+++ b/res/res_pjsip_mwi.c
@@ -38,7 +38,7 @@
 #include "asterisk/taskprocessor.h"
 #include "asterisk/sorcery.h"
 #include "asterisk/stasis.h"
-#include "asterisk/app.h"
+#include "asterisk/mwi.h"
 
 struct mwi_subscription;
 static struct ao2_container *unsolicited_mwi;
diff --git a/res/res_pjsip_publish_asterisk.c b/res/res_pjsip_publish_asterisk.c
index 2271d8b..292d68e 100644
--- a/res/res_pjsip_publish_asterisk.c
+++ b/res/res_pjsip_publish_asterisk.c
@@ -36,7 +36,7 @@
 #include "asterisk/res_pjsip_pubsub.h"
 #include "asterisk/module.h"
 #include "asterisk/logger.h"
-#include "asterisk/app.h"
+#include "asterisk/mwi.h"
 
 /*** DOCUMENTATION
 	<configInfo name="res_pjsip_publish_asterisk" language="en_US">
diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index ab3e4b2..16c9a73 100644
--- a/res/res_pjsip_pubsub.c
+++ b/res/res_pjsip_pubsub.c
@@ -31,7 +31,7 @@
 #include <pjsip_simple.h>
 #include <pjlib.h>
 
-#include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/res_pjsip_pubsub.h"
 #include "asterisk/module.h"
 #include "asterisk/linkedlists.h"
diff --git a/res/res_smdi.c b/res/res_smdi.c
index 1232839..2401807 100644
--- a/res/res_smdi.c
+++ b/res/res_smdi.c
@@ -63,6 +63,7 @@
 #include "asterisk/stringfields.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/pbx.h"
 #include "asterisk/channel.h"
 
diff --git a/res/res_xmpp.c b/res/res_xmpp.c
index 2c2a0a9..a5f2851 100644
--- a/res/res_xmpp.c
+++ b/res/res_xmpp.c
@@ -57,6 +57,7 @@
 #include "asterisk/module.h"
 #include "asterisk/manager.h"
 #include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/message.h"
 #include "asterisk/manager.h"
 #include "asterisk/cli.h"

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11250
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I9dde8bfae1e7ec254fa63166e090f77e4d3097e0
Gerrit-Change-Number: 11250
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190409/1dbb5eb7/attachment-0001.html>


More information about the asterisk-code-review mailing list