summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/asterisk.c8
-rw-r--r--main/config.c10
-rw-r--r--main/manager.c7
-rw-r--r--main/pbx.c18
4 files changed, 38 insertions, 5 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 9cf309872..e5b117baf 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -649,10 +649,14 @@ int ast_safe_system(const char *s)
struct rusage rusage;
int status;
-#if HAVE_WORKING_FORK
- ast_replace_sigchld();
+#if defined(HAVE_WORKING_FORK) || defined(HAVE_WORKING_VFORK)
+ ast_replace_sigchld();
+#ifdef HAVE_WORKING_VFORK
+ pid = vfork();
+#else
pid = fork();
+#endif
if (pid == 0) {
if (ast_opt_high_priority)
diff --git a/main/config.c b/main/config.c
index ee3922a2a..6d88aebec 100644
--- a/main/config.c
+++ b/main/config.c
@@ -147,6 +147,16 @@ struct ast_variable *ast_variable_browse(const struct ast_config *config, const
return (cat) ? cat->root : NULL;
}
+char *ast_config_option(struct ast_config *cfg, const char *cat, const char *var)
+{
+ char *tmp;
+ tmp = ast_variable_retrieve(cfg, cat, var);
+ if (!tmp)
+ tmp = ast_variable_retrieve(cfg, "general", var);
+ return tmp;
+}
+
+
char *ast_variable_retrieve(const struct ast_config *config, const char *category, const char *variable)
{
struct ast_variable *v;
diff --git a/main/manager.c b/main/manager.c
index efa86401a..90719a0f9 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -947,6 +947,7 @@ static char mandescr_updateconfig[] =
"Variables (X's represent 6 digit number beginning with 000000):\n"
" SrcFilename: Configuration filename to read(e.g. foo.conf)\n"
" DstFilename: Configuration filename to write(e.g. foo.conf)\n"
+" Reload: Whether or not a reload should take place (or name of specific module)\n"
" Action-XXXXXX: Action to Take (NewCat,RenameCat,DelCat,Update,Delete,Append)\n"
" Cat-XXXXXX: Category to operate on\n"
" Var-XXXXXX: Variable to work on\n"
@@ -961,6 +962,7 @@ static int action_updateconfig(struct mansession *s, struct message *m)
int res;
char idText[256] = "";
char *id = astman_get_header(m, "ActionID");
+ char *rld = astman_get_header(m, "Reload");
if (!ast_strlen_zero(id))
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
@@ -981,6 +983,11 @@ static int action_updateconfig(struct mansession *s, struct message *m)
return 0;
}
astman_append(s, "Response: Success\r\n%s\r\n", idText);
+ if (!ast_strlen_zero(rld)) {
+ if (ast_true(rld))
+ rld = NULL;
+ ast_module_reload(rld);
+ }
return 0;
}
diff --git a/main/pbx.c b/main/pbx.c
index e875c8810..f07ac5875 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -3491,7 +3491,7 @@ int ast_unregister_application(const char *app)
return tmp ? 0 : -1;
}
-struct ast_context *ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar)
+static struct ast_context *__ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar, int existsokay)
{
struct ast_context *tmp, **local_contexts;
int length = sizeof(struct ast_context) + strlen(name) + 1;
@@ -3504,10 +3504,13 @@ struct ast_context *ast_context_create(struct ast_context **extcontexts, const c
for (tmp = *local_contexts; tmp; tmp = tmp->next) {
if (!strcasecmp(tmp->name, name)) {
- ast_log(LOG_WARNING, "Tried to register context '%s', already in use\n", name);
+ if (!existsokay) {
+ ast_log(LOG_WARNING, "Tried to register context '%s', already in use\n", name);
+ tmp = NULL;
+ }
if (!extcontexts)
ast_mutex_unlock(&conlock);
- return NULL;
+ return tmp;
}
}
if ((tmp = ast_calloc(1, length))) {
@@ -3531,6 +3534,15 @@ struct ast_context *ast_context_create(struct ast_context **extcontexts, const c
return tmp;
}
+struct ast_context *ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar)
+{
+ return __ast_context_create(extcontexts, name, registrar, 0);
+}
+
+struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, const char *name, const char *registrar)
+{
+ return __ast_context_create(extcontexts, name, registrar, 1);
+}
void __ast_context_destroy(struct ast_context *con, const char *registrar);
struct store_hint {