minor cleanup

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@23067 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Luigi Rizzo 19 years ago
parent c9816d135d
commit 899cdda8cb

@ -153,19 +153,22 @@ static char *convert(char *lastname)
* '1' for selected entry from directory * '1' for selected entry from directory
* '*' for skipped entry from directory * '*' for skipped entry from directory
*/ */
static int play_mailbox_owner(struct ast_channel *chan, char *context, char *dialcontext, char *ext, char *name, int readext) { static int play_mailbox_owner(struct ast_channel *chan, char *context,
char *dialcontext, char *ext, char *name, int readext)
{
int res = 0; int res = 0;
int loop = 3; int loop;
char fn[256]; char fn[256];
char fn2[256];
/* Check for the VoiceMail2 greeting first */ /* Check for the VoiceMail2 greeting first */
snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/greet", snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/greet",
(char *)ast_config_AST_SPOOL_DIR, context, ext); ast_config_AST_SPOOL_DIR, context, ext);
/* Otherwise, check for an old-style Voicemail greeting */ if (ast_fileexists(fn, NULL, chan->language) <= 0) {
snprintf(fn2, sizeof(fn2), "%s/vm/%s/greet", /* no file, check for an old-style Voicemail greeting */
(char *)ast_config_AST_SPOOL_DIR, ext); snprintf(fn, sizeof(fn), "%s/vm/%s/greet",
ast_config_AST_SPOOL_DIR, ext);
}
if (ast_fileexists(fn, NULL, chan->language) > 0) { if (ast_fileexists(fn, NULL, chan->language) > 0) {
res = ast_stream_and_wait(chan, fn, chan->language, AST_DIGIT_ANY); res = ast_stream_and_wait(chan, fn, chan->language, AST_DIGIT_ANY);
@ -175,14 +178,6 @@ static int play_mailbox_owner(struct ast_channel *chan, char *context, char *dia
ast_stream_and_wait(chan, "vm-extension", chan->language, AST_DIGIT_ANY); ast_stream_and_wait(chan, "vm-extension", chan->language, AST_DIGIT_ANY);
res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language); res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
} }
} else if (ast_fileexists(fn2, NULL, chan->language) > 0) {
res = ast_stream_and_wait(chan, fn2, chan->language, AST_DIGIT_ANY);
ast_stopstream(chan);
/* If Option 'e' was specified, also read the extension number with the name */
if (readext) {
ast_stream_and_wait(chan, "vm-extension", chan->language, AST_DIGIT_ANY);
res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
}
} else { } else {
res = ast_say_character_str(chan, S_OR(name, ext), AST_DIGIT_ANY, chan->language); res = ast_say_character_str(chan, S_OR(name, ext), AST_DIGIT_ANY, chan->language);
if (!ast_strlen_zero(name) && readext) { if (!ast_strlen_zero(name) && readext) {
@ -191,18 +186,16 @@ static int play_mailbox_owner(struct ast_channel *chan, char *context, char *dia
} }
} }
while (loop) { for (loop = 3 ; loop > 0; loop--) {
if (!res) if (!res)
res = ast_stream_and_wait(chan, "dir-instr", chan->language, AST_DIGIT_ANY); res = ast_stream_and_wait(chan, "dir-instr", chan->language, AST_DIGIT_ANY);
if (!res) if (!res)
res = ast_waitfordigit(chan, 3000); res = ast_waitfordigit(chan, 3000);
ast_stopstream(chan); ast_stopstream(chan);
if (res > -1) { if (res < 0) /* User hungup, so jump out now */
switch (res) { break;
case '1': if (res == '1') { /* Name selected */
/* Name selected */
loop = 0;
if (ast_goto_if_exists(chan, dialcontext, ext, 1)) { if (ast_goto_if_exists(chan, dialcontext, ext, 1)) {
ast_log(LOG_WARNING, ast_log(LOG_WARNING,
"Can't find extension '%s' in context '%s'. " "Can't find extension '%s' in context '%s'. "
@ -211,24 +204,13 @@ static int play_mailbox_owner(struct ast_channel *chan, char *context, char *dia
res = -1; res = -1;
} }
break; break;
}
case '*': if (res == '*') /* Skip to next match in list */
/* Skip to next match in list */
loop = 0;
break; break;
default:
/* Not '1', or '*', so decrement number of tries */ /* Not '1', or '*', so decrement number of tries */
res = 0; res = 0;
loop--;
break;
} /* end switch */
} /* end if */
else {
/* User hungup, so jump out now */
loop = 0;
} }
} /* end while */
return(res); return(res);
} }

Loading…
Cancel
Save