diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-08-16 21:09:46 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-08-16 21:09:46 +0000 |
commit | dbec3d56c146801fad339a1d46a388865b18ffb4 (patch) | |
tree | 8fda811f62cb6ffb99847befb7b74b1519ea95ba /apps | |
parent | 0fb9c73a989207650aa3ba603824e4593809611b (diff) |
Don't reload a configuration file if nothing has changed.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@79747 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_alarmreceiver.c | 3 | ||||
-rw-r--r-- | apps/app_amd.c | 12 | ||||
-rw-r--r-- | apps/app_directory.c | 9 | ||||
-rw-r--r-- | apps/app_festival.c | 6 | ||||
-rw-r--r-- | apps/app_followme.c | 12 | ||||
-rw-r--r-- | apps/app_meetme.c | 15 | ||||
-rw-r--r-- | apps/app_minivm.c | 12 | ||||
-rw-r--r-- | apps/app_osplookup.c | 16 | ||||
-rw-r--r-- | apps/app_playback.c | 10 | ||||
-rw-r--r-- | apps/app_privacy.c | 3 | ||||
-rw-r--r-- | apps/app_queue.c | 12 | ||||
-rw-r--r-- | apps/app_rpt.c | 6 | ||||
-rw-r--r-- | apps/app_voicemail.c | 42 |
13 files changed, 105 insertions, 53 deletions
diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c index b48c8dba3..194a33237 100644 --- a/apps/app_alarmreceiver.c +++ b/apps/app_alarmreceiver.c @@ -714,10 +714,11 @@ static int load_config(void) { struct ast_config *cfg; const char *p; + struct ast_flags config_flags = { 0 }; /* Read in the config file */ - cfg = ast_config_load(ALMRCV_CONFIG); + cfg = ast_config_load(ALMRCV_CONFIG, config_flags); if(!cfg){ diff --git a/apps/app_amd.c b/apps/app_amd.c index 2d88dd861..dea61fffe 100644 --- a/apps/app_amd.c +++ b/apps/app_amd.c @@ -317,16 +317,18 @@ static int amd_exec(struct ast_channel *chan, void *data) return 0; } -static void load_config(void) +static void load_config(int reload) { struct ast_config *cfg = NULL; char *cat = NULL; struct ast_variable *var = NULL; + struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; - if (!(cfg = ast_config_load("amd.conf"))) { + if (!(cfg = ast_config_load("amd.conf", config_flags))) { ast_log(LOG_ERROR, "Configuration file amd.conf missing.\n"); return; - } + } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) + return; cat = ast_category_browse(cfg, NULL); @@ -377,13 +379,13 @@ static int unload_module(void) static int load_module(void) { - load_config(); + load_config(0); return ast_register_application(app, amd_exec, synopsis, descrip); } static int reload(void) { - load_config(); + load_config(1); return 0; } diff --git a/apps/app_directory.c b/apps/app_directory.c index 4564014ef..896f9cbe1 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -364,9 +364,10 @@ static struct ast_config *realtime_directory(char *context) const char *fullname; const char *hidefromdir; char tmp[100]; + struct ast_flags config_flags = { 0 }; /* Load flat file config. */ - cfg = ast_config_load(VOICEMAIL_CONFIG); + cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags); if (!cfg) { /* Loading config failed. */ @@ -597,6 +598,7 @@ static int directory_exec(struct ast_channel *chan, void *data) int fromappvm = 0; const char *dirintro; char *parse; + struct ast_flags config_flags = { 0 }; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(vmcontext); AST_APP_ARG(dialcontext); @@ -630,7 +632,7 @@ static int directory_exec(struct ast_channel *chan, void *data) return -1; } - ucfg = ast_config_load("users.conf"); + ucfg = ast_config_load("users.conf", config_flags); dirintro = ast_variable_retrieve(cfg, args.vmcontext, "directoryintro"); if (ast_strlen_zero(dirintro)) @@ -674,7 +676,8 @@ static int unload_module(void) static int load_module(void) { #ifdef ODBC_STORAGE - struct ast_config *cfg = ast_config_load(VOICEMAIL_CONFIG); + struct ast_flags config_flags = { 0 }; + struct ast_config *cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags); const char *tmp; if (cfg) { diff --git a/apps/app_festival.c b/apps/app_festival.c index 60950ad75..b6097be87 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -306,6 +306,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata) char *data; struct ast_config *cfg; char *newfestivalcommand; + struct ast_flags config_flags = { 0 }; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(text); AST_APP_ARG(interrupt); @@ -316,7 +317,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata) return -1; } - cfg = ast_config_load(FESTIVAL_CONFIG); + cfg = ast_config_load(FESTIVAL_CONFIG, config_flags); if (!cfg) { ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG); return -1; @@ -520,7 +521,8 @@ static int unload_module(void) static int load_module(void) { - struct ast_config *cfg = ast_config_load(FESTIVAL_CONFIG); + struct ast_flags config_flags = { 0 }; + struct ast_config *cfg = ast_config_load(FESTIVAL_CONFIG, config_flags); if (!cfg) { ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG); return AST_MODULE_LOAD_DECLINE; diff --git a/apps/app_followme.c b/apps/app_followme.c index f81472e6d..1a697e526 100644 --- a/apps/app_followme.c +++ b/apps/app_followme.c @@ -275,7 +275,7 @@ static struct number *create_followme_number(char *number, int timeout, int numo } /*! \brief Reload followme application module */ -static int reload_followme(void) +static int reload_followme(int reload) { struct call_followme *f; struct ast_config *cfg; @@ -289,11 +289,13 @@ static int reload_followme(void) const char *takecallstr; const char *declinecallstr; const char *tmpstr; + struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; - if (!(cfg = ast_config_load("followme.conf"))) { + if (!(cfg = ast_config_load("followme.conf", config_flags))) { ast_log(LOG_WARNING, "No follow me config file (followme.conf), so no follow me\n"); return 0; - } + } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) + return 0; AST_RWLIST_WRLOCK(&followmes); @@ -1051,7 +1053,7 @@ static int unload_module(void) static int load_module(void) { - if(!reload_followme()) + if(!reload_followme(0)) return AST_MODULE_LOAD_DECLINE; return ast_register_application(app, app_exec, synopsis, descrip); @@ -1059,7 +1061,7 @@ static int load_module(void) static int reload(void) { - reload_followme(); + reload_followme(1); return 0; } diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 5a0745311..e4f487ae6 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -2407,6 +2407,7 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno, { struct ast_config *cfg; struct ast_variable *var; + struct ast_flags config_flags = { 0 }; struct ast_conference *cnf; char *parse; AST_DECLARE_APP_ARGS(args, @@ -2444,7 +2445,7 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno, } } else { /* Check the config */ - cfg = ast_config_load(CONFIG_FILE_NAME); + cfg = ast_config_load(CONFIG_FILE_NAME, config_flags); if (!cfg) { ast_log(LOG_WARNING, "No %s file :(\n", CONFIG_FILE_NAME); return NULL; @@ -2551,7 +2552,7 @@ static int conf_exec(struct ast_channel *chan, void *data) int allowretry = 0; int retrycnt = 0; struct ast_conference *cnf = NULL; - struct ast_flags confflags = {0}; + struct ast_flags confflags = {0}, config_flags = { 0 }; int dynamic = 0; int empty = 0, empty_no_pin = 0; int always_prompt = 0; @@ -2609,7 +2610,7 @@ static int conf_exec(struct ast_channel *chan, void *data) /* We only need to load the config file for static and empty_no_pin (otherwise we don't care) */ if ((empty_no_pin) || (!dynamic)) { - cfg = ast_config_load(CONFIG_FILE_NAME); + cfg = ast_config_load(CONFIG_FILE_NAME, config_flags); if (cfg) { var = ast_variable_browse(cfg, "rooms"); while (var) { @@ -3174,11 +3175,12 @@ static enum ast_device_state meetmestate(const char *data) static void load_config_meetme(void) { struct ast_config *cfg; + struct ast_flags config_flags = { 0 }; const char *val; audio_buffers = DEFAULT_AUDIO_BUFFERS; - if (!(cfg = ast_config_load(CONFIG_FILE_NAME))) + if (!(cfg = ast_config_load(CONFIG_FILE_NAME, config_flags))) return; if ((val = ast_variable_retrieve(cfg, "general", "audiobuffers"))) { @@ -4894,6 +4896,7 @@ static int sla_build_station(struct ast_config *cfg, const char *cat) static int sla_load_config(int reload) { struct ast_config *cfg; + struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; const char *cat = NULL; int res = 0; const char *val; @@ -4903,8 +4906,10 @@ static int sla_load_config(int reload) ast_cond_init(&sla.cond, NULL); } - if (!(cfg = ast_config_load(SLA_CONFIG_FILE))) + if (!(cfg = ast_config_load(SLA_CONFIG_FILE, config_flags))) return 0; /* Treat no config as normal */ + else if (cfg == CONFIG_STATUS_FILEUNCHANGED) + return 0; if ((val = ast_variable_retrieve(cfg, "general", "attemptcallerid"))) sla.attempt_callerid = ast_true(val); diff --git a/apps/app_minivm.c b/apps/app_minivm.c index a868bac83..1841e5267 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -2349,7 +2349,7 @@ static int apply_general_options(struct ast_variable *var) } /*! \brief Load minivoicemail configuration */ -static int load_config(void) +static int load_config(int reload) { struct ast_config *cfg; struct ast_variable *var; @@ -2357,8 +2357,12 @@ static int load_config(void) const char *chanvar; int error = 0; struct minivm_template *template; + struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; + + cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags); + if (cfg == CONFIG_STATUS_FILEUNCHANGED) + return 0; - cfg = ast_config_load(VOICEMAIL_CONFIG); ast_mutex_lock(&minivmlock); /* Destroy lists to reconfigure */ @@ -3039,7 +3043,7 @@ static int load_module(void) if (res) return(res); - if ((res = load_config())) + if ((res = load_config(0))) return(res); ast_cli_register_multiple(cli_minivm, sizeof(cli_minivm)/sizeof(cli_minivm[0])); @@ -3053,7 +3057,7 @@ static int load_module(void) /*! \brief Reload mini voicemail module */ static int reload(void) { - return(load_config()); + return(load_config(1)); } /*! \brief Reload cofiguration */ diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c index 3e7f9b2b3..25b3fb518 100644 --- a/apps/app_osplookup.c +++ b/apps/app_osplookup.c @@ -1773,15 +1773,22 @@ static int ospfinished_exec( /* OSP Module APIs */ -static int osp_load(void) +static int osp_unload(void); +static int osp_load(int reload) { const char* t; unsigned int v; struct ast_config* cfg; + struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; int error = OSPC_ERR_NO_ERROR; - cfg = ast_config_load(OSP_CONFIG_FILE); + if ((cfg = ast_config_load(OSP_CONFIG_FILE, config_flags)) == CONFIG_STATUS_FILEUNCHANGED) + return 0; + if (cfg) { + if (reload) + osp_unload(); + t = ast_variable_retrieve(cfg, OSP_GENERAL_CAT, "accelerate"); if (t && ast_true(t)) { if ((error = OSPPInit(1)) != OSPC_ERR_NO_ERROR) { @@ -2000,7 +2007,7 @@ static int load_module(void) { int res; - if(!osp_load()) + if (!osp_load(0)) return AST_MODULE_LOAD_DECLINE; ast_cli_register_multiple(cli_osp, sizeof(cli_osp) / sizeof(struct ast_cli_entry)); @@ -2028,8 +2035,7 @@ static int unload_module(void) static int reload(void) { - osp_unload(); - osp_load(); + osp_load(1); return 0; } diff --git a/apps/app_playback.c b/apps/app_playback.c index d39d25c0a..db9e0e1f8 100644 --- a/apps/app_playback.c +++ b/apps/app_playback.c @@ -470,12 +470,17 @@ done: static int reload(void) { struct ast_variable *v; + struct ast_flags config_flags = { CONFIG_FLAG_FILEUNCHANGED }; + struct ast_config *newcfg; + + if ((newcfg = ast_config_load("say.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) + return 0; if (say_cfg) { ast_config_destroy(say_cfg); ast_log(LOG_NOTICE, "Reloading say.conf\n"); + say_cfg = newcfg; } - say_cfg = ast_config_load("say.conf"); if (say_cfg) { for (v = ast_variable_browse(say_cfg, "general"); v ; v = v->next) { @@ -510,8 +515,9 @@ static int unload_module(void) static int load_module(void) { struct ast_variable *v; + struct ast_flags config_flags = { 0 }; - say_cfg = ast_config_load("say.conf"); + say_cfg = ast_config_load("say.conf", config_flags); if (say_cfg) { for (v = ast_variable_browse(say_cfg, "general"); v ; v = v->next) { if (ast_extension_match(v->name, "mode")) { diff --git a/apps/app_privacy.c b/apps/app_privacy.c index cf3d6371f..e470b9ed0 100644 --- a/apps/app_privacy.c +++ b/apps/app_privacy.c @@ -83,6 +83,7 @@ static int privacy_exec (struct ast_channel *chan, void *data) char phone[30]; struct ast_config *cfg = NULL; char *parse = NULL; + struct ast_flags config_flags = { 0 }; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(maxretries); AST_APP_ARG(minlength); @@ -122,7 +123,7 @@ static int privacy_exec (struct ast_channel *chan, void *data) if (!x) { /*Read in the config file*/ - cfg = ast_config_load(PRIV_CONFIG); + cfg = ast_config_load(PRIV_CONFIG, config_flags); if (cfg && (s = ast_variable_retrieve(cfg, "general", "maxretries"))) { if (sscanf(s, "%d", &x) == 1) diff --git a/apps/app_queue.c b/apps/app_queue.c index d571dc354..1908454da 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -3947,7 +3947,7 @@ static struct ast_custom_function queuememberlist_function = { .read = queue_function_queuememberlist, }; -static int reload_queues(void) +static int reload_queues(int reload) { struct call_queue *q; struct ast_config *cfg; @@ -3960,16 +3960,18 @@ static int reload_queues(void) char *interface; char *membername; int penalty; + struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(interface); AST_APP_ARG(penalty); AST_APP_ARG(membername); ); - if (!(cfg = ast_config_load("queues.conf"))) { + if (!(cfg = ast_config_load("queues.conf", config_flags))) { ast_log(LOG_NOTICE, "No call queueing config file (queues.conf), so no call queues\n"); return 0; - } + } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) + return 0; AST_LIST_LOCK(&queues); use_weight=0; /* Mark all queues as dead for the moment */ @@ -4766,7 +4768,7 @@ static int load_module(void) int res; struct ast_context *con; - if (!reload_queues()) + if (!reload_queues(0)) return AST_MODULE_LOAD_DECLINE; con = ast_context_find("app_queue_gosub_virtual_context"); @@ -4810,7 +4812,7 @@ static int load_module(void) static int reload(void) { - reload_queues(); + reload_queues(1); return 0; } diff --git a/apps/app_rpt.c b/apps/app_rpt.c index ad38de179..77e4ee4ef 100644 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -918,6 +918,7 @@ static void load_rpt_vars(int n, int init) int j; struct ast_variable *vp, *var; struct ast_config *cfg; + struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE }; #ifdef __RPT_NOTCH AST_DECLARE_APP_ARGS(strs, AST_APP_ARG(str)[100]; @@ -929,7 +930,7 @@ static void load_rpt_vars(int n, int init) ast_mutex_lock(&rpt_vars[n].lock); if (rpt_vars[n].cfg) ast_config_destroy(rpt_vars[n].cfg); - cfg = ast_config_load("rpt.conf"); + cfg = ast_config_load("rpt.conf", config_flags); if (!cfg) { ast_mutex_unlock(&rpt_vars[n].lock); ast_log(LOG_NOTICE, "Unable to open radio repeater configuration rpt.conf. Radio Repeater disabled.\n"); @@ -7437,7 +7438,8 @@ static int unload_module(void) static int load_module(void) { - struct ast_config *cfg = ast_config_load("rpt.conf"); + struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE }; + struct ast_config *cfg = ast_config_load("rpt.conf", config_flags); if (!cfg) { ast_log(LOG_WARNING, "No such configuration file rpt.conf\n"); return AST_MODULE_LOAD_DECLINE; diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index c2e8afdac..752d2a8be 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -260,7 +260,7 @@ AST_APP_OPTIONS(vm_app_options, { AST_APP_OPTION_ARG('a', OPT_AUTOPLAY, OPT_ARG_PLAYFOLDER), }); -static int load_config(void); +static int load_config(int reload); /*! \page vmlang Voicemail Language Syntaxes Supported @@ -911,12 +911,13 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword) struct ast_category *cat=NULL; char *category=NULL, *value=NULL, *new=NULL; const char *tmp=NULL; + struct ast_flags config_flags = { CONFIG_FLAG_WITHCOMMENTS }; if (!change_password_realtime(vmu, newpassword)) return; /* check voicemail.conf */ - if ((cfg = ast_config_load_with_comments(VOICEMAIL_CONFIG))) { + if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags))) { while ((category = ast_category_browse(cfg, category))) { if (!strcasecmp(category, vmu->context)) { if (!(tmp = ast_variable_retrieve(cfg, category, vmu->mailbox))) { @@ -946,7 +947,7 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword) var = NULL; /* check users.conf and update the password stored for the mailbox*/ /* if no vmsecret entry exists create one. */ - if ((cfg = ast_config_load_with_comments("users.conf"))) { + if ((cfg = ast_config_load("users.conf", config_flags))) { ast_debug(4, "we are looking for %s\n", vmu->mailbox); while ((category = ast_category_browse(cfg, category))) { ast_debug(4, "users.conf: %s\n", category); @@ -1427,6 +1428,7 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms const char *category = ""; struct ast_config *cfg=NULL; struct odbc_obj *obj; + struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE }; delete_file(dir, msgnum); obj = ast_odbc_request_obj(odbc_database, 0); @@ -1443,7 +1445,7 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms else ast_copy_string(fn, dir, sizeof(fn)); snprintf(full_fn, sizeof(full_fn), "%s.txt", fn); - cfg = ast_config_load(full_fn); + cfg = ast_config_load(full_fn, config_flags); snprintf(full_fn, sizeof(full_fn), "%s.%s", fn, fmt); fd = open(full_fn, O_RDWR); if (fd < 0) { @@ -3975,6 +3977,7 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu, int cmd = 0; int retries = 0; signed char zero_gain = 0; + struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE }; while ((cmd >= 0) && (cmd != 't') && (cmd != '*')) { if (cmd) @@ -3995,7 +3998,7 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu, *duration = 0; /* if we can't read the message metadata, stop now */ - if (!(msg_cfg = ast_config_load(textfile))) { + if (!(msg_cfg = ast_config_load(textfile, config_flags))) { cmd = 0; break; } @@ -4733,6 +4736,7 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc char filename[256], *cid; const char *origtime, *context, *category, *duration; struct ast_config *msg_cfg; + struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE }; vms->starting = 0; make_file(vms->fn, sizeof(vms->fn), vms->curdir, vms->curmsg); @@ -4782,7 +4786,7 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc make_file(vms->fn2, sizeof(vms->fn2), vms->curdir, vms->curmsg); snprintf(filename, sizeof(filename), "%s.txt", vms->fn2); RETRIEVE(vms->curdir, vms->curmsg, vmu->mailbox, vmu->context); - msg_cfg = ast_config_load(filename); + msg_cfg = ast_config_load(filename, config_flags); if (!msg_cfg) { ast_log(LOG_WARNING, "No message attribute file?!! (%s)\n", filename); return 0; @@ -7850,7 +7854,7 @@ static int manager_list_voicemail_users(struct mansession *s, const struct messa return RESULT_SUCCESS; } -static int load_config(void) +static int load_config(int reload) { struct ast_vm_user *cur; struct vm_zone *zcur; @@ -7863,6 +7867,17 @@ static int load_config(void) char *q, *stringp; int x; int tmpadsi[4]; + struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; + + if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags)) == CONFIG_STATUS_FILEUNCHANGED) { + if ((ucfg = ast_config_load("users.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) + return 0; + ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED); + cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags); + } else { + ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED); + ucfg = ast_config_load("users.conf", config_flags); + } /* set audio control prompts */ strcpy(listen_control_forward_key,DEFAULT_LISTEN_CONTROL_FORWARD_KEY); @@ -7871,8 +7886,6 @@ static int load_config(void) strcpy(listen_control_restart_key,DEFAULT_LISTEN_CONTROL_RESTART_KEY); strcpy(listen_control_stop_key,DEFAULT_LISTEN_CONTROL_STOP_KEY); - cfg = ast_config_load(VOICEMAIL_CONFIG); - AST_LIST_LOCK(&users); while ((cur = AST_LIST_REMOVE_HEAD(&users, list))) { ast_set_flag(cur, VM_ALLOCED); @@ -8259,7 +8272,7 @@ static int load_config(void) if ((val = ast_variable_retrieve(cfg, "general", "pollmailboxes"))) poll_mailboxes = ast_true(val); - if ((ucfg = ast_config_load("users.conf"))) { + if (ucfg) { for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) { if (!ast_true(ast_config_option(ucfg, cat, "hasvoicemail"))) continue; @@ -8427,13 +8440,15 @@ static int load_config(void) } else { AST_LIST_UNLOCK(&users); ast_log(LOG_WARNING, "Failed to load configuration file.\n"); + if (ucfg) + ast_config_destroy(ucfg); return 0; } } static int reload(void) { - return load_config(); + return load_config(1); } static int unload_module(void) @@ -8464,7 +8479,7 @@ static int load_module(void) /* compute the location of the voicemail spool directory */ snprintf(VM_SPOOL_DIR, sizeof(VM_SPOOL_DIR), "%s/voicemail/", ast_config_AST_SPOOL_DIR); - if ((res = load_config())) + if ((res = load_config(0))) return res; res = ast_register_application(app, vm_exec, synopsis_vm, descrip_vm); @@ -8555,6 +8570,7 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s const char *origtime, *context; char *cid, *name, *num; int retries = 0; + struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE }; vms->starting = 0; #ifdef IMAP_STORAGE @@ -8605,7 +8621,7 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s make_file(vms->fn2, sizeof(vms->fn2), vms->curdir, vms->curmsg); snprintf(filename,sizeof(filename), "%s.txt", vms->fn2); RETRIEVE(vms->curdir, vms->curmsg, vmu->mailbox, vmu->context); - msg_cfg = ast_config_load(filename); + msg_cfg = ast_config_load(filename, config_flags); DISPOSE(vms->curdir, vms->curmsg); if (!msg_cfg) { ast_log(LOG_WARNING, "No message attribute file?!! (%s)\n", filename); |