Add ability to check voicemail from multiple folders (bug #2561)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3905 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-10-03 21:18:27 +00:00
parent c52e38d3be
commit 0ddbbd1785
8 changed files with 15 additions and 13 deletions

8
app.c
View File

@@ -150,7 +150,7 @@ int ast_app_getvoice(struct ast_channel *c, char *dest, char *dstfmt, char *prom
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 @@ int ast_app_has_voicemail(const char *mailbox)
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 @@ int ast_app_has_voicemail(const char *mailbox)
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 @@ int ast_app_has_voicemail(const char *mailbox)
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;