{
char filename[256];
struct ast_context *c;
- struct ast_config *cfg;
- struct ast_variable *var;
int context_header_written;
int incomplete = 0; /* incomplete config write? */
FILE *output;
return RESULT_FAILURE;
}
- /* Load old file first */
- cfg = ast_load(config);
-
/* have config path? */
if (argc == 3) {
/* is there extension.conf too? */
if (ast_lock_contexts()) {
ast_cli(fd, "Failed to lock contexts list\n");
ast_mutex_unlock(&save_dialplan_lock);
- if (cfg)
- ast_destroy(cfg);
return RESULT_FAILURE;
}
filename);
ast_unlock_contexts();
ast_mutex_unlock(&save_dialplan_lock);
- if (cfg)
- ast_destroy(cfg);
return RESULT_FAILURE;
}
static_config ? "yes" : "no",
write_protect_config ? "yes" : "no");
- var = ast_variable_walk(cfg, "globals");
- if (var) {
- fprintf(output, "[globals]\n");
- while(var) {
- fprintf(output, "%s => %s", var->name, var->value);
- var = var->next;
- }
- }
-
/* walk all contexts */
c = ast_walk_contexts(NULL);
while (c) {
ast_unlock_contexts();
ast_mutex_unlock(&save_dialplan_lock);
fclose(output);
- if (cfg)
- ast_destroy(cfg);
if (incomplete) {
ast_cli(fd, "Saved dialplan is incomplete\n");