From 375b08b67356bca441a11c07b84a8575f832dd0d Mon Sep 17 00:00:00 2001
From: Richard Mudgett <rmudgett@digium.com>
Date: Fri, 19 Dec 2014 17:21:15 +0000
Subject: [PATCH] chan_dahdi: Don't ignore setvar when using configuration
 section scheme.

When the configuration section scheme of chan_dahdi.conf is used (keyword
dahdichan instead of channel) all setvar= options are completely ignored.
No variable defined this way appears in the created DAHDI channels.

* Move the clearing of setvar values to after the deferred processing of
dahdichan.

AST-1378 #close
Reported by: Guenther Kelleter
Patch by: Guenther Kelleter


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429825 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/chan_dahdi.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 2471eb639b..88442a2796 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -18702,12 +18702,6 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
 			ast_log(LOG_WARNING, "Ignoring any changes to '%s' (on reload) at line %d.\n", v->name, v->lineno);
 	}
 
-	/* Since confp has already filled invidual dahdi_pvt objects with channels at this point, clear the variables in confp's pvt. */
-	if (confp->chan.vars) {
-		ast_variables_destroy(confp->chan.vars);
-		confp->chan.vars = NULL;
-	}
-
 	if (dahdichan) {
 		/* Process the deferred dahdichan value. */
 		if (build_channels(confp, dahdichan->value, reload, dahdichan->lineno,
@@ -18722,6 +18716,15 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
 		}
 	}
 
+	/*
+	 * Since confp has already filled individual dahdi_pvt objects with channels
+	 * at this point, clear the variables in confp's pvt.
+	 */
+	if (confp->chan.vars) {
+		ast_variables_destroy(confp->chan.vars);
+		confp->chan.vars = NULL;
+	}
+
 	/* mark the first channels of each DAHDI span to watch for their span alarms */
 	for (tmp = iflist, y=-1; tmp; tmp = tmp->next) {
 		if (!tmp->destroy && tmp->span != y) {
-- 
GitLab