[asterisk-commits] kpfleming: branch 1.6.1 r213699 - in /branches/1.6.1: ./ apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 21 16:52:36 CDT 2009


Author: kpfleming
Date: Fri Aug 21 16:52:33 2009
New Revision: 213699

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=213699
Log:
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
........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/apps/app_voicemail.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.1/apps/app_voicemail.c?view=diff&rev=213699&r1=213698&r2=213699
==============================================================================
--- branches/1.6.1/apps/app_voicemail.c (original)
+++ branches/1.6.1/apps/app_voicemail.c Fri Aug 21 16:52:33 2009
@@ -9937,24 +9937,28 @@
 	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);
@@ -10040,7 +10044,8 @@
 	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;
 }
 




More information about the asterisk-commits mailing list