[Asterisk-cvs] asterisk/apps app_voicemail.c,1.97,1.98

markster at lists.digium.com markster at lists.digium.com
Mon May 24 15:10:26 CDT 2004


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

Modified Files:
	app_voicemail.c 
Log Message:
Handle different contexts (bug #1702)


Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- app_voicemail.c	24 May 2004 00:44:40 -0000	1.97
+++ app_voicemail.c	24 May 2004 19:24:20 -0000	1.98
@@ -3423,31 +3423,33 @@
 
 static int vm_box_exists(struct ast_channel *chan, void *data) {
 	struct localuser *u;
-	struct ast_vm_user *vmu;
 	struct ast_vm_user svm;
 	char *context, *box;
+	char tmp[256];
 
 	if (!data || !strlen(data)) {
 		ast_log(LOG_ERROR, "MailboxExists requires an argument: (vmbox[@context])\n");
 		return -1;
+	} else {
+		strncpy(tmp, data, sizeof(tmp) - 1);
 	}
 
 	LOCAL_USER_ADD(u);
-	context = ast_strdupa(data);
-	if (index(context, '@')) {
-		box = strsep(&context, "@");
-	} else {
-		box = context;
-		context = "default";
-	}
+	box = tmp;
 	while(*box) {
-		if ((*box != 'u') && (*box != 's') && (*box != 'b'))
+		if ((*box == 's') || (*box == 'b') || (*box == 'u')) {
+			box++;
+		} else
 			break;
-		box++;
 	}
-	vmu = find_user(&svm, context, box);
 
-	if (vmu) {
+	context = strchr(tmp, '@');
+	if (context) {
+		*context = '\0';
+		context++;
+	}
+
+	if ((!find_user(&svm, context, box))) {
 		if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid)) {
 			chan->priority += 100;
 		} else
@@ -3457,7 +3459,6 @@
 	return 0;
 }
 
-
 #ifndef USEMYSQLVM
 /* XXX TL Bug 690 */
 static char show_voicemail_users_help[] =




More information about the svn-commits mailing list