<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13514">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Sean Bright: Looks good to me, but someone else must approve
Benjamin Keith Ford: 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_page.c: Simplify dialplan using Page.<br><br>Dialplan has to be careful about passing an empty destination list or<br>empty positions in the list. As a result, dialplan has to check for<br>these conditions before using Page. Simplify dialplan by making Page<br>handle these conditions gracefully.<br><br>* Made tolerate empty positions in the paged device list.<br><br>* Reduced some warnings associated with the 's' option to verbose<br>messages. The warning level for those messages really serves no purpose<br>as that is why the 's' option exists.<br><br>ASTERISK-28638<br><br>Change-Id: I95b64a6d6800cd1a25279c88889314ae60fc21e3<br>---<br>M apps/app_page.c<br>A doc/CHANGES-staging/app_page_empty_page_list.txt<br>2 files changed, 23 insertions(+), 14 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_page.c b/apps/app_page.c</span><br><span>index 12ba01d..df601e7 100644</span><br><span>--- a/apps/app_page.c</span><br><span>+++ b/apps/app_page.c</span><br><span>@@ -48,7 +48,7 @@</span><br><span> Page series of phones</span><br><span> </synopsis></span><br><span> <syntax></span><br><span style="color: hsl(0, 100%, 40%);">- <parameter name="Technology/Resource" required="true" argsep="&"></span><br><span style="color: hsl(120, 100%, 40%);">+ <parameter name="Technology/Resource" required="false" argsep="&"></span><br><span> <argument name="Technology/Resource" required="true"></span><br><span> <para>Specification of the device(s) to dial. These must be in the format of</span><br><span> <literal>Technology/Resource</literal>, where <replaceable>Technology</replaceable></span><br><span>@@ -270,17 +270,12 @@</span><br><span> AST_APP_ARG(timeout);</span><br><span> );</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_strlen_zero(data)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "This application requires at least one argument (destination(s) to page)\n");</span><br><span style="color: hsl(0, 100%, 40%);">- return -1;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> if (!(app = pbx_findapp("ConfBridge"))) {</span><br><span> ast_log(LOG_WARNING, "There is no ConfBridge application available!\n");</span><br><span> return -1;</span><br><span> };</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- parse = ast_strdupa(data);</span><br><span style="color: hsl(120, 100%, 40%);">+ parse = ast_strdupa(data ?: "");</span><br><span> </span><br><span> AST_STANDARD_APP_ARGS(args, parse);</span><br><span> </span><br><span>@@ -301,7 +296,7 @@</span><br><span> </span><br><span> /* Count number of extensions in list by number of ampersands + 1 */</span><br><span> num_dials = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- tmp = args.devices;</span><br><span style="color: hsl(120, 100%, 40%);">+ tmp = args.devices ?: "";</span><br><span> while (*tmp) {</span><br><span> if (*tmp == '&') {</span><br><span> num_dials++;</span><br><span>@@ -334,13 +329,20 @@</span><br><span> int state = 0;</span><br><span> struct ast_dial *dial = NULL;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- /* don't call the originating device */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcasecmp(tech, originator))</span><br><span style="color: hsl(120, 100%, 40%);">+ tech = ast_strip(tech);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_strlen_zero(tech)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* No tech/resource in this position. */</span><br><span> continue;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* don't call the originating device */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!strcasecmp(tech, originator)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ continue;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span> /* If no resource is available, continue on */</span><br><span> if (!(resource = strchr(tech, '/'))) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Incomplete destination '%s' supplied.\n", tech);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "Incomplete destination: '%s' supplied.\n", tech);</span><br><span> continue;</span><br><span> }</span><br><span> </span><br><span>@@ -348,9 +350,11 @@</span><br><span> if (ast_test_flag(&options.flags, PAGE_SKIP)) {</span><br><span> state = ast_device_state(tech);</span><br><span> if (state == AST_DEVICE_UNKNOWN) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Destination '%s' has device state '%s'. Paging anyway.\n", tech, ast_devstate2str(state));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_verb(3, "Destination '%s' has device state '%s'. Paging anyway.\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ tech, ast_devstate2str(state));</span><br><span> } else if (state != AST_DEVICE_NOT_INUSE) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Destination '%s' has device state '%s'.\n", tech, ast_devstate2str(state));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_verb(3, "Destination '%s' has device state '%s'.\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ tech, ast_devstate2str(state));</span><br><span> continue;</span><br><span> }</span><br><span> }</span><br><span>@@ -365,7 +369,7 @@</span><br><span> </span><br><span> /* Append technology and resource */</span><br><span> if (ast_dial_append(dial, tech, resource, NULL) == -1) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "Failed to add %s to outbound dial\n", tech);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_ERROR, "Failed to add %s/%s to outbound dial\n", tech, resource);</span><br><span> ast_dial_destroy(dial);</span><br><span> continue;</span><br><span> }</span><br><span>diff --git a/doc/CHANGES-staging/app_page_empty_page_list.txt b/doc/CHANGES-staging/app_page_empty_page_list.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..73e8420</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/app_page_empty_page_list.txt</span><br><span>@@ -0,0 +1,5 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: app_page</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The Page application now tolerates empty positions in the supplied</span><br><span style="color: hsl(120, 100%, 40%);">+destination list. Dialplan can now be simplified by not having to check</span><br><span style="color: hsl(120, 100%, 40%);">+for empty positions in the destination list.</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13514">change 13514</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/+/13514"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I95b64a6d6800cd1a25279c88889314ae60fc21e3 </div>
<div style="display:none"> Gerrit-Change-Number: 13514 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@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: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>