[Asterisk-code-review] followme: initialize all config items on reload (asterisk[11])

Anonymous Coward asteriskteam at digium.com
Wed Sep 7 17:23:51 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: followme: initialize all config items on reload
......................................................................


followme: initialize all config items on reload

Some configuration directives were not initialized on reload, and hence
were not reset to default if they were removed from followme.conf.

ASTERISK-26288 #close

Change-Id: Ief829e16374ad1e0ecfd63e6ee4923b5a1d1c150
---
M apps/app_followme.c
1 file changed, 14 insertions(+), 12 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/apps/app_followme.c b/apps/app_followme.c
index dfb0f0e..e05d95b 100644
--- a/apps/app_followme.c
+++ b/apps/app_followme.c
@@ -303,8 +303,16 @@
 
 	ast_mutex_init(&f->lock);
 	ast_copy_string(f->name, fmname, sizeof(f->name));
-	f->moh[0] = '\0';
+	AST_LIST_HEAD_INIT_NOLOCK(&f->numbers);
+	AST_LIST_HEAD_INIT_NOLOCK(&f->blnumbers);
+	AST_LIST_HEAD_INIT_NOLOCK(&f->wlnumbers);
+	return f;
+}
+
+static void init_profile(struct call_followme *f, int activate)
+{
 	f->context[0] = '\0';
+	ast_copy_string(f->moh, defaultmoh, sizeof(f->moh));
 	ast_copy_string(f->takecall, takecall, sizeof(f->takecall));
 	ast_copy_string(f->nextindp, nextindp, sizeof(f->nextindp));
 	ast_copy_string(f->callfromprompt, callfromprompt, sizeof(f->callfromprompt));
@@ -313,16 +321,9 @@
 	ast_copy_string(f->plsholdprompt, plsholdprompt, sizeof(f->plsholdprompt));
 	ast_copy_string(f->statusprompt, statusprompt, sizeof(f->statusprompt));
 	ast_copy_string(f->sorryprompt, sorryprompt, sizeof(f->sorryprompt));
-	AST_LIST_HEAD_INIT_NOLOCK(&f->numbers);
-	AST_LIST_HEAD_INIT_NOLOCK(&f->blnumbers);
-	AST_LIST_HEAD_INIT_NOLOCK(&f->wlnumbers);
-	return f;
-}
-
-static void init_profile(struct call_followme *f)
-{
-	f->active = 1;
-	ast_copy_string(f->moh, defaultmoh, sizeof(f->moh));
+	if (activate) {
+		f->active = 1;
+	}
 }
 
    
@@ -495,7 +496,7 @@
 		if (!new)
 			ast_mutex_lock(&f->lock);
 		/* Re-initialize the profile */
-		init_profile(f);
+		init_profile(f, 1);
 		free_numbers(f);
 		var = ast_variable_browse(cfg, cat);
 		while (var) {
@@ -1220,6 +1221,7 @@
 		ast_free(str);
 		return NULL;
 	}
+	init_profile(new_follower, 0);
 
 	for (v = var; v; v = v->next) {
 		if (!strcasecmp(v->name, "active")) {

-- 
To view, visit https://gerrit.asterisk.org/3581
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ief829e16374ad1e0ecfd63e6ee4923b5a1d1c150
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Tzafrir Cohen <tzafrir.cohen at xorcom.com>



More information about the asterisk-code-review mailing list