summaryrefslogtreecommitdiff
path: root/channels/chan_mgcp.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2015-05-22 22:50:43 -0400
committerCorey Farrell <git@cfware.com>2015-05-22 22:30:22 -0500
commit50044fdc15197b3a4a742827c97fc25daddc98aa (patch)
tree562e2b031fecf6cd7c5830410fd0eee0fed9a322 /channels/chan_mgcp.c
parentf66c41e668429b9a07dfdf30832c02ddc223f4a4 (diff)
Stasis: Fix unsafe use of stasis_unsubscribe in modules.
Many uses of stasis_unsubscribe in modules can be reached through unload. These have been switched to stasis_unsubscribe_and_join. Some subscription callbacks do nothing, for these I've created a noop callback function in stasis.c. This is used by some modules that monitor MWI topics in order to enable cache, since the callback does not become invalid after dlclose it is safe to use stasis_unsubscribe on these, even during module unload. ASTERISK-25121 #close Change-Id: Ifc2549fbd8eef7d703c222978e8f452e2972189c
Diffstat (limited to 'channels/chan_mgcp.c')
-rw-r--r--channels/chan_mgcp.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 98c6c307b..16d3c6550 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -489,14 +489,6 @@ static struct ast_channel_tech mgcp_tech = {
.func_channel_read = acf_channel_read,
};
-static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
-{
- /* This module does not handle MWI in an event-based manner. However, it
- * subscribes to MWI for each mailbox that is configured so that the core
- * knows that we care about it. Then, chan_mgcp will get the MWI from the
- * event cache instead of checking the mailbox directly. */
-}
-
static int has_voicemail(struct mgcp_endpoint *p)
{
int new_msgs;
@@ -4249,7 +4241,11 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v)
mailbox_specific_topic = ast_mwi_topic(e->mailbox);
if (mailbox_specific_topic) {
- e->mwi_event_sub = stasis_subscribe_pool(mailbox_specific_topic, mwi_event_cb, NULL);
+ /* This module does not handle MWI in an event-based manner. However, it
+ * subscribes to MWI for each mailbox that is configured so that the core
+ * knows that we care about it. Then, chan_mgcp will get the MWI from the
+ * event cache instead of checking the mailbox directly. */
+ e->mwi_event_sub = stasis_subscribe_pool(mailbox_specific_topic, stasis_subscription_cb_noop, NULL);
}
}
snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08lx", (unsigned long)ast_random());