Skip to content
Snippets Groups Projects
Commit 1688ea35 authored by Mark Spencer's avatar Mark Spencer
Browse files

Add app_hasnewvoicemail

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3906 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 0ddbbd17
No related branches found
No related tags found
No related merge requests found
......@@ -59,9 +59,10 @@ static char *hasvoicemail_descrip =
static char *app_hasnewvoicemail = "HasNewVoicemail";
static char *hasnewvoicemail_synopsis = "Conditionally branches to priority + 101";
static char *hasnewvoicemail_descrip =
"HasNewVoicemail(vmbox[@context][|varname])\n"
" Branches to priority + 101, if there is voicemail in folder INBOX."
" Optionally sets <varname> to the number of messages in that folder.\n";
"HasNewVoicemail(vmbox[/folder][@context][|varname])\n"
" Branches to priority + 101, if there is voicemail in folder 'folder' or INBOX.\n"
"if folder is not specified. Optionally sets <varname> to the number of messages\n"
"in that folder.\n";
STANDARD_LOCAL_USER;
......@@ -71,7 +72,8 @@ static int hasvoicemail_exec(struct ast_channel *chan, void *data)
{
int res=0;
struct localuser *u;
char vmpath[256], *temps, *input, *varname = NULL, *vmbox, *vmfolder = "INBOX", *context = "default";
char vmpath[256], *temps, *input, *varname = NULL, *vmbox, *context = "default";
char *vmfolder;
DIR *vmdir;
struct dirent *vment;
int vmcount = 0;
......@@ -100,7 +102,12 @@ static int hasvoicemail_exec(struct ast_channel *chan, void *data)
context = input;
if (!vmbox)
vmbox = input;
vmfolder = strchr(vmbox, '/');
if (vmfolder) {
*vmfolder = '\0';
vmfolder++;
} else
vmfolder = "INBOX";
snprintf(vmpath,sizeof(vmpath), "%s/voicemail/%s/%s/%s", (char *)ast_config_AST_SPOOL_DIR, context, vmbox, vmfolder);
if (!(vmdir = opendir(vmpath))) {
ast_log(LOG_NOTICE, "Voice mailbox %s at %s does not exist\n", vmbox, vmpath);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment