mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-22 04:43:50 +00:00
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:
8
app.c
8
app.c
@@ -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;
|
||||
|
Reference in New Issue
Block a user