[Asterisk-code-review] app_directory: add skip call option (asterisk[20])

George Joseph asteriskteam at digium.com
Tue Jan 31 08:34:43 CST 2023


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19872 )


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, 27 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/72/19872/1

diff --git a/apps/app_directory.c b/apps/app_directory.c
index 847710b..e264e9b 100644
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -107,6 +107,9 @@
 						<para>Load the specified config file instead of voicemail.conf</para>
 						<argument name="filename" 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
@@ -123,7 +126,7 @@
 			received and the extension to jump to exists:</para>
 			<para><literal>0</literal> - Jump to the 'o' extension, if it exists.</para>
 			<para><literal>*</literal> - Jump to the 'a' extension, if it exists.</para>
-			<para>This application will set the following channel variable before completion:</para>
+			<para>This application will set the following channel variables before completion:</para>
 			<variablelist>
 				<variable name="DIRECTORY_RESULT">
 					<para>Reason Directory application exited.</para>
@@ -135,6 +138,10 @@
 					<value name="USEREXIT">User exited with '#' during selection</value>
 					<value name="FAILED">The application failed</value>
 				</variable>
+				<variable name="DIRECTORY_EXTEN">
+					<para>If the skip calling option is set this will be set to the selected extension
+					provided one is selected.</para>
+				</variable>
 			</variablelist>
 		</description>
 	</application>
@@ -158,6 +165,7 @@
 	OPT_NOANSWER =        (1 << 6),
 	OPT_ALIAS =           (1 << 7),
 	OPT_CONFIG_FILE =     (1 << 8),
+	OPT_SKIP =            (1 << 9),
 };
 
 enum {
@@ -190,6 +198,7 @@
 	AST_APP_OPTION('n', OPT_NOANSWER),
 	AST_APP_OPTION('a', OPT_ALIAS),
 	AST_APP_OPTION_ARG('c', OPT_CONFIG_FILE, OPT_ARG_FILENAME),
+	AST_APP_OPTION('s', OPT_SKIP),
 });
 
 static int compare(const char *text, const char *template)
@@ -325,6 +334,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/+/19872
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 20
Gerrit-Change-Id: Ib9d9db1ba5b7524594c640461b4aa8f752db8299
Gerrit-Change-Number: 19872
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-CC: 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/20230131/6847ea4d/attachment-0001.html>


More information about the asterisk-code-review mailing list