<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19872">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span></span><br></pre><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Sean Bright: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_directory: Add a 'skip call' option.<br><br>Adds 's' option to skip calling the extension and instead set the<br>extension as DIRECTORY_EXTEN channel variable.<br><br>ASTERISK-30405<br><br>Change-Id: Ib9d9db1ba5b7524594c640461b4aa8f752db8299<br>---<br>M apps/app_directory.c<br>A doc/CHANGES-staging/app_directory_skip_call.txt<br>2 files changed, 33 insertions(+), 1 deletion(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_directory.c b/apps/app_directory.c</span><br><span>index 847710b..40f7896 100644</span><br><span>--- a/apps/app_directory.c</span><br><span>+++ b/apps/app_directory.c</span><br><span>@@ -107,6 +107,10 @@</span><br><span>                                          <para>Load the specified config file instead of voicemail.conf</para></span><br><span>                                            <argument name="filename" required="true" /></span><br><span>                                       </option></span><br><span style="color: hsl(120, 100%, 40%);">+                                       <option name="s"></span><br><span style="color: hsl(120, 100%, 40%);">+                                             <para>Skip calling the extension, instead set it in the <variable>DIRECTORY_EXTEN</variable></span><br><span style="color: hsl(120, 100%, 40%);">+                                                channel variable.</para></span><br><span style="color: hsl(120, 100%, 40%);">+                                        </option></span><br><span>                              </optionlist></span><br><span>                          <note><para>Only one of the <replaceable>f</replaceable>, <replaceable>l</replaceable>, or <replaceable>b</replaceable></span><br><span>                              options may be specified. <emphasis>If more than one is specified</emphasis>, then Directory will act as</span><br><span>@@ -123,7 +127,7 @@</span><br><span>                   received and the extension to jump to exists:</para></span><br><span>                   <para><literal>0</literal> - Jump to the 'o' extension, if it exists.</para></span><br><span>                         <para><literal>*</literal> - Jump to the 'a' extension, if it exists.</para></span><br><span style="color: hsl(0, 100%, 40%);">-                    <para>This application will set the following channel variable before completion:</para></span><br><span style="color: hsl(120, 100%, 40%);">+                  <para>This application will set the following channel variables before completion:</para></span><br><span>                        <variablelist></span><br><span>                                 <variable name="DIRECTORY_RESULT"></span><br><span>                                   <para>Reason Directory application exited.</para></span><br><span>@@ -135,6 +139,10 @@</span><br><span>                                         <value name="USEREXIT">User exited with '#' during selection</value></span><br><span>                                   <value name="FAILED">The application failed</value></span><br><span>                            </variable></span><br><span style="color: hsl(120, 100%, 40%);">+                             <variable name="DIRECTORY_EXTEN"></span><br><span style="color: hsl(120, 100%, 40%);">+                                     <para>If the skip calling option is set this will be set to the selected extension</span><br><span style="color: hsl(120, 100%, 40%);">+                                      provided one is selected.</para></span><br><span style="color: hsl(120, 100%, 40%);">+                                </variable></span><br><span>                    </variablelist></span><br><span>                </description></span><br><span>         </application></span><br><span>@@ -158,6 +166,7 @@</span><br><span>   OPT_NOANSWER =        (1 << 6),</span><br><span>        OPT_ALIAS =           (1 << 7),</span><br><span>        OPT_CONFIG_FILE =     (1 << 8),</span><br><span style="color: hsl(120, 100%, 40%);">+ OPT_SKIP =            (1 << 9),</span><br><span> };</span><br><span> </span><br><span> enum {</span><br><span>@@ -190,6 +199,7 @@</span><br><span>      AST_APP_OPTION('n', OPT_NOANSWER),</span><br><span>   AST_APP_OPTION('a', OPT_ALIAS),</span><br><span>      AST_APP_OPTION_ARG('c', OPT_CONFIG_FILE, OPT_ARG_FILENAME),</span><br><span style="color: hsl(120, 100%, 40%);">+   AST_APP_OPTION('s', OPT_SKIP),</span><br><span> });</span><br><span> </span><br><span> static int compare(const char *text, const char *template)</span><br><span>@@ -325,6 +335,9 @@</span><br><span>        if (ast_test_flag(flags, OPT_FROMVOICEMAIL)) {</span><br><span>               /* We still want to set the exten though */</span><br><span>          ast_channel_exten_set(chan, item->exten);</span><br><span style="color: hsl(120, 100%, 40%);">+  } else if (ast_test_flag(flags, OPT_SKIP)) {</span><br><span style="color: hsl(120, 100%, 40%);">+          /* Skip calling the extension, only set it in the channel variable. */</span><br><span style="color: hsl(120, 100%, 40%);">+                pbx_builtin_setvar_helper(chan, "DIRECTORY_EXTEN", item->exten);</span><br><span>        } else if (ast_goto_if_exists(chan, S_OR(dialcontext, item->context), item->exten, 1)) {</span><br><span>               ast_log(LOG_WARNING,</span><br><span>                         "Can't find extension '%s' in context '%s'.  "</span><br><span>diff --git a/doc/CHANGES-staging/app_directory_skip_call.txt b/doc/CHANGES-staging/app_directory_skip_call.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..83687fe</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/app_directory_skip_call.txt</span><br><span>@@ -0,0 +1,5 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: app_directory</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+A new option 's' has been added to the Directory() application that</span><br><span style="color: hsl(120, 100%, 40%);">+will skip calling the extension and instead set the extension as</span><br><span style="color: hsl(120, 100%, 40%);">+DIRECTORY_EXTEN channel variable.</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19872">change 19872</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/19872"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 20 </div>
<div style="display:none"> Gerrit-Change-Id: Ib9d9db1ba5b7524594c640461b4aa8f752db8299 </div>
<div style="display:none"> Gerrit-Change-Number: 19872 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean@seanbright.com> </div>
<div style="display:none"> Gerrit-CC: Michael Bradeen <mbradeen@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>