diff --git a/main/features.c b/main/features.c index 987a9ddefb..cf08c68aba 100644 --- a/main/features.c +++ b/main/features.c @@ -4857,6 +4857,17 @@ static int load_config(void) "applicationmap" }; + /* Clear the existing parkinglots in the parkinglots container. */ + { + struct ast_parkinglot *p; + struct ao2_iterator iter = ao2_iterator_init(parkinglots, 0); + while ((p = ao2_iterator_next(&iter))) { + ao2_unlink(parkinglots, p); + ao2_ref(p,-1); + } + ao2_iterator_destroy(&iter); + } + default_parkinglot = build_parkinglot(DEFAULT_PARKINGLOT, NULL); if (default_parkinglot) { ao2_lock(default_parkinglot); @@ -4906,7 +4917,19 @@ static int load_config(void) ast_log(LOG_WARNING,"Could not load features.conf\n"); return 0; } - for (var = ast_variable_browse(cfg, "general"); var; var = var->next) { + + if ((var = ast_variable_browse(cfg, "general"))) { + /* Find a general context in features.conf, we need to clear our existing default context */ + /* Can't outright destroy the parking lot because it's needed in a little while. */ + if ((con = ast_context_find(default_parkinglot->parking_con))) { + ast_context_destroy(con, registrar); + } + if ((con = ast_context_find(default_parkinglot->parking_con_dial))) { + ast_context_destroy(con, registrar); + } + } + + for (; var; var = var->next) { if (!strcasecmp(var->name, "parkext")) { ast_copy_string(default_parkinglot->parkext, var->value, sizeof(default_parkinglot->parkext)); } else if (!strcasecmp(var->name, "context")) {