[svn-commits] tilghman: branch tilghman/config_mtime_cache r79506 - in /team/tilghman/confi...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Aug 14 23:35:33 CDT 2007
Author: tilghman
Date: Tue Aug 14 23:35:32 2007
New Revision: 79506
URL: http://svn.digium.com/view/asterisk?view=rev&rev=79506
Log:
Convert the rest of the files and also permit no attempted caching (like for voicemail meta files)
Modified:
team/tilghman/config_mtime_cache/apps/app_alarmreceiver.c
team/tilghman/config_mtime_cache/apps/app_amd.c
team/tilghman/config_mtime_cache/apps/app_directory.c
team/tilghman/config_mtime_cache/apps/app_festival.c
team/tilghman/config_mtime_cache/apps/app_followme.c
team/tilghman/config_mtime_cache/apps/app_minivm.c
team/tilghman/config_mtime_cache/apps/app_playback.c
team/tilghman/config_mtime_cache/apps/app_privacy.c
team/tilghman/config_mtime_cache/apps/app_queue.c
team/tilghman/config_mtime_cache/apps/app_voicemail.c
team/tilghman/config_mtime_cache/cdr/cdr_adaptive_odbc.c
team/tilghman/config_mtime_cache/cdr/cdr_csv.c
team/tilghman/config_mtime_cache/cdr/cdr_custom.c
team/tilghman/config_mtime_cache/cdr/cdr_manager.c
team/tilghman/config_mtime_cache/cdr/cdr_odbc.c
team/tilghman/config_mtime_cache/cdr/cdr_tds.c
team/tilghman/config_mtime_cache/channels/chan_agent.c
team/tilghman/config_mtime_cache/channels/chan_h323.c
team/tilghman/config_mtime_cache/channels/chan_iax2.c
team/tilghman/config_mtime_cache/channels/chan_mgcp.c
team/tilghman/config_mtime_cache/channels/chan_sip.c
team/tilghman/config_mtime_cache/channels/chan_skinny.c
team/tilghman/config_mtime_cache/channels/chan_zap.c
team/tilghman/config_mtime_cache/channels/iax2-provision.c
team/tilghman/config_mtime_cache/codecs/codec_adpcm.c
team/tilghman/config_mtime_cache/codecs/codec_alaw.c
team/tilghman/config_mtime_cache/codecs/codec_g722.c
team/tilghman/config_mtime_cache/codecs/codec_g726.c
team/tilghman/config_mtime_cache/codecs/codec_gsm.c
team/tilghman/config_mtime_cache/codecs/codec_lpc10.c
team/tilghman/config_mtime_cache/codecs/codec_ulaw.c
team/tilghman/config_mtime_cache/funcs/func_odbc.c
team/tilghman/config_mtime_cache/include/asterisk/config.h
team/tilghman/config_mtime_cache/main/asterisk.c
team/tilghman/config_mtime_cache/main/cdr.c
team/tilghman/config_mtime_cache/main/config.c
team/tilghman/config_mtime_cache/main/dnsmgr.c
team/tilghman/config_mtime_cache/main/enum.c
team/tilghman/config_mtime_cache/main/http.c
team/tilghman/config_mtime_cache/main/loader.c
team/tilghman/config_mtime_cache/main/logger.c
team/tilghman/config_mtime_cache/main/manager.c
team/tilghman/config_mtime_cache/main/rtp.c
team/tilghman/config_mtime_cache/main/udptl.c
team/tilghman/config_mtime_cache/pbx/pbx_config.c
team/tilghman/config_mtime_cache/res/res_indications.c
team/tilghman/config_mtime_cache/res/res_musiconhold.c
team/tilghman/config_mtime_cache/res/res_odbc.c
team/tilghman/config_mtime_cache/res/res_smdi.c
Modified: team/tilghman/config_mtime_cache/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/apps/app_alarmreceiver.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/apps/app_alarmreceiver.c (original)
+++ team/tilghman/config_mtime_cache/apps/app_alarmreceiver.c Tue Aug 14 23:35:32 2007
@@ -714,10 +714,11 @@
{
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){
Modified: team/tilghman/config_mtime_cache/apps/app_amd.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/apps/app_amd.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/apps/app_amd.c (original)
+++ team/tilghman/config_mtime_cache/apps/app_amd.c Tue Aug 14 23:35:32 2007
@@ -317,16 +317,18 @@
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;
-
- if (!(cfg = ast_config_load("amd.conf"))) {
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+
+ 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 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;
}
Modified: team/tilghman/config_mtime_cache/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/apps/app_directory.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/apps/app_directory.c (original)
+++ team/tilghman/config_mtime_cache/apps/app_directory.c Tue Aug 14 23:35:32 2007
@@ -364,9 +364,10 @@
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 @@
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 @@
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))
Modified: team/tilghman/config_mtime_cache/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/apps/app_festival.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/apps/app_festival.c (original)
+++ team/tilghman/config_mtime_cache/apps/app_festival.c Tue Aug 14 23:35:32 2007
@@ -306,6 +306,7 @@
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 @@
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 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;
Modified: team/tilghman/config_mtime_cache/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/apps/app_followme.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/apps/app_followme.c (original)
+++ team/tilghman/config_mtime_cache/apps/app_followme.c Tue Aug 14 23:35:32 2007
@@ -275,7 +275,7 @@
}
/*! \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 @@
const char *takecallstr;
const char *declinecallstr;
const char *tmpstr;
-
- if (!(cfg = ast_config_load("followme.conf"))) {
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+
+ 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 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 reload(void)
{
- reload_followme();
+ reload_followme(1);
return 0;
}
Modified: team/tilghman/config_mtime_cache/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/apps/app_minivm.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/apps/app_minivm.c (original)
+++ team/tilghman/config_mtime_cache/apps/app_minivm.c Tue Aug 14 23:35:32 2007
@@ -2349,7 +2349,7 @@
}
/*! \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 @@
const char *chanvar;
int error = 0;
struct minivm_template *template;
-
- cfg = ast_config_load(VOICEMAIL_CONFIG);
+ 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;
+
ast_mutex_lock(&minivmlock);
/* Destroy lists to reconfigure */
@@ -3039,7 +3043,7 @@
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 @@
/*! \brief Reload mini voicemail module */
static int reload(void)
{
- return(load_config());
+ return(load_config(1));
}
/*! \brief Reload cofiguration */
Modified: team/tilghman/config_mtime_cache/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/apps/app_playback.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/apps/app_playback.c (original)
+++ team/tilghman/config_mtime_cache/apps/app_playback.c Tue Aug 14 23:35:32 2007
@@ -470,12 +470,17 @@
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 = ast_config_load("say.conf");
+ say_cfg = newcfg;
+ }
if (say_cfg) {
for (v = ast_variable_browse(say_cfg, "general"); v ; v = v->next) {
@@ -510,8 +515,9 @@
static int load_module(void)
{
struct ast_variable *v;
-
- say_cfg = ast_config_load("say.conf");
+ struct ast_flags config_flags = { 0 };
+
+ 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")) {
Modified: team/tilghman/config_mtime_cache/apps/app_privacy.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/apps/app_privacy.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/apps/app_privacy.c (original)
+++ team/tilghman/config_mtime_cache/apps/app_privacy.c Tue Aug 14 23:35:32 2007
@@ -83,6 +83,7 @@
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 @@
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)
Modified: team/tilghman/config_mtime_cache/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/apps/app_queue.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/apps/app_queue.c (original)
+++ team/tilghman/config_mtime_cache/apps/app_queue.c Tue Aug 14 23:35:32 2007
@@ -3947,7 +3947,7 @@
.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 @@
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 @@
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 reload(void)
{
- reload_queues();
+ reload_queues(1);
return 0;
}
Modified: team/tilghman/config_mtime_cache/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/apps/app_voicemail.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/apps/app_voicemail.c (original)
+++ team/tilghman/config_mtime_cache/apps/app_voicemail.c Tue Aug 14 23:35:32 2007
@@ -260,7 +260,7 @@
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
@@ -1427,6 +1427,7 @@
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 +1444,7 @@
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 +3976,7 @@
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 +3997,7 @@
*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 +4735,7 @@
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 +4785,7 @@
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;
@@ -7847,7 +7850,7 @@
return RESULT_SUCCESS;
}
-static int load_config(void)
+static int load_config(int reload)
{
struct ast_vm_user *cur;
struct vm_zone *zcur;
@@ -7860,6 +7863,17 @@
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);
@@ -7868,8 +7882,6 @@
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);
@@ -8256,7 +8268,7 @@
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;
@@ -8424,13 +8436,15 @@
} 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)
@@ -8461,7 +8475,7 @@
/* 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);
@@ -8552,6 +8566,7 @@
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
@@ -8602,7 +8617,7 @@
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);
Modified: team/tilghman/config_mtime_cache/cdr/cdr_adaptive_odbc.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/cdr/cdr_adaptive_odbc.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/cdr/cdr_adaptive_odbc.c (original)
+++ team/tilghman/config_mtime_cache/cdr/cdr_adaptive_odbc.c Tue Aug 14 23:35:32 2007
@@ -95,8 +95,9 @@
SQLLEN sqlptr;
int res = 0;
SQLHSTMT stmt = NULL;
-
- cfg = ast_config_load(CONFIG);
+ struct ast_flags config_flags = { 0 }; /* Part of our config comes from the database */
+
+ cfg = ast_config_load(CONFIG, config_flags);
if (!cfg) {
ast_log(LOG_WARNING, "Unable to load " CONFIG ". No adaptive ODBC CDRs.\n");
return -1;
Modified: team/tilghman/config_mtime_cache/cdr/cdr_csv.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/cdr/cdr_csv.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/cdr/cdr_csv.c (original)
+++ team/tilghman/config_mtime_cache/cdr/cdr_csv.c Tue Aug 14 23:35:32 2007
@@ -95,22 +95,24 @@
static FILE *mf = NULL;
-static int load_config(void)
+static int load_config(int reload)
{
struct ast_config *cfg;
struct ast_variable *var;
const char *tmp;
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
usegmtime = 0;
loguniqueid = 0;
loguserfield = 0;
- cfg = ast_config_load(config);
+ cfg = ast_config_load(config, config_flags);
if (!cfg) {
ast_log(LOG_WARNING, "unable to load config: %s\n", config);
return 0;
- }
+ } else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+ return 0;
var = ast_variable_browse(cfg, "csv");
if (!var) {
@@ -316,7 +318,7 @@
{
int res;
- if(!load_config())
+ if(!load_config(0))
return AST_MODULE_LOAD_DECLINE;
res = ast_cdr_register(name, ast_module_info->description, csv_log);
@@ -330,7 +332,7 @@
static int reload(void)
{
- load_config();
+ load_config(1);
return 0;
}
Modified: team/tilghman/config_mtime_cache/cdr/cdr_custom.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/cdr/cdr_custom.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/cdr/cdr_custom.c (original)
+++ team/tilghman/config_mtime_cache/cdr/cdr_custom.c Tue Aug 14 23:35:32 2007
@@ -68,12 +68,16 @@
{
struct ast_config *cfg;
struct ast_variable *var;
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
int res = -1;
+
+ if ((cfg = ast_config_load("cdr_custom.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED)
+ return 0;
strcpy(format, "");
strcpy(master, "");
ast_mutex_lock(&lock);
- if((cfg = ast_config_load("cdr_custom.conf"))) {
+ if (cfg) {
var = ast_variable_browse(cfg, "mappings");
while(var) {
if (!ast_strlen_zero(var->name) && !ast_strlen_zero(var->value)) {
Modified: team/tilghman/config_mtime_cache/cdr/cdr_manager.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/cdr/cdr_manager.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/cdr/cdr_manager.c (original)
+++ team/tilghman/config_mtime_cache/cdr/cdr_manager.c Tue Aug 14 23:35:32 2007
@@ -52,15 +52,22 @@
static int enablecdr = 0;
struct ast_str *customfields;
-static int load_config(void)
+static int load_config(int reload)
{
char *cat = NULL;
struct ast_config *cfg;
struct ast_variable *v;
-
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+
+ cfg = ast_config_load(CONF_FILE, config_flags);
+ if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+ return 0;
+
+ if (reload && customfields) {
+ ast_free(customfields);
+ }
customfields = NULL;
- cfg = ast_config_load(CONF_FILE);
if (!cfg) {
/* Standard configuration */
ast_log(LOG_WARNING, "Failed to load configuration file. Module not activated.\n");
@@ -174,7 +181,7 @@
int res;
/* Configuration file */
- if (!load_config())
+ if (!load_config(0))
return AST_MODULE_LOAD_DECLINE;
res = ast_cdr_register(name, "Asterisk Manager Interface CDR Backend", manager_log);
@@ -187,12 +194,7 @@
static int reload(void)
{
- if (customfields) {
- ast_free(customfields);
- }
-
- load_config();
- return 0;
+ return load_config(1);
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk Manager Interface CDR Backend",
Modified: team/tilghman/config_mtime_cache/cdr/cdr_odbc.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/cdr/cdr_odbc.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/cdr/cdr_odbc.c (original)
+++ team/tilghman/config_mtime_cache/cdr/cdr_odbc.c Tue Aug 14 23:35:32 2007
@@ -226,123 +226,123 @@
return 0;
}
-static int odbc_load_module(void)
+static int odbc_load_module(int reload)
{
int res = 0;
struct ast_config *cfg;
struct ast_variable *var;
const char *tmp;
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
ast_mutex_lock(&odbc_lock);
- cfg = ast_config_load(config);
- if (!cfg) {
- ast_log(LOG_WARNING, "cdr_odbc: Unable to load config for ODBC CDR's: %s\n", config);
- res = AST_MODULE_LOAD_DECLINE;
- goto out;
- }
+ do {
+ cfg = ast_config_load(config, config_flags);
+ if (!cfg) {
+ ast_log(LOG_WARNING, "cdr_odbc: Unable to load config for ODBC CDR's: %s\n", config);
+ res = AST_MODULE_LOAD_DECLINE;
+ break;
+ } else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+ break;
- var = ast_variable_browse(cfg, "global");
- if (!var) {
- /* nothing configured */
- goto out;
- }
-
- tmp = ast_variable_retrieve(cfg,"global","dsn");
- if (tmp == NULL) {
- ast_log(LOG_WARNING,"cdr_odbc: dsn not specified. Assuming asteriskdb\n");
- tmp = "asteriskdb";
- }
- dsn = strdup(tmp);
- if (dsn == NULL) {
- ast_log(LOG_ERROR,"cdr_odbc: Out of memory error.\n");
- res = -1;
- goto out;
- }
-
- tmp = ast_variable_retrieve(cfg,"global","dispositionstring");
- if (tmp) {
- dispositionstring = ast_true(tmp);
- } else {
- dispositionstring = 0;
- }
-
- tmp = ast_variable_retrieve(cfg,"global","username");
- if (tmp) {
- username = strdup(tmp);
- if (username == NULL) {
- ast_log(LOG_ERROR,"cdr_odbc: Out of memory error.\n");
+ var = ast_variable_browse(cfg, "global");
+ if (!var) {
+ /* nothing configured */
+ break;
+ }
+
+ if ((tmp = ast_variable_retrieve(cfg, "global", "dsn")) == NULL) {
+ ast_log(LOG_WARNING, "cdr_odbc: dsn not specified. Assuming asteriskdb\n");
+ tmp = "asteriskdb";
+ }
+ if (dsn)
+ ast_free(dsn);
+ dsn = ast_strdup(tmp);
+ if (dsn == NULL) {
res = -1;
- goto out;
- }
- }
-
- tmp = ast_variable_retrieve(cfg,"global","password");
- if (tmp) {
- password = strdup(tmp);
- if (password == NULL) {
- ast_log(LOG_ERROR,"cdr_odbc: Out of memory error.\n");
+ break;
+ }
+
+ if ((tmp = ast_variable_retrieve(cfg, "global", "dispositionstring")))
+ dispositionstring = ast_true(tmp);
+ else
+ dispositionstring = 0;
+
+ if ((tmp = ast_variable_retrieve(cfg, "global", "username"))) {
+ if (username)
+ ast_free(username);
+ username = ast_strdup(tmp);
+ if (username == NULL) {
+ res = -1;
+ break;
+ }
+ }
+
+ if ((tmp = ast_variable_retrieve(cfg, "global", "password"))) {
+ if (password)
+ ast_free(password);
+ password = ast_strdup(tmp);
+ if (password == NULL) {
+ res = -1;
+ break;
+ }
+ }
+
+ if ((tmp = ast_variable_retrieve(cfg, "global", "loguniqueid"))) {
+ loguniqueid = ast_true(tmp);
+ if (loguniqueid) {
+ ast_debug(1, "cdr_odbc: Logging uniqueid\n");
+ } else {
+ ast_debug(1, "cdr_odbc: Not logging uniqueid\n");
+ }
+ } else {
+ ast_debug(1, "cdr_odbc: Not logging uniqueid\n");
+ loguniqueid = 0;
+ }
+
+ if ((tmp = ast_variable_retrieve(cfg, "global", "usegmtime"))) {
+ usegmtime = ast_true(tmp);
+ if (usegmtime) {
+ ast_debug(1, "cdr_odbc: Logging in GMT\n");
+ } else {
+ ast_debug(1, "cdr_odbc: Not logging in GMT\n");
+ }
+ } else {
+ ast_debug(1, "cdr_odbc: Not logging in GMT\n");
+ usegmtime = 0;
+ }
+
+ if ((tmp = ast_variable_retrieve(cfg, "global", "table")) == NULL) {
+ ast_log(LOG_WARNING, "cdr_odbc: table not specified. Assuming cdr\n");
+ tmp = "cdr";
+ }
+ if (table)
+ ast_free(table);
+ table = ast_strdup(tmp);
+ if (table == NULL) {
res = -1;
- goto out;
- }
- }
-
- tmp = ast_variable_retrieve(cfg,"global","loguniqueid");
- if (tmp) {
- loguniqueid = ast_true(tmp);
- if (loguniqueid) {
- ast_debug(1,"cdr_odbc: Logging uniqueid\n");
- } else {
- ast_debug(1,"cdr_odbc: Not logging uniqueid\n");
- }
- } else {
- ast_debug(1,"cdr_odbc: Not logging uniqueid\n");
- loguniqueid = 0;
- }
-
- tmp = ast_variable_retrieve(cfg,"global","usegmtime");
- if (tmp) {
- usegmtime = ast_true(tmp);
- if (usegmtime) {
- ast_debug(1,"cdr_odbc: Logging in GMT\n");
- } else {
- ast_debug(1,"cdr_odbc: Not logging in GMT\n");
- }
- } else {
- ast_debug(1,"cdr_odbc: Not logging in GMT\n");
- usegmtime = 0;
- }
-
- tmp = ast_variable_retrieve(cfg,"global","table");
- if (tmp == NULL) {
- ast_log(LOG_WARNING,"cdr_odbc: table not specified. Assuming cdr\n");
- tmp = "cdr";
- }
- table = strdup(tmp);
- if (table == NULL) {
- ast_log(LOG_ERROR,"cdr_odbc: Out of memory error.\n");
- res = -1;
- goto out;
- }
-
- ast_verb(3, "cdr_odbc: dsn is %s\n",dsn);
- if (username) {
- ast_verb(3, "cdr_odbc: username is %s\n",username);
- ast_verb(3, "cdr_odbc: password is [secret]\n");
- } else
- ast_verb(3, "cdr_odbc: retreiving username and password from odbc config\n");
- ast_verb(3, "cdr_odbc: table is %s\n",table);
-
- res = odbc_init();
- if (res < 0) {
- ast_log(LOG_ERROR, "cdr_odbc: Unable to connect to datasource: %s\n", dsn);
- ast_verb(3, "cdr_odbc: Unable to connect to datasource: %s\n", dsn);
- }
- res = ast_cdr_register(name, ast_module_info->description, odbc_log);
- if (res) {
- ast_log(LOG_ERROR, "cdr_odbc: Unable to register ODBC CDR handling\n");
- }
-out:
+ break;
+ }
+
+ ast_verb(3, "cdr_odbc: dsn is %s\n", dsn);
+ if (username) {
+ ast_verb(3, "cdr_odbc: username is %s\n", username);
+ ast_verb(3, "cdr_odbc: password is [secret]\n");
+ } else
+ ast_verb(3, "cdr_odbc: retrieving username and password from odbc config\n");
+ ast_verb(3, "cdr_odbc: table is %s\n", table);
+
+ res = odbc_init();
+ if (res < 0) {
+ ast_log(LOG_ERROR, "cdr_odbc: Unable to connect to datasource: %s\n", dsn);
+ ast_verb(3, "cdr_odbc: Unable to connect to datasource: %s\n", dsn);
+ }
+ res = ast_cdr_register(name, ast_module_info->description, odbc_log);
+ if (res) {
+ ast_log(LOG_ERROR, "cdr_odbc: Unable to register ODBC CDR handling\n");
+ }
+ } while (0);
+
if (cfg)
ast_config_destroy(cfg);
ast_mutex_unlock(&odbc_lock);
@@ -418,7 +418,7 @@
static int load_module(void)
{
- return odbc_load_module();
+ return odbc_load_module(0);
}
static int unload_module(void)
@@ -428,8 +428,7 @@
static int reload(void)
{
- odbc_unload_module();
- return odbc_load_module();
+ return odbc_load_module(1);
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "ODBC CDR Backend",
Modified: team/tilghman/config_mtime_cache/cdr/cdr_tds.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/cdr/cdr_tds.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/cdr/cdr_tds.c (original)
+++ team/tilghman/config_mtime_cache/cdr/cdr_tds.c Tue Aug 14 23:35:32 2007
@@ -422,95 +422,106 @@
return 0;
}
-static int tds_load_module(void)
+static int tds_load_module(int reload)
{
int res = 0;
struct ast_config *cfg;
struct ast_variable *var;
const char *ptr = NULL;
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
#ifdef FREETDS_PRE_0_62
TDS_INT result_type;
#endif
- cfg = ast_config_load(config);
+ cfg = ast_config_load(config, config_flags);
if (!cfg) {
ast_log(LOG_NOTICE, "Unable to load config for MSSQL CDR's: %s\n", config);
return 0;
- }
+ } else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+ return 0;
var = ast_variable_browse(cfg, "global");
if (!var) /* nothing configured */
return 0;
ptr = ast_variable_retrieve(cfg, "global", "hostname");
+ if (ptr) {
+ if (hostname)
+ ast_free(hostname);
+ hostname = ast_strdup(ptr);
+ } else
+ ast_log(LOG_ERROR, "Database server hostname not specified.\n");
+
+ ptr = ast_variable_retrieve(cfg, "global", "dbname");
+ if (ptr) {
+ if (dbname)
+ ast_free(dbname);
+ dbname = ast_strdup(ptr);
+ } else
+ ast_log(LOG_ERROR, "Database dbname not specified.\n");
+
+ ptr = ast_variable_retrieve(cfg, "global", "user");
+ if (ptr) {
+ if (dbuser)
+ ast_free(dbuser);
+ dbuser = ast_strdup(ptr);
+ } else
+ ast_log(LOG_ERROR, "Database dbuser not specified.\n");
+
+ ptr = ast_variable_retrieve(cfg, "global", "password");
+ if (ptr) {
+ if (password)
+ ast_free(password);
+ password = ast_strdup(ptr);
+ } else
+ ast_log(LOG_ERROR,"Database password not specified.\n");
+
+ ptr = ast_variable_retrieve(cfg, "global", "charset");
+ if (charset)
+ ast_free(charset);
if (ptr)
- hostname = strdup(ptr);
+ charset = ast_strdup(ptr);
else
- ast_log(LOG_ERROR,"Database server hostname not specified.\n");
-
- ptr = ast_variable_retrieve(cfg, "global", "dbname");
- if (ptr)
- dbname = strdup(ptr);
- else
- ast_log(LOG_ERROR,"Database dbname not specified.\n");
-
- ptr = ast_variable_retrieve(cfg, "global", "user");
- if (ptr)
- dbuser = strdup(ptr);
- else
- ast_log(LOG_ERROR,"Database dbuser not specified.\n");
-
- ptr = ast_variable_retrieve(cfg, "global", "password");
- if (ptr)
- password = strdup(ptr);
- else
- ast_log(LOG_ERROR,"Database password not specified.\n");
-
- ptr = ast_variable_retrieve(cfg, "global", "charset");
- if (ptr)
- charset = strdup(ptr);
- else
- charset = strdup("iso_1");
-
+ charset = ast_strdup("iso_1");
+
+ if (language)
+ ast_free(language);
ptr = ast_variable_retrieve(cfg, "global", "language");
if (ptr)
- language = strdup(ptr);
+ language = ast_strdup(ptr);
else
- language = strdup("us_english");
-
- ptr = ast_variable_retrieve(cfg,"global","table");
+ language = ast_strdup("us_english");
+
+ ptr = ast_variable_retrieve(cfg, "global", "table");
if (ptr == NULL) {
- ast_debug(1,"cdr_tds: table not specified. Assuming cdr\n");
+ ast_debug(1, "cdr_tds: table not specified. Assuming cdr\n");
ptr = "cdr";
}
- table = strdup(ptr);
+ if (table)
+ ast_free(table);
+ table = ast_strdup(ptr);
ast_config_destroy(cfg);
+ ast_mutex_lock(&tds_lock);
+ mssql_disconnect();
mssql_connect();
-
- /* Register MSSQL CDR handler */
- res = ast_cdr_register(name, ast_module_info->description, tds_log);
- if (res)
- {
- ast_log(LOG_ERROR, "Unable to register MSSQL CDR handling\n");
- }
+ ast_mutex_unlock(&tds_lock);
return res;
}
static int reload(void)
{
- tds_unload_module();
- return tds_load_module();
+ return tds_load_module(1);
}
static int load_module(void)
{
- if(!tds_load_module())
+ if (!tds_load_module(0))
return AST_MODULE_LOAD_DECLINE;
- else
- return AST_MODULE_LOAD_SUCCESS;
+ ast_cdr_register(name, ast_module_info->description, tds_log);
+ return AST_MODULE_LOAD_SUCCESS;
}
static int unload_module(void)
Modified: team/tilghman/config_mtime_cache/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/channels/chan_agent.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/channels/chan_agent.c (original)
+++ team/tilghman/config_mtime_cache/channels/chan_agent.c Tue Aug 14 23:35:32 2007
@@ -986,7 +986,7 @@
const char *catname;
const char *hasagent;
int genhasagent;
- struct ast_flags config_flags = { reload ? OPT_FILEUNCHANGED : 0 };
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
group = 0;
autologoff = 0;
@@ -997,7 +997,7 @@
if (!cfg) {
ast_log(LOG_NOTICE, "No agent configuration found -- agent support disabled\n");
return 0;
- } else if (cfg == FILEUNCHANGED)
+ } else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
return -1;
AST_LIST_LOCK(&agents);
AST_LIST_TRAVERSE(&agents, p, list) {
@@ -1083,7 +1083,7 @@
}
v = v->next;
}
- if ((ucfg = ast_config_load("users.conf", config_flags)) && ucfg != FILEUNCHANGED) {
+ if ((ucfg = ast_config_load("users.conf", config_flags)) && ucfg != CONFIG_STATUS_FILEUNCHANGED) {
genhasagent = ast_true(ast_variable_retrieve(ucfg, "general", "hasagent"));
catname = ast_category_browse(ucfg, NULL);
while(catname) {
Modified: team/tilghman/config_mtime_cache/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/channels/chan_h323.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/channels/chan_h323.c (original)
+++ team/tilghman/config_mtime_cache/channels/chan_h323.c Tue Aug 14 23:35:32 2007
@@ -2812,13 +2812,23 @@
int is_user, is_peer, is_alias;
char _gatekeeper[100];
int gk_discover, gk_disable, gk_changed;
-
- cfg = ast_config_load(config);
+ struct ast_flags config_flags = { is_reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+
+ cfg = ast_config_load(config, config_flags);
/* We *must* have a config file otherwise stop immediately */
if (!cfg) {
ast_log(LOG_NOTICE, "Unable to load config %s, H.323 disabled\n", config);
return 1;
+ } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
+ ucfg = ast_config_load("users.conf", config_flags);
+ if (ucfg == CONFIG_STATUS_FILEUNCHANGED)
+ return 0;
+ ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
+ cfg = ast_config_load(config, config_flags);
+ } else {
+ ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
+ ucfg = ast_config_load("users.conf", config_flags);
}
/* fire up the H.323 Endpoint */
@@ -2851,8 +2861,6 @@
/* Copy the default jb config over global_jbconf */
memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
- /* Load configuration from users.conf */
- ucfg = ast_config_load("users.conf");
if (ucfg) {
struct ast_variable *gen;
int genhas_h323;
Modified: team/tilghman/config_mtime_cache/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/config_mtime_cache/channels/chan_iax2.c?view=diff&rev=79506&r1=79505&r2=79506
==============================================================================
--- team/tilghman/config_mtime_cache/channels/chan_iax2.c (original)
+++ team/tilghman/config_mtime_cache/channels/chan_iax2.c Tue Aug 14 23:35:32 2007
@@ -9770,30 +9770,26 @@
struct iax2_user *user;
struct iax2_peer *peer;
struct ast_netsock *ns;
- struct ast_flags config_flags = { reload ? OPT_FILEUNCHANGED : 0 };
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
#if 0
static unsigned short int last_port=0;
#endif
- for (x = 0; x < 2; x++) {
+ cfg = ast_config_load(config_file, config_flags);
+
+ if (!cfg) {
+ ast_log(LOG_ERROR, "Unable to load config %s\n", config_file);
+ return -1;
+ } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
+ ucfg = ast_config_load("users.conf", config_flags);
+ if (ucfg == CONFIG_STATUS_FILEUNCHANGED)
+ return 0;
+ /* Otherwise we need to reread both files */
+ ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
cfg = ast_config_load(config_file, config_flags);
-
- if (!cfg) {
- ast_log(LOG_ERROR, "Unable to load config %s\n", config_file);
- return -1;
- } else if (cfg == FILEUNCHANGED) {
- ucfg = ast_config_load("users.conf", config_flags);
- if (ucfg == FILEUNCHANGED)
- return 0;
- /* Otherwise we need to reread both files */
- ast_config_destroy(ucfg);
- ast_clear_flag(&config_flags, OPT_FILEUNCHANGED);
- continue;
- } else { /* iax.conf changed, gotta reread users.conf, too */
- ast_clear_flag(&config_flags, OPT_FILEUNCHANGED);
- ucfg = ast_config_load("users.conf", config_flags);
- }
- break;
+ } else { /* iax.conf changed, gotta reread users.conf, too */
[... 1482 lines stripped ...]
More information about the svn-commits
mailing list