MWI: Update modules that subscribe to MWI to use new API calls

The MWI core recently got some new API calls that make tracking MWI state
lifetime more reliable. This patch updates those modules that subscribe to
specific MWI topics to use the new API. Specifically, these modules now
subscribe to both MWI topics and MWI state.

ASTERISK-28442

Change-Id: I32bef880b647246823dbccdf44a98d384fcabfbd
This commit is contained in:
Kevin Harwell
2019-06-12 13:11:42 -05:00
parent b31ac83900
commit 9637e1dfdc
10 changed files with 52 additions and 96 deletions

View File

@@ -5251,7 +5251,7 @@ static void register_peer_exten(struct sip_peer *peer, int onoff)
static void destroy_mailbox(struct sip_mailbox *mailbox)
{
if (mailbox->event_sub) {
mailbox->event_sub = stasis_unsubscribe_and_join(mailbox->event_sub);
mailbox->event_sub = ast_mwi_unsubscribe_and_join(mailbox->event_sub);
}
ast_free(mailbox);
}
@@ -28384,18 +28384,14 @@ static void add_peer_mwi_subs(struct sip_peer *peer)
struct sip_mailbox *mailbox;
AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
struct stasis_topic *mailbox_specific_topic;
if (mailbox->status != SIP_MAILBOX_STATUS_NEW) {
continue;
}
mailbox_specific_topic = ast_mwi_topic(mailbox->id);
if (mailbox_specific_topic) {
mailbox->event_sub = stasis_subscribe_pool(mailbox_specific_topic, mwi_event_cb, peer);
stasis_subscription_accept_message_type(mailbox->event_sub, ast_mwi_state_type());
stasis_subscription_accept_message_type(mailbox->event_sub, stasis_subscription_change_type());
stasis_subscription_set_filter(mailbox->event_sub, STASIS_SUBSCRIPTION_FILTER_SELECTIVE);
mailbox->event_sub = ast_mwi_subscribe_pool(mailbox->id, mwi_event_cb, peer);
if (mailbox->event_sub) {
stasis_subscription_accept_message_type(
ast_mwi_subscriber_subscription(mailbox->event_sub),
stasis_subscription_change_type());
}
}
}