]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
mwi core: Move core MWI functionality into its own files
authorKevin Harwell <kharwell@digium.com>
Tue, 9 Apr 2019 19:09:44 +0000 (14:09 -0500)
committerKevin Harwell <kharwell@digium.com>
Tue, 23 Apr 2019 22:39:40 +0000 (17:39 -0500)
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

23 files changed:
apps/app_minivm.c
apps/app_voicemail.c
channels/chan_dahdi.c
channels/chan_iax2.c
channels/chan_mgcp.c
channels/chan_sip.c
channels/chan_skinny.c
channels/chan_unistim.c
include/asterisk/app.h
include/asterisk/mwi.h [new file with mode: 0644]
main/app.c
main/asterisk.c
main/manager.c
main/manager_mwi.c
main/mwi.c [new file with mode: 0644]
res/res_corosync.c
res/res_mwi_devstate.c
res/res_mwi_external.c
res/res_pjsip_mwi.c
res/res_pjsip_publish_asterisk.c
res/res_pjsip_pubsub.c
res/res_smdi.c
res/res_xmpp.c

index ef73cabb1777443c02625a35608fb256d46f1344..dae033f7c554edf4bc8f20eda2cb928255fae917 100644 (file)
@@ -166,6 +166,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #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"
index d442c68245ae243d89de88e47d681fc1cb2019e1..56ade7f8769cd2dc4d194c2da8715c610368a603 100644 (file)
@@ -122,6 +122,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #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"
index 1f769c9975c62ad3663afbcb228b71959ce84e45..d425b323a4e1f25d57554c417bad6a9eb35e1d19 100644 (file)
@@ -110,7 +110,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #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"
index b485fd17fbb108d78e54367cf4338e6395ebf026..83d9711273898b5087cf87ab1cfde6333ab86e0f 100644 (file)
@@ -95,6 +95,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #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"
index 5b3089b75fb994cff91c9d7636dab9a390185ecb..c0f522d572077765d5cd220ead53080abc97304c 100644 (file)
@@ -71,6 +71,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #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"
index 6836db36939ec029e038e1d0d06c97fbe2a2bab4..7c8928db250b5be2c19057b35f9fb564079481a0 100644 (file)
@@ -276,7 +276,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #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"
index 9c63da9027a27e564913875c6d36a5d523c9b4e7..c3044c2f1d8d2486f308b2813f12c5ef6838d2cc 100644 (file)
@@ -71,6 +71,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #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"
index 1809c8ab47ccc2a520f43988915e9431f9213a2d..b8465856e7a99faf33bfa1b713b3f52001643aa8 100644 (file)
@@ -69,6 +69,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #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"
index 0865121e2372a5ac60da0fb755e2c2e11bfd2a34..df3990f23d128b9fa28d4a7c10ac2a9a8b06e468 100644 (file)
@@ -1469,200 +1469,6 @@ void ast_safe_fork_cleanup(void);
  */
 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
@@ -1689,7 +1495,6 @@ struct stasis_topic *ast_queue_topic(const char *queuename);
  */
 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 (file)
index 0000000..1502224
--- /dev/null
@@ -0,0 +1,242 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2019, Sangoma Technologies Corporation
+ *
+ * Kevin Harwell <kharwell@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 */
index 623843a13cb6a9dba37333a0fba277353a68de62..5fb81ba60a2bcef6dfbb4b72bcbe08f0a926a32b 100644 (file)
@@ -72,8 +72,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #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 @@ static AST_LIST_HEAD_STATIC(zombies, zombie);
 /*
  * @{ \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 @@ int ast_app_parse_timelen(const char *timestr, int *result, enum ast_timelen uni
        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 @@ static void app_cleanup(void)
        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;
index ac5b1d66d57baeb5ac459f6baa3cf9379e56b646..30b84e6d9923d85620f2c5cb5be6d9a499d85e94 100644 (file)
@@ -217,6 +217,7 @@ int daemon(int, int);  /* defined in libresolv of all places */
 #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 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
        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");
index cb9a7138e181a2117d567a9ba66beccf6488caac..0cd9ed52cf406c723799ef6793ca405b8b52b10b 100644 (file)
@@ -73,6 +73,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #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"
index 8facc9093616447b910acc88cb5f19ca6a11f6da..b8bc5948250ae5aa71d6b3574caad272952a341f 100644 (file)
@@ -29,6 +29,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #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 (file)
index 0000000..e39af20
--- /dev/null
@@ -0,0 +1,369 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2019, Sangoma Technologies Corporation
+ *
+ * Kevin Harwell <kharwell@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;
+}
index 7a0eefe9cd3d366802f9d753b8181ee27bca2c61..4e96bff8dcbda6c51c10426d03b52389d83204f4 100644 (file)
@@ -44,7 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$");
 #include "asterisk/event.h"
 #include "asterisk/cli.h"
 #include "asterisk/devicestate.h"
-#include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/stasis.h"
 #include "asterisk/stasis_message_router.h"
 #include "asterisk/stasis_system.h"
index 209fc8b452856c295369b1491f0d9e2f3c184571..2c516fff8c91705d707e765531776bb585f10f37 100644 (file)
@@ -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"
index 9ded0d959571edee2d159d1165616f5fc4b7e672..4cd0ccaa3384980706dbaa0dba4ec2a41196bd35 100644 (file)
@@ -57,6 +57,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"
index 7f86d981b668acddd353989f5b2bf4c5957322fd..e157d727d191b3254872ed1114b2b59708bf2f77 100644 (file)
@@ -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;
index 2271d8bddc3ae666b436143469491b3c6b01789b..292d68e89a86d59a0fa122bea635d916e4e13c15 100644 (file)
@@ -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">
index ab3e4b20a3c8f09034c20958cdb73bd0c49dd056..16c9a73b2e0c7e3d4f7e3edfd57380fa5d20a782 100644 (file)
@@ -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"
index 123283920651d944fe49e63f181b4bbbe9b2e299..240180747788adeb2202eb9179c99ae25d1b1399 100644 (file)
@@ -63,6 +63,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/stringfields.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/app.h"
+#include "asterisk/mwi.h"
 #include "asterisk/pbx.h"
 #include "asterisk/channel.h"
 
index 2c2a0a965447fc325da670ae7596dd60ba13e01e..a5f285144826f2b46ad418d615a4d362ad716ea0 100644 (file)
@@ -57,6 +57,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #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"