[asterisk-commits] russell: branch russell/fxo_mwi r90932 - /team/russell/fxo_mwi/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 4 12:48:17 CST 2007


Author: russell
Date: Tue Dec  4 12:48:16 2007
New Revision: 90932

URL: http://svn.digium.com/view/asterisk?view=rev&rev=90932
Log:
Generate internal events when the MWI state on an FXO changes.  This allows
all of the normal MWI support to work just as if the information came from
app_voicemail.  :)

Modified:
    team/russell/fxo_mwi/channels/chan_zap.c

Modified: team/russell/fxo_mwi/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/channels/chan_zap.c?view=diff&rev=90932&r1=90931&r2=90932
==============================================================================
--- team/russell/fxo_mwi/channels/chan_zap.c (original)
+++ team/russell/fxo_mwi/channels/chan_zap.c Tue Dec  4 12:48:16 2007
@@ -1848,9 +1848,31 @@
 	return 0;
 }
 
-static void notify_message(char *mailbox, int thereornot)
+static void notify_message(char *mailbox_full, int thereornot)
 {
 	char s[sizeof(mwimonitornotify) + 80];
+	struct ast_event *event;
+	char *mailbox, *context;
+
+	/* Strip off @default */
+	context = mailbox = ast_strdupa(mailbox_full);
+	strsep(&context, "@");
+	if (ast_strlen_zero(context))
+		context = "default";
+
+	if (!(event = ast_event_new(AST_EVENT_MWI,
+			AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
+			AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
+			AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_UINT, thereornot,
+			AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_UINT, thereornot,
+			AST_EVENT_IE_END))) {
+		return;
+	}
+
+	ast_event_queue_and_cache(event,
+		AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR,
+		AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR,
+		AST_EVENT_IE_END);
 
 	if (!ast_strlen_zero(mailbox) && !ast_strlen_zero(mwimonitornotify)) {
 		snprintf(s, sizeof(s), "%s %s %d", mwimonitornotify, mailbox, thereornot);




More information about the asterisk-commits mailing list