some error checking added into g and a option
if there is no parens. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
b86c380a58
commit
791370e026
1 changed files with 19 additions and 16 deletions
|
@ -340,8 +340,7 @@ static char *descrip_vmain =
|
||||||
" g(#) - Use the specified amount of gain when recording a voicemail\n"
|
" g(#) - Use the specified amount of gain when recording a voicemail\n"
|
||||||
" message. The units are whole-number decibels (dB).\n"
|
" message. The units are whole-number decibels (dB).\n"
|
||||||
" s - Skip checking the passcode for the mailbox.\n"
|
" s - Skip checking the passcode for the mailbox.\n"
|
||||||
" a(#) - Automatically play messages in the specified folder.\n"
|
" a(#) - Skip folder prompt and go directly to folder specified, defaults to 1\n";
|
||||||
" Defaults to INBOX";
|
|
||||||
|
|
||||||
static char *synopsis_vm_box_exists =
|
static char *synopsis_vm_box_exists =
|
||||||
"Check to see if Voicemail mailbox exists";
|
"Check to see if Voicemail mailbox exists";
|
||||||
|
@ -5065,26 +5064,30 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||||
}
|
}
|
||||||
if (ast_test_flag(&flags, OPT_RECORDGAIN)) {
|
if (ast_test_flag(&flags, OPT_RECORDGAIN)) {
|
||||||
int gain;
|
int gain;
|
||||||
|
if(opts[OPT_ARG_PLAYFOLDER]) {
|
||||||
if (sscanf(opts[OPT_ARG_RECORDGAIN], "%d", &gain) != 1) {
|
if (sscanf(opts[OPT_ARG_RECORDGAIN], "%d", &gain) != 1) {
|
||||||
ast_log(LOG_WARNING, "Invalid value '%s' provided for record gain option\n", opts[OPT_ARG_RECORDGAIN]);
|
ast_log(LOG_WARNING, "Invalid value '%s' provided for record gain option\n", opts[OPT_ARG_RECORDGAIN]);
|
||||||
LOCAL_USER_REMOVE(u);
|
LOCAL_USER_REMOVE(u);
|
||||||
return -1;
|
return -1;
|
||||||
|
} else {
|
||||||
|
record_gain = (signed char) gain;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
record_gain = (signed char) gain;
|
ast_log(LOG_WARNING, "Invalid Gain level set with option g\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ast_test_flag(&flags, OPT_AUTOPLAY) ) {
|
if (ast_test_flag(&flags, OPT_AUTOPLAY) ) {
|
||||||
play_auto = 1;
|
play_auto = 1;
|
||||||
if (sscanf(opts[OPT_ARG_PLAYFOLDER], "%d", &play_folder) != 1) {
|
if(opts[OPT_ARG_PLAYFOLDER]) {
|
||||||
ast_log(LOG_WARNING, "Invalid value '%s' provided for folder autoplay option\n", opts[OPT_ARG_PLAYFOLDER]);
|
if (sscanf(opts[OPT_ARG_PLAYFOLDER], "%d", &play_folder) != 1) {
|
||||||
LOCAL_USER_REMOVE(u);
|
ast_log(LOG_WARNING, "Invalid value '%s' provided for folder autoplay option\n", opts[OPT_ARG_PLAYFOLDER]);
|
||||||
return -1;
|
}
|
||||||
|
} else {
|
||||||
|
ast_log(LOG_WARNING, "Invalid folder set with option a\n");
|
||||||
}
|
}
|
||||||
else if ( play_folder > 9 || play_folder < 0) {
|
if ( play_folder > 9 || play_folder < 0) {
|
||||||
ast_log(LOG_WARNING, "Invalid value '%d' provided for folder autoplay option\n", play_folder);
|
ast_log(LOG_WARNING, "Invalid value '%d' provided for folder autoplay option\n", play_folder);
|
||||||
LOCAL_USER_REMOVE(u);
|
play_folder = 0;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue