Merged revisions 213697 via svnmerge from

https://origsvn.digium.com/svn/asterisk/trunk

........
  r213697 | kpfleming | 2009-08-21 16:39:51 -0500 (Fri, 21 Aug 2009) | 12 lines
  
  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/branches/1.6.1@213699 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.1
Kevin P. Fleming 16 years ago
parent ae45fbe3ca
commit bedb59c696

@ -9937,17 +9937,10 @@ static struct ast_cli_entry cli_voicemail[] = {
AST_CLI_DEFINE(handle_voicemail_reload, "Reload voicemail configuration"), AST_CLI_DEFINE(handle_voicemail_reload, "Reload voicemail configuration"),
}; };
static void poll_subscribed_mailboxes(void) static void poll_subscribed_mailbox(struct mwi_sub *mwi_sub)
{ {
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; int new = 0, old = 0, urgent = 0;
if (ast_strlen_zero(mwi_sub->mailbox))
continue;
inboxcount2(mwi_sub->mailbox, &urgent, &new, &old); inboxcount2(mwi_sub->mailbox, &urgent, &new, &old);
if (urgent != mwi_sub->old_urgent || new != mwi_sub->old_new || old != mwi_sub->old_old) { if (urgent != mwi_sub->old_urgent || new != mwi_sub->old_new || old != mwi_sub->old_old) {
@ -9956,6 +9949,17 @@ static void poll_subscribed_mailboxes(void)
mwi_sub->old_old = old; mwi_sub->old_old = old;
queue_mwi_event(mwi_sub->mailbox, urgent, new, 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) {
if (!ast_strlen_zero(mwi_sub->mailbox)) {
poll_subscribed_mailbox(mwi_sub);
}
} }
AST_RWLIST_UNLOCK(&mwi_subs); AST_RWLIST_UNLOCK(&mwi_subs);
} }
@ -10041,6 +10045,7 @@ static int handle_subscribe(void *datap)
ast_free((void *) p->mailbox); ast_free((void *) p->mailbox);
ast_free((void *) p->context); ast_free((void *) p->context);
ast_free(p); ast_free(p);
poll_subscribed_mailbox(mwi_sub);
return 0; return 0;
} }

Loading…
Cancel
Save