[Asterisk-code-review] app_readexten: new option 'p' to stop reading on '#' key (...asterisk[13])
Friendly Automation
asteriskteam at digium.com
Mon Jun 3 09:54:45 CDT 2019
Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11402 )
Change subject: app_readexten: new option 'p' to stop reading on '#' key
......................................................................
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
---
M apps/app_readexten.c
A doc/CHANGES-staging/app_readexten_pound.txt
2 files changed, 14 insertions(+), 0 deletions(-)
Approvals:
Benjamin Keith Ford: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/apps/app_readexten.c b/apps/app_readexten.c
index fbb290c..a809f92 100644
--- a/apps/app_readexten.c
+++ b/apps/app_readexten.c
@@ -65,6 +65,10 @@
<option name="n">
<para>Read digits even if the channel is not answered.</para>
</option>
+ <option name="p">
+ <para>The extension entered will be considered complete when a <literal>#</literal>
+ is entered.</para>
+ </option>
</optionlist>
</parameter>
<parameter name="timeout">
@@ -102,12 +106,14 @@
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";
@@ -228,6 +234,11 @@
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 0000000..551f751
--- /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.
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11402
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: If77c40c9c8b525885730821e768f5dea71cf04c1
Gerrit-Change-Number: 11402
Gerrit-PatchSet: 1
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190603/dc9d24e4/attachment-0001.html>
More information about the asterisk-code-review
mailing list