<p>George Joseph <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13742">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">message.c: Add option to suppress the Message channel AMI and ARI events<br><br>In order to reduce the amount of AMI and ARI events generated,<br>the global "Message/ast_msg_queue" channel can be set to suppress<br>it's normal channel housekeeping events such as "Newexten",<br>"VarSet", etc. This can greatly reduce load on the manager<br>and ARI applications when the Digium Phone Module for Asterisk<br>is in use. To enable, set "hide_messaging_ami_events" in<br>asterisk.conf to "yes" In Asterisk versions <18, the default<br>is "no" preserving existing behavior. Beginning with<br>Asterisk 18, the option will default to "yes".<br><br>NOTE: This change does not affect UserEvents or the ARI<br>TextMessageReceived events.<br><br>* Added the "hide_messaging_ami_events" option to asterisk.conf.<br><br>* Changed message.c to set the AST_CHAN_TP_INTERNAL property on<br> the "Message/ast_msg_queue" channel if the option is set in<br> asterisk.conf. This suppresses the reporting of the events.<br><br>Change-Id: Ia2e3516d43f4e0df994fc6598565d6bba2d7018b<br>---<br>M configs/samples/asterisk.conf.sample<br>A doc/CHANGES-staging/hide_messaging_ami_events<br>M include/asterisk/options.h<br>M main/asterisk.c<br>M main/message.c<br>M main/options.c<br>6 files changed, 27 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/configs/samples/asterisk.conf.sample b/configs/samples/asterisk.conf.sample</span><br><span>index 5f33abb..bf0bdba 100644</span><br><span>--- a/configs/samples/asterisk.conf.sample</span><br><span>+++ b/configs/samples/asterisk.conf.sample</span><br><span>@@ -118,6 +118,11 @@</span><br><span> ; calls are not accepted by a remote</span><br><span> ; implementation, please report this and go</span><br><span> ; back to value 96.</span><br><span style="color: hsl(120, 100%, 40%);">+;hide_messaging_ami_events = no; This option, if enabled, will</span><br><span style="color: hsl(120, 100%, 40%);">+ ; suppress all of the Message/ast_msg_queue channel's</span><br><span style="color: hsl(120, 100%, 40%);">+ ; housekeeping AMI and ARI channel events. This can</span><br><span style="color: hsl(120, 100%, 40%);">+ ; reduce the load on the manager and ARI applications</span><br><span style="color: hsl(120, 100%, 40%);">+ ; when the Digium Phone Module for Asterisk is in use.</span><br><span> </span><br><span> ; Changing the following lines may compromise your security.</span><br><span> ;[files]</span><br><span>diff --git a/doc/CHANGES-staging/hide_messaging_ami_events b/doc/CHANGES-staging/hide_messaging_ami_events</span><br><span>new file mode 100644</span><br><span>index 0000000..0afbeec</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/hide_messaging_ami_events</span><br><span>@@ -0,0 +1,11 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: Messaging</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+In order to reduce the amount of AMI and ARI events generated,</span><br><span style="color: hsl(120, 100%, 40%);">+the global "Message/ast_msg_queue" channel can be set to suppress</span><br><span style="color: hsl(120, 100%, 40%);">+it's normal channel housekeeping events such as "Newexten",</span><br><span style="color: hsl(120, 100%, 40%);">+"VarSet", etc. This can greatly reduce load on the manager</span><br><span style="color: hsl(120, 100%, 40%);">+and ARI applications when the Digium Phone Module for Asterisk</span><br><span style="color: hsl(120, 100%, 40%);">+is in use. To enable, set "hide_messaging_ami_events" in</span><br><span style="color: hsl(120, 100%, 40%);">+asterisk.conf to "yes" In Asterisk versions <18, the default</span><br><span style="color: hsl(120, 100%, 40%);">+is "no" preserving existing behavior. Beginning with</span><br><span style="color: hsl(120, 100%, 40%);">+Asterisk 18, the option will default to "yes".</span><br><span>diff --git a/include/asterisk/options.h b/include/asterisk/options.h</span><br><span>index 6c4e552..f8c813f 100644</span><br><span>--- a/include/asterisk/options.h</span><br><span>+++ b/include/asterisk/options.h</span><br><span>@@ -84,6 +84,8 @@</span><br><span> AST_OPT_FLAG_DEBUG_MODULE = (1 << 23),</span><br><span> /*! Terminal colors should be adjusted for a light-colored background */</span><br><span> AST_OPT_FLAG_LIGHT_BACKGROUND = (1 << 25),</span><br><span style="color: hsl(120, 100%, 40%);">+ /*! Make the global Message channel an internal channel to suppress AMI events */</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_OPT_FLAG_HIDE_MESSAGING_AMI_EVENTS = (1 << 26),</span><br><span> /*! Force black background */</span><br><span> AST_OPT_FLAG_FORCE_BLACK_BACKGROUND = (1 << 27),</span><br><span> /*! Hide remote console connect messages on console */</span><br><span>@@ -129,6 +131,7 @@</span><br><span> #define ast_opt_generic_plc ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC)</span><br><span> #define ast_opt_ref_debug ast_test_flag(&ast_options, AST_OPT_FLAG_REF_DEBUG)</span><br><span> #define ast_opt_generic_plc_on_equal_codecs ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS)</span><br><span style="color: hsl(120, 100%, 40%);">+#define ast_opt_hide_messaging_ami_events ast_test_flag(&ast_options, AST_OPT_FLAG_HIDE_MESSAGING_AMI_EVENTS)</span><br><span> </span><br><span> /*! Maximum log level defined by PJPROJECT. */</span><br><span> #define MAX_PJ_LOG_MAX_LEVEL 6</span><br><span>diff --git a/main/asterisk.c b/main/asterisk.c</span><br><span>index dd2ae6f..6ae9219 100644</span><br><span>--- a/main/asterisk.c</span><br><span>+++ b/main/asterisk.c</span><br><span>@@ -509,6 +509,7 @@</span><br><span> ast_cli(a->fd, " Transmit silence during rec: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE) ? "Enabled" : "Disabled");</span><br><span> ast_cli(a->fd, " Generic PLC: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC) ? "Enabled" : "Disabled");</span><br><span> ast_cli(a->fd, " Generic PLC on equal codecs: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS) ? "Enabled" : "Disabled");</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_cli(a->fd, " Hide Msg Chan AMI events: %s\n", ast_opt_hide_messaging_ami_events ? "Enabled" : "Disabled");</span><br><span> ast_cli(a->fd, " Min DTMF duration:: %u\n", option_dtmfminduration);</span><br><span> #if !defined(LOW_MEMORY)</span><br><span> ast_cli(a->fd, " Cache media frames: %s\n", ast_opt_cache_media_frames ? "Enabled" : "Disabled");</span><br><span>diff --git a/main/message.c b/main/message.c</span><br><span>index 4874162..39b8d87 100644</span><br><span>--- a/main/message.c</span><br><span>+++ b/main/message.c</span><br><span>@@ -283,7 +283,7 @@</span><br><span> * This will not be registered as we never want anything to try</span><br><span> * to create Message channels other than internally in this file.</span><br><span> */</span><br><span style="color: hsl(0, 100%, 40%);">-static const struct ast_channel_tech msg_chan_tech_hack = {</span><br><span style="color: hsl(120, 100%, 40%);">+static struct ast_channel_tech msg_chan_tech_hack = {</span><br><span> .type = "Message",</span><br><span> .description = "Internal Text Message Processing",</span><br><span> .read = chan_msg_read,</span><br><span>@@ -685,6 +685,10 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_opt_hide_messaging_ami_events) {</span><br><span style="color: hsl(120, 100%, 40%);">+ msg_chan_tech_hack.properties |= AST_CHAN_TP_INTERNAL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> ast_channel_tech_set(chan, &msg_chan_tech_hack);</span><br><span> ast_channel_unlock(chan);</span><br><span> ast_channel_unlink(chan);</span><br><span>diff --git a/main/options.c b/main/options.c</span><br><span>index ea97a6a..38a646e 100644</span><br><span>--- a/main/options.c</span><br><span>+++ b/main/options.c</span><br><span>@@ -457,6 +457,8 @@</span><br><span> }</span><br><span> } else if (!strcasecmp(v->name, "live_dangerously")) {</span><br><span> live_dangerously = ast_true(v->value);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (!strcasecmp(v->name, "hide_messaging_ami_events")) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIDE_MESSAGING_AMI_EVENTS);</span><br><span> }</span><br><span> }</span><br><span> if (!ast_opt_remote) {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13742">change 13742</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/+/13742"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 17 </div>
<div style="display:none"> Gerrit-Change-Id: Ia2e3516d43f4e0df994fc6598565d6bba2d7018b </div>
<div style="display:none"> Gerrit-Change-Number: 13742 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@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: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>