[Asterisk-cvs] asterisk app.c,1.32,1.33 manager.c,1.75,1.76

markster at lists.digium.com markster at lists.digium.com
Sun Oct 3 17:16:44 CDT 2004


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

Modified Files:
	app.c manager.c 
Log Message:
Add ability to check voicemail from multiple folders (bug #2561)


Index: app.c
===================================================================
RCS file: /usr/cvsroot/asterisk/app.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- app.c	3 Oct 2004 16:34:52 -0000	1.32
+++ app.c	3 Oct 2004 21:18:26 -0000	1.33
@@ -150,7 +150,7 @@
 	return 0;
 }
 
-int ast_app_has_voicemail(const char *mailbox)
+int ast_app_has_voicemail(const char *mailbox, const char *folder)
 {
 	DIR *dir;
 	struct dirent *de;
@@ -159,6 +159,8 @@
 	char *mb, *cur;
 	char *context;
 	int ret;
+	if (!folder)
+		folder = "INBOX";
 	/* If no mailbox, return immediately */
 	if (ast_strlen_zero(mailbox))
 		return 0;
@@ -168,7 +170,7 @@
 		ret = 0;
 		while((cur = strsep(&mb, ","))) {
 			if (!ast_strlen_zero(cur)) {
-				if (ast_app_has_voicemail(cur))
+				if (ast_app_has_voicemail(cur, folder))
 					return 1; 
 			}
 		}
@@ -181,7 +183,7 @@
 		context++;
 	} else
 		context = "default";
-	snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/INBOX", (char *)ast_config_AST_SPOOL_DIR, context, tmp);
+	snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/%s", (char *)ast_config_AST_SPOOL_DIR, context, tmp, folder);
 	dir = opendir(fn);
 	if (!dir)
 		return 0;

Index: manager.c
===================================================================
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- manager.c	2 Oct 2004 00:58:31 -0000	1.75
+++ manager.c	3 Oct 2004 21:18:26 -0000	1.76
@@ -981,7 +981,7 @@
 	}
         if (id && !ast_strlen_zero(id))
                 snprintf(idText,256,"ActionID: %s\r\n",id);
-	ret = ast_app_has_voicemail(mailbox);
+	ret = ast_app_has_voicemail(mailbox, NULL);
 	ast_mutex_lock(&s->lock);
 	ast_cli(s->fd, "Response: Success\r\n"
 				   "%s"




More information about the svn-commits mailing list