<p>George Joseph <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18845">View Change</a></p><div style="white-space:pre-wrap">Approvals:
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">manager: Fix incomplete filtering of AMI events.<br><br>The global event filtering code was only in one<br>possible execution path, so not all events were<br>being properly filtered out if requested. This moves<br>that into the universal AMI handling code so all<br>events are properly handled.<br><br>Additionally, the CLI listing of disabled events can<br>also get truncated, so we now print out everything.<br><br>ASTERISK-30137 #close<br><br>Change-Id: If8c42edcb2abc5158552da7eba2a8ff6b20e1959<br>---<br>M main/manager.c<br>1 file changed, 12 insertions(+), 11 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/manager.c b/main/manager.c</span><br><span>index d834f04..9645bd6 100644</span><br><span>--- a/main/manager.c</span><br><span>+++ b/main/manager.c</span><br><span>@@ -7128,6 +7128,14 @@</span><br><span> struct ast_str *buf;</span><br><span> int i;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ast_strlen_zero(manager_disabledevents)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_in_delimited_string(event, manager_disabledevents, ',')) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_debug(3, "AMI Event '%s' is globally disabled, skipping\n", event);</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Event is globally disabled */</span><br><span style="color: hsl(120, 100%, 40%);">+ return -1;</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%);">+</span><br><span> buf = ast_str_thread_get(&manager_event_buf, MANAGER_EVENT_BUF_INITSIZE);</span><br><span> if (!buf) {</span><br><span> return -1;</span><br><span>@@ -7239,15 +7247,6 @@</span><br><span> va_list ap;</span><br><span> int res;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(manager_disabledevents)) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_in_delimited_string(event, manager_disabledevents, ',')) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(3, "AMI Event '%s' is globally disabled, skipping\n", event);</span><br><span style="color: hsl(0, 100%, 40%);">- /* Event is globally disabled */</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_cleanup(sessions);</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> if (!any_manager_listeners(sessions)) {</span><br><span> /* Nobody is listening */</span><br><span> ao2_cleanup(sessions);</span><br><span>@@ -8694,6 +8693,7 @@</span><br><span> }</span><br><span> #define FORMAT " %-25.25s %-15.55s\n"</span><br><span> #define FORMAT2 " %-25.25s %-15d\n"</span><br><span style="color: hsl(120, 100%, 40%);">+#define FORMAT3 " %-25.25s %s\n"</span><br><span> if (a->argc != 3) {</span><br><span> return CLI_SHOWUSAGE;</span><br><span> }</span><br><span>@@ -8711,11 +8711,12 @@</span><br><span> ast_cli(a->fd, FORMAT, "Allow multiple login:", AST_CLI_YESNO(allowmultiplelogin));</span><br><span> ast_cli(a->fd, FORMAT, "Display connects:", AST_CLI_YESNO(displayconnects));</span><br><span> ast_cli(a->fd, FORMAT, "Timestamp events:", AST_CLI_YESNO(timestampevents));</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, FORMAT, "Channel vars:", S_OR(manager_channelvars, ""));</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, FORMAT, "Disabled events:", S_OR(manager_disabledevents, ""));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_cli(a->fd, FORMAT3, "Channel vars:", S_OR(manager_channelvars, ""));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_cli(a->fd, FORMAT3, "Disabled events:", S_OR(manager_disabledevents, ""));</span><br><span> ast_cli(a->fd, FORMAT, "Debug:", AST_CLI_YESNO(manager_debug));</span><br><span> #undef FORMAT</span><br><span> #undef FORMAT2</span><br><span style="color: hsl(120, 100%, 40%);">+#undef FORMAT3</span><br><span> </span><br><span> return CLI_SUCCESS;</span><br><span> }</span><br><span></span><br></pre><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18845">change 18845</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/+/18845"/><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: If8c42edcb2abc5158552da7eba2a8ff6b20e1959 </div>
<div style="display:none"> Gerrit-Change-Number: 18845 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.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-MessageType: merged </div>