[Asterisk-code-review] app_directory: add skip call option (asterisk[18])
Michael Bradeen
asteriskteam at digium.com
Fri Jan 27 14:26:42 CST 2023
Michael Bradeen has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19798 )
Change subject: app_directory: add skip call option
......................................................................
app_directory: add skip call option
Adds 's' option to skip calling the extension and instead set the
extension as DIRECTORY_EXTEN channel variable.
ASTERISK-30405
Change-Id: Ib9d9db1ba5b7524594c640461b4aa8f752db8299
---
M apps/app_directory.c
1 file changed, 29 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/98/19798/1
diff --git a/apps/app_directory.c b/apps/app_directory.c
index 36da702..8ed48d9 100644
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -103,6 +103,9 @@
receiver to their ear while entering DTMF.</para>
<argument name="n" required="true" />
</option>
+ <option name="s">
+ <para>Skip calling the extension, intead set it in the DIRECTORY_EXTEN channel variable.</para>
+ </option>
</optionlist>
<note><para>Only one of the <replaceable>f</replaceable>, <replaceable>l</replaceable>, or <replaceable>b</replaceable>
options may be specified. <emphasis>If more than one is specified</emphasis>, then Directory will act as
@@ -132,6 +135,13 @@
<value name="FAILED">The application failed</value>
</variable>
</variablelist>
+ <para>If the skip calling option is set, this application will also set the following
+ channel variable, provided an extension is selected:</para>
+ <variablelist>
+ <variable name="DIRECTORY_EXTEN">
+ <para>Extension selected.</para>
+ </variable>
+ </variablelist>
</description>
</application>
@@ -153,6 +163,7 @@
OPT_PAUSE = (1 << 5),
OPT_NOANSWER = (1 << 6),
OPT_ALIAS = (1 << 7),
+ OPT_SKIP = (1 << 8),
};
enum {
@@ -183,6 +194,7 @@
AST_APP_OPTION('m', OPT_SELECTFROMMENU),
AST_APP_OPTION('n', OPT_NOANSWER),
AST_APP_OPTION('a', OPT_ALIAS),
+ AST_APP_OPTION('s', OPT_SKIP),
});
static int compare(const char *text, const char *template)
@@ -318,6 +330,9 @@
if (ast_test_flag(flags, OPT_FROMVOICEMAIL)) {
/* We still want to set the exten though */
ast_channel_exten_set(chan, item->exten);
+ } else if (ast_test_flag(flags, OPT_SKIP)) {
+ /* Skip calling the extension, only set it in the channel variable. */
+ pbx_builtin_setvar_helper(chan, "DIRECTORY_EXTEN", item->exten);
} else if (ast_goto_if_exists(chan, S_OR(dialcontext, item->context), item->exten, 1)) {
ast_log(LOG_WARNING,
"Can't find extension '%s' in context '%s'. "
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19798
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: Ib9d9db1ba5b7524594c640461b4aa8f752db8299
Gerrit-Change-Number: 19798
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230127/b3b8cb6a/attachment.html>
More information about the asterisk-code-review
mailing list