<p>Michael Bradeen has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19883">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_read: add option to return terminator on empty digits<br><br>Adds 'e' option to allow app_read to return the terminator as the<br>dialed digits in the case where only the terminator is entered.<br><br>ie; if "#" is entered, return "#" if the 'e' option is set and ""<br>if it is not.<br><br>ASTERISK-30411<br><br>Change-Id: I49f3221824330a193a20c660f99da0f1fc2cbbc5<br>---<br>M apps/app_read.c<br>1 file changed, 37 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/83/19883/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_read.c b/apps/app_read.c</span><br><span>index f4a965c..1637456 100644</span><br><span>--- a/apps/app_read.c</span><br><span>+++ b/apps/app_read.c</span><br><span>@@ -85,6 +85,10 @@</span><br><span> and you will need to rely on duration and max digits</span><br><span> for ending input.</para></span><br><span> </option></span><br><span style="color: hsl(120, 100%, 40%);">+ <option name="e"></span><br><span style="color: hsl(120, 100%, 40%);">+ <para>to read the terminator as the digit string if</span><br><span style="color: hsl(120, 100%, 40%);">+ the only digit read is the terminator.</para></span><br><span style="color: hsl(120, 100%, 40%);">+ </option></span><br><span> </optionlist></span><br><span> </parameter></span><br><span> <parameter name="attempts"></span><br><span>@@ -125,6 +129,7 @@</span><br><span> OPT_INDICATION = (1 << 1),</span><br><span> OPT_NOANSWER = (1 << 2),</span><br><span> OPT_TERMINATOR = (1 << 3),</span><br><span style="color: hsl(120, 100%, 40%);">+ OPT_NOEMPTY = (1 << 4),</span><br><span> };</span><br><span> </span><br><span> enum {</span><br><span>@@ -138,6 +143,7 @@</span><br><span> AST_APP_OPTION('i', OPT_INDICATION),</span><br><span> AST_APP_OPTION('n', OPT_NOANSWER),</span><br><span> AST_APP_OPTION_ARG('t', OPT_TERMINATOR, OPT_ARG_TERMINATOR),</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_APP_OPTION('e', OPT_NOEMPTY),</span><br><span> });</span><br><span> </span><br><span> static char *app = "Read";</span><br><span>@@ -261,12 +267,23 @@</span><br><span> }</span><br><span> } else {</span><br><span> res = ast_app_getdata_terminator(chan, arglist.filename, tmp, maxdigits, to, terminator);</span><br><span style="color: hsl(0, 100%, 40%);">- if (res == AST_GETDATA_COMPLETE || res == AST_GETDATA_EMPTY_END_TERMINATED)</span><br><span style="color: hsl(120, 100%, 40%);">+ if (res == AST_GETDATA_COMPLETE) {</span><br><span> status = "OK";</span><br><span style="color: hsl(0, 100%, 40%);">- else if (res == AST_GETDATA_TIMEOUT)</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ else if (res == AST_GETDATA_EMPTY_END_TERMINATED) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_test_flag(&flags, OPT_NOEMPTY)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* if the option is set to do so, read the</span><br><span style="color: hsl(120, 100%, 40%);">+ returned string as the terminator string */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_string(tmp, terminator, sizeof(tmp));</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ status = "OK";</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ else if (res == AST_GETDATA_TIMEOUT) {</span><br><span> status = "TIMEOUT";</span><br><span style="color: hsl(0, 100%, 40%);">- else if (res == AST_GETDATA_INTERRUPTED)</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ else if (res == AST_GETDATA_INTERRUPTED) {</span><br><span> status = "INTERRUPTED";</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> }</span><br><span> if (res > -1) {</span><br><span> pbx_builtin_setvar_helper(chan, arglist.variable, tmp);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19883">change 19883</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/+/19883"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: I49f3221824330a193a20c660f99da0f1fc2cbbc5 </div>
<div style="display:none"> Gerrit-Change-Number: 19883 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Michael Bradeen <mbradeen@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>