[Asterisk-cvs] asterisk/apps app_voicemail.c,1.225,1.226

kpfleming at lists.digium.com kpfleming at lists.digium.com
Mon Jul 11 22:49:37 CDT 2005


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv13238/apps

Modified Files:
	app_voicemail.c 
Log Message:
correct arguments being passed to external notify function (bug #4595)


Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.225
retrieving revision 1.226
diff -u -d -r1.225 -r1.226
--- app_voicemail.c	12 Jul 2005 02:53:55 -0000	1.225
+++ app_voicemail.c	12 Jul 2005 02:57:50 -0000	1.226
@@ -2022,10 +2022,16 @@
 static void run_externnotify(char *context, char *extension)
 {
 	char arguments[255];
+	char ext_context[256] = "";
 	int newvoicemails = 0, oldvoicemails = 0;
 
+	if (!ast_strlen_zero(context))
+		snprintf(ext_context, sizeof(ext_context), "%s@%s", extension, context);
+	else
+		ast_copy_string(ext_context, extension, sizeof(ext_context));
+
 	if (!ast_strlen_zero(externnotify)) {
-		if (messagecount(extension, &newvoicemails, &oldvoicemails)) {
+		if (messagecount(ext_context, &newvoicemails, &oldvoicemails)) {
 			ast_log(LOG_ERROR, "Problem in calculating number of voicemail messages available for extension %s\n", extension);
 		} else {
 			snprintf(arguments, sizeof(arguments), "%s %s %s %d&", externnotify, context, extension, newvoicemails);
@@ -3001,7 +3007,7 @@
 		ast_app_messagecount(ext_context, &newmsgs, &oldmsgs);
 	}
 	manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s@%s\r\nWaiting: %d\r\nNew: %d\r\nOld: %d\r\n", vmu->mailbox, vmu->context, ast_app_has_voicemail(ext_context, NULL), newmsgs, oldmsgs);
-	run_externnotify(chan->context, ext_context);
+	run_externnotify(vmu->context, vmu->mailbox);
 	return 0;
 }
 
@@ -3205,7 +3211,7 @@
 				}
 				/* Leave voicemail for someone */
 				manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, has_voicemail(ext_context, NULL));
-				run_externnotify(chan->context, ext_context);
+				run_externnotify(vmtmp->context, vmtmp->mailbox);
 	
 				saved_messages++;
 				vmfree = vmtmp;
@@ -5116,7 +5122,7 @@
 	if (valid) {
 		snprintf(ext_context, sizeof(ext_context), "%s@%s", vms.username, vmu->context);
 		manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, has_voicemail(ext_context, NULL));
-		run_externnotify(chan->context, ext_context);
+		run_externnotify(vmu->context, vmu->mailbox);
 	}
 	if (vmu)
 		free_user(vmu);




More information about the svn-commits mailing list