summaryrefslogtreecommitdiff
path: root/apps/app_readexten.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/app_readexten.c')
-rw-r--r--apps/app_readexten.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/apps/app_readexten.c b/apps/app_readexten.c
index dc2e482c3..5e6f3ed44 100644
--- a/apps/app_readexten.c
+++ b/apps/app_readexten.c
@@ -129,7 +129,7 @@ static int readexten_exec(struct ast_channel *chan, const char *data)
AST_APP_ARG(options);
AST_APP_ARG(timeout);
);
-
+
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "ReadExten requires at least one argument\n");
pbx_builtin_setvar_helper(chan, "READEXTENSTATUS", "ERROR");
@@ -145,14 +145,17 @@ static int readexten_exec(struct ast_channel *chan, const char *data)
return 0;
}
- if (ast_strlen_zero(arglist.filename))
+ if (ast_strlen_zero(arglist.filename)) {
arglist.filename = NULL;
+ }
- if (ast_strlen_zero(arglist.context))
- arglist.context = chan->context;
+ if (ast_strlen_zero(arglist.context)) {
+ arglist.context = ast_strdupa(ast_channel_context(chan));
+ }
- if (!ast_strlen_zero(arglist.options))
+ if (!ast_strlen_zero(arglist.options)) {
ast_app_parse_options(readexten_app_options, &flags, NULL, arglist.options);
+ }
if (!ast_strlen_zero(arglist.timeout)) {
timeout = atoi(arglist.timeout);