Skip to content

Commit b654eb8

Browse files
committed
app_dialtone: Abort if provided digit map context does not exist.
DialTone() doesn't work properly if a digit map context is provided but it doesn't exist. We should check before starting if it exists, and abort if it doesn't.
1 parent d27f16f commit b654eb8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

apps/app_dialtone.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static int dialtone_exec(struct ast_channel *chan, const char *data)
218218

219219
if (ast_strlen_zero(data)) {
220220
ast_log(LOG_WARNING, "DialTone requires an argument (variable)\n");
221-
return 0;
221+
return -1;
222222
}
223223

224224
argcopy = ast_strdupa(data);
@@ -227,7 +227,11 @@ static int dialtone_exec(struct ast_channel *chan, const char *data)
227227

228228
if (ast_strlen_zero(arglist.variable)) {
229229
ast_log(LOG_WARNING, "Invalid! Usage: DialTone(variable,context[,initialfilename][,subsequentfilename][,timeout][,options])\n\n");
230-
return 0;
230+
return -1;
231+
}
232+
if (!ast_strlen_zero(arglist.context) && !ast_context_find(arglist.context)) {
233+
ast_log(LOG_ERROR, "Dialplan context '%s' does not exist\n", arglist.context);
234+
return -1;
231235
}
232236
if (!ast_strlen_zero(arglist.maxdigits)) {
233237
maxdigits = atoi(arglist.maxdigits);

0 commit comments

Comments
 (0)