res_mwi_external: Clear the stasis cache entry when the external MWI is deleted.

One of the things missing when external MWI support was added was the
ability to clear the stasis cache entry of deleted external MWI mailboxes.

Review: https://reviewboard.asterisk.org/r/3325/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@410555 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2014-03-14 15:55:51 +00:00
parent b12e561e42
commit 92252df9ac
3 changed files with 149 additions and 35 deletions

View File

@@ -123,13 +123,13 @@ static void mwi_observe_delete(const void *obj)
{
const struct ast_mwi_mailbox_object *mailbox = obj;
if (!mailbox->msgs_new && !mailbox->msgs_old) {
/* No need to post a count clearing event. */
return;
if (mailbox->msgs_new || mailbox->msgs_old) {
/* Post a count clearing event. */
ast_publish_mwi_state(ast_sorcery_object_get_id(mailbox), NULL, 0, 0);
}
/* Post a count clearing event. */
ast_publish_mwi_state(ast_sorcery_object_get_id(mailbox), NULL, 0, 0);
/* Post a cache remove event. */
ast_delete_mwi_state(ast_sorcery_object_get_id(mailbox), NULL);
}
static const struct ast_sorcery_observer mwi_observers = {