From: Alexei Gradinari Date: Fri, 17 May 2019 22:45:25 +0000 (-0400) Subject: app_readexten: new option 'p' to stop reading on '#' key X-Git-Tag: 17.0.0-rc1~64^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=408210bd4cf6cdd9813afb2ca98ae14c36b3c66a;p=thirdparty%2Fasterisk.git app_readexten: new option 'p' to stop reading on '#' key This patch adds the 'p' option. The extension entered will be considered complete when a # is entered. Change-Id: If77c40c9c8b525885730821e768f5dea71cf04c1 --- diff --git a/apps/app_readexten.c b/apps/app_readexten.c index c8c9f4863e..e32c53cccb 100644 --- a/apps/app_readexten.c +++ b/apps/app_readexten.c @@ -63,6 +63,10 @@ + @@ -100,12 +104,14 @@ enum readexten_option_flags { OPT_SKIP = (1 << 0), OPT_INDICATION = (1 << 1), OPT_NOANSWER = (1 << 2), + OPT_POUND_TO_END = (1 << 3), }; AST_APP_OPTIONS(readexten_app_options, { AST_APP_OPTION('s', OPT_SKIP), AST_APP_OPTION('i', OPT_INDICATION), AST_APP_OPTION('n', OPT_NOANSWER), + AST_APP_OPTION('p', OPT_POUND_TO_END), }); static char *app = "ReadExten"; @@ -226,6 +232,11 @@ static int readexten_exec(struct ast_channel *chan, const char *data) break; } + if (ast_test_flag(&flags, OPT_POUND_TO_END) && res == '#') { + exten[x] = 0; + break; + } + exten[x] = res; if (!ast_matchmore_extension(chan, arglist.context, exten, 1 /* priority */, S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { diff --git a/doc/CHANGES-staging/app_readexten_pound.txt b/doc/CHANGES-staging/app_readexten_pound.txt new file mode 100644 index 0000000000..551f751d10 --- /dev/null +++ b/doc/CHANGES-staging/app_readexten_pound.txt @@ -0,0 +1,3 @@ +Subject: ReadExten + +Add 'p' option to stop reading extension if user presses '#' key.