diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-10-03 21:23:54 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-10-03 21:23:54 +0000 |
commit | 6f30a687baf5a55c919a668d1f691bf7ce118c69 (patch) | |
tree | 1c15478972f0a7de37c823e5c0d2ce048c20592b /apps | |
parent | f0aa373808ed959a85ef4a4ec62e92e45c578675 (diff) |
Add app_hasnewvoicemail
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3906 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/app_hasnewvoicemail.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/apps/app_hasnewvoicemail.c b/apps/app_hasnewvoicemail.c index 5891e6764..9e2192b83 100755 --- a/apps/app_hasnewvoicemail.c +++ b/apps/app_hasnewvoicemail.c @@ -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); |