[Asterisk-code-review] pbx config: Only the first [globals] section is seen. (asterisk[13])
George Joseph
asteriskteam at digium.com
Thu Nov 15 07:48:30 CST 2018
George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/10581 )
Change subject: pbx_config: Only the first [globals] section is seen.
......................................................................
pbx_config: Only the first [globals] section is seen.
If multiple [globals] sections are used (for example via separate
included files), only the first one is processed. This can result in
lost global variables when using a modular extensions.conf.
ASTERISK-28146 #close
Change-Id: Iaac810c0a7c4d9b1bf8989fcc041cdb910ef08a0
---
M CHANGES
M pbx/pbx_config.c
2 files changed, 19 insertions(+), 3 deletions(-)
Approvals:
Joshua Colp: 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; Approved for Submit
diff --git a/CHANGES b/CHANGES
index b191f40..5c254a8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -12,6 +12,12 @@
--- Functionality changes from Asterisk 13.23.0 to Asterisk 13.24.0 ----------
------------------------------------------------------------------------------
+pbx_config
+------------------
+ * pbx_config will now find and process multiple 'globals' sections from
+ extensions.conf. Variables are processed in the order they are found
+ and duplicate variables overwrite the previous value.
+
res_pjsip
------------------
* New options 'trust_connected_line' and 'send_connected_line' have been
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index 441a996..6c3b934 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -1688,10 +1688,20 @@
ast_copy_string(userscontext, ast_variable_retrieve(cfg, "general", "userscontext") ?: "default", sizeof(userscontext));
- for (v = ast_variable_browse(cfg, "globals"); v; v = v->next) {
- pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
- pbx_builtin_setvar_helper(NULL, v->name, realvalue);
+ /* ast_variable_browse does not merge multiple [globals] sections */
+ for (cxt = ast_category_browse(cfg, NULL);
+ cxt;
+ cxt = ast_category_browse(cfg, cxt)) {
+ if (strcasecmp(cxt, "globals")) {
+ continue;
+ }
+
+ for (v = ast_variable_browse(cfg, cxt); v; v = v->next) {
+ pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
+ pbx_builtin_setvar_helper(NULL, v->name, realvalue);
+ }
}
+
for (cxt = ast_category_browse(cfg, NULL);
cxt;
cxt = ast_category_browse(cfg, cxt)) {
--
To view, visit https://gerrit.asterisk.org/10581
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaac810c0a7c4d9b1bf8989fcc041cdb910ef08a0
Gerrit-Change-Number: 10581
Gerrit-PatchSet: 2
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2 (1000185)
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181115/6e9b48cb/attachment.html>
More information about the asterisk-code-review
mailing list