summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorzuul <zuul@gerrit.asterisk.org>2016-08-22 16:35:33 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-08-22 16:35:33 -0500
commit4913fe3825be67163a17f97dd8b606aa2dd288b7 (patch)
tree09bc38773f3c4fbb7cca8f02291776b62b0e127f /apps
parent27813c74399c6633d67cc51a2207cab40f0b3d4f (diff)
parent046069011bc618f578b625be9116b406d1d3c5e8 (diff)
Merge "followme: initialize all config items on reload"
Diffstat (limited to 'apps')
-rw-r--r--apps/app_followme.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/apps/app_followme.c b/apps/app_followme.c
index a955843bc..938e63ec4 100644
--- a/apps/app_followme.c
+++ b/apps/app_followme.c
@@ -316,9 +316,17 @@ static struct call_followme *alloc_profile(const char *fmname)
ast_mutex_init(&f->lock);
ast_copy_string(f->name, fmname, sizeof(f->name));
- f->moh[0] = '\0';
- f->context[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->enable_callee_prompt = enable_callee_prompt;
+ 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));
@@ -327,16 +335,9 @@ static struct call_followme *alloc_profile(const char *fmname)
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;
+ }
}
@@ -518,7 +519,7 @@ static int reload_followme(int reload)
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) {
@@ -1248,6 +1249,7 @@ static struct call_followme *find_realtime(const char *name)
ast_free(str);
return NULL;
}
+ init_profile(new_follower, 0);
for (v = var; v; v = v->next) {
if (!strcasecmp(v->name, "active")) {