summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2009-08-21 21:39:51 +0000
committerKevin P. Fleming <kpfleming@digium.com>2009-08-21 21:39:51 +0000
commit89e87e32d259c47077889b9ce12815e3a5105341 (patch)
tree1774600ceed4fe0dd116b63c8c1c16990d31ead6 /apps
parent1f81e544c0cbd8f3dada046e6b56d3f98f8dc199 (diff)
Ensure that realtime mailboxes properly report status on subscription.
This patch modifies app_voicemail's response to mailbox status subscriptions (via the internal event system) to ensure that a subscription triggers an explicit poll of the mailbox, so the subscriber can get an immediate cached event with that status. Previously, the cache was only populated with the status of non-realtime mailboxes. (closes issue #15717) Reported by: natmlt git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@213697 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r--apps/app_voicemail.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 0ca60e1fe..afcafbfd8 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -10113,24 +10113,28 @@ static struct ast_cli_entry cli_voicemail[] = {
AST_CLI_DEFINE(handle_voicemail_reload, "Reload voicemail configuration"),
};
+static void poll_subscribed_mailbox(struct mwi_sub *mwi_sub)
+{
+ int new = 0, old = 0, urgent = 0;
+
+ inboxcount2(mwi_sub->mailbox, &urgent, &new, &old);
+
+ if (urgent != mwi_sub->old_urgent || new != mwi_sub->old_new || old != mwi_sub->old_old) {
+ mwi_sub->old_urgent = urgent;
+ mwi_sub->old_new = new;
+ mwi_sub->old_old = old;
+ queue_mwi_event(mwi_sub->mailbox, urgent, new, old);
+ }
+}
+
static void poll_subscribed_mailboxes(void)
{
struct mwi_sub *mwi_sub;
AST_RWLIST_RDLOCK(&mwi_subs);
AST_RWLIST_TRAVERSE(&mwi_subs, mwi_sub, entry) {
- int new = 0, old = 0, urgent = 0;
-
- if (ast_strlen_zero(mwi_sub->mailbox))
- continue;
-
- inboxcount2(mwi_sub->mailbox, &urgent, &new, &old);
-
- if (urgent != mwi_sub->old_urgent || new != mwi_sub->old_new || old != mwi_sub->old_old) {
- mwi_sub->old_urgent = urgent;
- mwi_sub->old_new = new;
- mwi_sub->old_old = old;
- queue_mwi_event(mwi_sub->mailbox, urgent, new, old);
+ if (!ast_strlen_zero(mwi_sub->mailbox)) {
+ poll_subscribed_mailbox(mwi_sub);
}
}
AST_RWLIST_UNLOCK(&mwi_subs);
@@ -10216,7 +10220,8 @@ static int handle_subscribe(void *datap)
AST_RWLIST_UNLOCK(&mwi_subs);
ast_free((void *) p->mailbox);
ast_free((void *) p->context);
- ast_free(p);
+ ast_free(p);
+ poll_subscribed_mailbox(mwi_sub);
return 0;
}