[Asterisk-cvs] asterisk/apps app_voicemail.c,1.90,1.91

markster at lists.digium.com markster at lists.digium.com
Tue May 11 20:07:12 CDT 2004


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

Modified Files:
	app_voicemail.c 
Log Message:
Put sip history stuff in (for real) and provide voicemail context (when not default) in some critical places (bug #1609)


Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- app_voicemail.c	11 May 2004 15:20:55 -0000	1.90
+++ app_voicemail.c	12 May 2004 00:17:31 -0000	1.91
@@ -1498,6 +1498,7 @@
 	char dir[256];
 	char fn[256];
 	char prefile[256]="";
+	char ext_context[256] = "";
 	char fmt[80];
 	char *context;
 	char *ecodes = "#";
@@ -1517,6 +1518,10 @@
 
 	if ((vmu = find_user(&svm, context, ext))) {
 		/* Setup pre-file if appropriate */
+		if (strcmp(vmu->context, "default"))
+			snprintf(ext_context, sizeof(ext_context), "%s@%s", ext, vmu->context);
+		else
+			strncpy(ext_context, vmu->context, sizeof(ext_context) - 1);
 		if (busy)
 			snprintf(prefile, sizeof(prefile), "voicemail/%s/%s/busy", vmu->context, ext);
 		else if (unavail)
@@ -1690,10 +1695,10 @@
 				chan->priority+=100;
 	}
 	/* Leave voicemail for someone */
-	manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext, ast_app_has_voicemail(ext));
+	manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, ast_app_has_voicemail(ext_context));
 
 	/* If an external program is specified to be run after leaving a voicemail */
-	run_externnotify(chan->context, ext, ast_app_has_voicemail(ext));
+	run_externnotify(chan->context, ext_context, ast_app_has_voicemail(ext_context));
 
 	return res;
 }
@@ -2391,6 +2396,7 @@
 	char miffile[256];
 	char fn[256];
 	char callerid[512];
+	char ext_context[256]="";
 	int res = 0, cmd = 0;
 	struct ast_vm_user *receiver, *extensions = NULL, *vmtmp = NULL, *vmfree;
 	char tmp[256];
@@ -2444,6 +2450,7 @@
 			*/
 			snprintf(todir, sizeof(todir), "%s/voicemail/%s/%s/INBOX",  (char *)ast_config_AST_SPOOL_DIR, vmtmp->context, vmtmp->mailbox);
 			snprintf(sys, sizeof(sys), "mkdir -p %s\n", todir);
+			snprintf(ext_context, sizeof(ext_context), "%s@%s", vmtmp->mailbox, vmtmp->context);
 			ast_log(LOG_DEBUG, sys);
 			ast_safe_system(sys);
 	
@@ -2494,8 +2501,8 @@
 				ast_destroy(mif); /* or here */
 			}
 			/* Leave voicemail for someone */
-			manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", vmtmp->mailbox, ast_app_has_voicemail(vmtmp->mailbox));
-			run_externnotify(chan->context, vmtmp->mailbox, ast_app_has_voicemail(vmtmp->mailbox));
+			manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, ast_app_has_voicemail(ext_context));
+			run_externnotify(chan->context, ext_context, ast_app_has_voicemail(ext_context));
 	
 			saved_messages++;
 			vmfree = vmtmp;
@@ -2943,6 +2950,7 @@
 	struct localuser *u;
 	char prefixstr[80] ="";
 	char empty[80] = "";
+	char ext_context[256]="";
 	int box;
 	int useadsi = 0;
 	int skipuser = 0;
@@ -3319,8 +3327,9 @@
 	if (vmu)
 		free_user(vmu);
 	if (valid) {
-		manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", vms.username, ast_app_has_voicemail(vms.username));
-		run_externnotify(chan->context, vms.username, ast_app_has_voicemail(vms.username));
+		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, ast_app_has_voicemail(ext_context));
+		run_externnotify(chan->context, ext_context, ast_app_has_voicemail(ext_context));
 
 	}
 	LOCAL_USER_REMOVE(u);




More information about the svn-commits mailing list