Modify VoiceMailMain()'s a() argument to allow mailboxes to be specified by name.
(closes issue #14740) Reported by: pj Patches: issue14740_09022009.diff uploaded by seanbright (license 71) Tested by: seanbright, lmadsen git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@221090 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
3ac28f1e0f
commit
0e805a51ec
1 changed files with 47 additions and 26 deletions
|
@ -222,7 +222,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
<option name="a">
|
<option name="a">
|
||||||
<argument name="folder" required="true" />
|
<argument name="folder" required="true" />
|
||||||
<para>Skip folder prompt and go directly to <replaceable>folder</replaceable> specified.
|
<para>Skip folder prompt and go directly to <replaceable>folder</replaceable> specified.
|
||||||
Defaults to <literal>0</literal> (INBOX).</para>
|
Defaults to <literal>INBOX</literal> (or <literal>0</literal>).</para>
|
||||||
<enumlist>
|
<enumlist>
|
||||||
<enum name="0"><para>INBOX</para></enum>
|
<enum name="0"><para>INBOX</para></enum>
|
||||||
<enum name="1"><para>Old</para></enum>
|
<enum name="1"><para>Old</para></enum>
|
||||||
|
@ -1456,9 +1456,7 @@ static int create_dirpath(char *dest, int len, const char *context, const char *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *mbox(int id)
|
static const char * const mailbox_folders[] = {
|
||||||
{
|
|
||||||
static const char * const msgs[] = {
|
|
||||||
#ifdef IMAP_STORAGE
|
#ifdef IMAP_STORAGE
|
||||||
imapfolder,
|
imapfolder,
|
||||||
#else
|
#else
|
||||||
|
@ -1474,9 +1472,25 @@ static const char *mbox(int id)
|
||||||
"Cust4",
|
"Cust4",
|
||||||
"Cust5",
|
"Cust5",
|
||||||
"Deleted",
|
"Deleted",
|
||||||
"Urgent"
|
"Urgent",
|
||||||
};
|
};
|
||||||
return (id >= 0 && id < ARRAY_LEN(msgs)) ? msgs[id] : "Unknown";
|
|
||||||
|
static const char *mbox(int id)
|
||||||
|
{
|
||||||
|
return (id >= 0 && id < ARRAY_LEN(mailbox_folders)) ? mailbox_folders[id] : "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_folder_by_name(const char *name)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_LEN(mailbox_folders); i++) {
|
||||||
|
if (strcasecmp(name, mailbox_folders[i]) == 0) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_user(struct ast_vm_user *vmu)
|
static void free_user(struct ast_vm_user *vmu)
|
||||||
|
@ -9090,15 +9104,22 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
||||||
}
|
}
|
||||||
if (ast_test_flag(&flags, OPT_AUTOPLAY) ) {
|
if (ast_test_flag(&flags, OPT_AUTOPLAY) ) {
|
||||||
play_auto = 1;
|
play_auto = 1;
|
||||||
if (opts[OPT_ARG_PLAYFOLDER]) {
|
if (!ast_strlen_zero(opts[OPT_ARG_PLAYFOLDER])) {
|
||||||
|
/* See if it is a folder name first */
|
||||||
|
if (isdigit(opts[OPT_ARG_PLAYFOLDER][0])) {
|
||||||
if (sscanf(opts[OPT_ARG_PLAYFOLDER], "%30d", &play_folder) != 1) {
|
if (sscanf(opts[OPT_ARG_PLAYFOLDER], "%30d", &play_folder) != 1) {
|
||||||
ast_log(AST_LOG_WARNING, "Invalid value '%s' provided for folder autoplay option\n", opts[OPT_ARG_PLAYFOLDER]);
|
play_folder = -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
play_folder = get_folder_by_name(opts[OPT_ARG_PLAYFOLDER]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ast_log(AST_LOG_WARNING, "Invalid folder set with option a\n");
|
ast_log(AST_LOG_WARNING, "Invalid folder set with option a\n");
|
||||||
}
|
}
|
||||||
if ( play_folder > 9 || play_folder < 0) {
|
if (play_folder > 9 || play_folder < 0) {
|
||||||
ast_log(AST_LOG_WARNING, "Invalid value '%d' provided for folder autoplay option\n", play_folder);
|
ast_log(AST_LOG_WARNING,
|
||||||
|
"Invalid value '%s' provided for folder autoplay option. Defaulting to 'INBOX'\n",
|
||||||
|
opts[OPT_ARG_PLAYFOLDER]);
|
||||||
play_folder = 0;
|
play_folder = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue