<p>Benoît Dereck-Tricot has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7938">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pbx: disable extensions loading logs via config<br><br>Loading extensions can generate a lot of "Added extension..." logs, especially<br>when you combine rich dialplans with frequent dialplan reloads.<br>A new parameter has been added in extensions.conf: disableloadinglogs, which<br>defaults to false.<br><br>ASTERISK-27084<br><br>Change-Id: I46af3f91ea6df9e302c9ee2afbbe08b5a2745a6e<br>---<br>M configs/samples/extensions.conf.sample<br>M include/asterisk/pbx.h<br>M main/pbx.c<br>M pbx/pbx_config.c<br>4 files changed, 25 insertions(+), 6 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/38/7938/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/configs/samples/extensions.conf.sample b/configs/samples/extensions.conf.sample<br>index db4c215..81cc3e3 100644<br>--- a/configs/samples/extensions.conf.sample<br>+++ b/configs/samples/extensions.conf.sample<br>@@ -36,7 +36,11 @@<br> ;<br> ;autofallthrough=no<br> ;<br>+; Loading extensions can generate a lot of "Added extension..." logs, especially<br>+; when you combine rich dialplans with frequent dialplan reloads.<br>+; In such cases you may wish to set disableloadinglogs.<br> ;<br>+;disableloadinglogs=yes<br> ;<br> ; If extenpatternmatchnew is set (true, yes, etc), then a new algorithm that uses<br> ; a Trie to find the best matching pattern is used. In dialplans<br>diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h<br>index c8c171a..cbd40de 100644<br>--- a/include/asterisk/pbx.h<br>+++ b/include/asterisk/pbx.h<br>@@ -1449,6 +1449,10 @@<br>   the old linear-search algorithm.  Returns previous value. */<br> int pbx_set_extenpatternmatchnew(int newval);<br> <br>+/*! Set the "disableloadinglogs" flag. If set, (re)loading the dialplan extensions will not<br>+  produce "Added extension..." logs. */<br>+void pbx_set_disableloadinglogs(int newval);<br>+<br> /*! Set "overrideswitch" field.  If set and of nonzero length, all contexts<br>  * will be tried directly through the named switch prior to any other<br>  * matching within that context.<br>diff --git a/main/pbx.c b/main/pbx.c<br>index b850e8e..3ac66e7 100644<br>--- a/main/pbx.c<br>+++ b/main/pbx.c<br>@@ -761,6 +761,7 @@<br> <br> static int autofallthrough = 1;<br> static int extenpatternmatchnew = 0;<br>+static int disableloadinglogs = 0;<br> static char *overrideswitch = NULL;<br> <br> /*! \brief Subscription for device state change events */<br>@@ -4734,6 +4735,11 @@<br>      return oldval;<br> }<br> <br>+void pbx_set_disableloadinglogs(int newval)<br>+{<br>+      disableloadinglogs = newval;<br>+}<br>+<br> void pbx_set_overrideswitch(const char *newval)<br> {<br>     if (overrideswitch) {<br>@@ -7516,12 +7522,14 @@<br>                }<br>     }<br> <br>- if (tmp->matchcid == AST_EXT_MATCHCID_ON) {<br>-               ast_verb(3, "Added extension '%s' priority %d (CID match '%s') to %s\n",<br>-                            tmp->name, tmp->priority, tmp->cidmatch_display, con->name);<br>-    } else {<br>-             ast_verb(3, "Added extension '%s' priority %d to %s\n",<br>-                             tmp->name, tmp->priority, con->name);<br>+      if (!disableloadinglogs) {<br>+           if (tmp->matchcid == AST_EXT_MATCHCID_ON) {<br>+                       ast_verb(3, "Added extension '%s' priority %d (CID match '%s') to %s\n",<br>+                                    tmp->name, tmp->priority, tmp->cidmatch_display, con->name);<br>+            } else {<br>+                     ast_verb(3, "Added extension '%s' priority %d to %s\n",<br>+                                     tmp->name, tmp->priority, con->name);<br>+              }<br>     }<br> <br>  return 0;<br>diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c<br>index 9577d2d..fa59e5c 100644<br>--- a/pbx/pbx_config.c<br>+++ b/pbx/pbx_config.c<br>@@ -1688,6 +1688,7 @@<br>     const char *cxt;<br>      const char *aft;<br>      const char *newpm, *ovsw;<br>+    const char *extlogsdisabled;<br>  struct ast_flags config_flags = { 0 };<br>        char lastextension[256];<br>      cfg = ast_config_load(config_file, config_flags);<br>@@ -1701,6 +1702,8 @@<br>              autofallthrough_config = ast_true(aft);<br>       if ((newpm = ast_variable_retrieve(cfg, "general", "extenpatternmatchnew")))<br>              extenpatternmatchnew_config = ast_true(newpm);<br>+       if ((extlogsdisabled = ast_variable_retrieve(cfg, "general", "disableloadinglogs")))<br>+             pbx_set_disableloadinglogs(ast_true(extlogsdisabled));<br>        clearglobalvars_config = ast_true(ast_variable_retrieve(cfg, "general", "clearglobalvars"));<br>      if ((ovsw = ast_variable_retrieve(cfg, "general", "overrideswitch"))) {<br>           if (overrideswitch_config) {<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7938">change 7938</a>. To unsubscribe, 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/7938"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I46af3f91ea6df9e302c9ee2afbbe08b5a2745a6e </div>
<div style="display:none"> Gerrit-Change-Number: 7938 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Benoît Dereck-Tricot <benoit.dereck-tricot@eyepea.eu> </div>