[asterisk-commits] russell: branch russell/events r59232 - in /team/russell/events: apps/ main/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 26 14:47:17 MST 2007


Author: russell
Date: Mon Mar 26 16:47:17 2007
New Revision: 59232

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59232
Log:
If realtime is being used for voicemail accounts, make app_voicemail register
itself a publisher of MWI events for all mailboxes, since that is the best it
can do.

Modified:
    team/russell/events/apps/app_voicemail.c
    team/russell/events/main/event.c

Modified: team/russell/events/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/apps/app_voicemail.c?view=diff&rev=59232&r1=59231&r2=59232
==============================================================================
--- team/russell/events/apps/app_voicemail.c (original)
+++ team/russell/events/apps/app_voicemail.c Mon Mar 26 16:47:17 2007
@@ -562,6 +562,8 @@
 static unsigned char adsisec[4] = "\x9B\xDB\xF7\xAC";
 static int adsiver = 1;
 static char emaildateformat[32] = "%A, %B %d, %Y at %r";
+
+static struct ast_event_pub *global_mwi_pub;
 
 /* Forward declarations - generic */
 static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box);
@@ -7242,6 +7244,20 @@
 	int x;
 	int tmpadsi[4];
 
+	/* For realtime, claim we can provide MWI for any mailbox, because we
+	 * don't know any better. */
+	if (global_mwi_pub) {
+		ast_event_unreg_publisher(global_mwi_pub);
+		global_mwi_pub = NULL;
+	}
+	if (ast_check_realtime("voicemail")) {
+		global_mwi_pub = ast_event_reg_publisher(AST_EVENT_MWI,
+			AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_EXISTS,
+			AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
+			AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
+			AST_EVENT_IE_END);
+	}
+
 	cfg = ast_config_load(VOICEMAIL_CONFIG);
 
 	AST_LIST_LOCK(&users);
@@ -7788,7 +7804,12 @@
 static int unload_module(void)
 {
 	int res;
-	
+
+	if (global_mwi_pub) {
+		ast_event_unreg_publisher(global_mwi_pub);
+		global_mwi_pub = NULL;
+	}
+
 	res = ast_unregister_application(app);
 	res |= ast_unregister_application(app2);
 	res |= ast_unregister_application(app3);

Modified: team/russell/events/main/event.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/event.c?view=diff&rev=59232&r1=59231&r2=59232
==============================================================================
--- team/russell/events/main/event.c (original)
+++ team/russell/events/main/event.c Mon Mar 26 16:47:17 2007
@@ -149,6 +149,9 @@
 					break;
 				continue;
 			}
+			/* Publisher registered a wildcard field */
+			if (pub_ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_EXISTS)
+				continue;
 			if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_UINT &&
 				ie_val->payload.uint != pub_ie_val->payload.uint) {
 				break;
@@ -289,6 +292,9 @@
 					break;
 				continue;
 			}
+			/* The subscriber doesn't actually care what the value is */
+			if (sub_ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_EXISTS)
+				continue;
 			if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_UINT &&
 				ie_val->payload.uint != sub_ie_val->payload.uint)
 				break;



More information about the asterisk-commits mailing list