[asterisk-addons-commits] tilghman: trunk r427 - in /trunk: ./ asterisk-ooh323c/src/
SVN commits to the Asterisk addons project
asterisk-addons-commits at lists.digium.com
Thu Aug 23 00:13:56 CDT 2007
Author: tilghman
Date: Thu Aug 23 00:13:54 2007
New Revision: 427
URL: http://svn.digium.com/view/asterisk-addons?view=rev&rev=427
Log:
Bring addons up to date with current trunk
Modified:
trunk/asterisk-ooh323c/src/chan_h323.c
trunk/asterisk-ooh323c/src/chan_h323.h
trunk/cdr_addon_mysql.c
trunk/res_config_mysql.c
Modified: trunk/asterisk-ooh323c/src/chan_h323.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/asterisk-ooh323c/src/chan_h323.c?view=diff&rev=427&r1=426&r2=427
==============================================================================
--- trunk/asterisk-ooh323c/src/chan_h323.c (original)
+++ trunk/asterisk-ooh323c/src/chan_h323.c Thu Aug 23 00:13:54 2007
@@ -1750,9 +1750,7 @@
ast_verbose("--- ooh323_do_reload\n");
}
- delete_users();
- delete_peers();
- reload_config();
+ reload_config(1);
if(gH323Debug) {
ast_verbose("+++ ooh323_do_reload\n");
@@ -1789,12 +1787,13 @@
return ooh323_reload(0, 0, NULL);
}
-int reload_config(void)
+int reload_config(int reload)
{
int format;
struct ooAliases *pNewAlias = NULL;
struct ast_config *cfg;
struct ast_variable *v;
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
struct ooh323_user *user = NULL;
struct ooh323_peer *peer = NULL;
char *cat;
@@ -1803,12 +1802,18 @@
if(gH323Debug)
ast_verbose("--- reload_config\n");
- cfg = ast_config_load((char*)config);
+ cfg = ast_config_load((char*)config, config_flags);
/* We *must* have a config file otherwise stop immediately */
if (!cfg) {
ast_log(LOG_NOTICE, "Unable to load config %s, OOH323 disabled\n",config);
return 1;
+ } else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+ return RESULT_SUCCESS;
+
+ if (reload) {
+ delete_users();
+ delete_peers();
}
/* Inintialize everything to default */
@@ -2435,7 +2440,7 @@
}
- res = reload_config();
+ res = reload_config(0);
if (!res) {
/* Make sure we can register our OOH323 channel type */
if (ast_channel_register(&ooh323_tech)) {
Modified: trunk/asterisk-ooh323c/src/chan_h323.h
URL: http://svn.digium.com/view/asterisk-addons/trunk/asterisk-ooh323c/src/chan_h323.h?view=diff&rev=427&r1=426&r2=427
==============================================================================
--- trunk/asterisk-ooh323c/src/chan_h323.h (original)
+++ trunk/asterisk-ooh323c/src/chan_h323.h Thu Aug 23 00:13:54 2007
@@ -85,7 +85,7 @@
int delete_peers(void);
int ooh323_destroy(struct ooh323_pvt *p);
-int reload_config(void);
+int reload_config(int reload);
int restart_monitor(void);
int configure_local_rtp(struct ooh323_pvt *p, ooCallData* call);
Modified: trunk/cdr_addon_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/cdr_addon_mysql.c?view=diff&rev=427&r1=426&r2=427
==============================================================================
--- trunk/cdr_addon_mysql.c (original)
+++ trunk/cdr_addon_mysql.c Thu Aug 23 00:13:54 2007
@@ -133,7 +133,7 @@
static int mysql_log(struct ast_cdr *cdr)
{
- struct tm tm;
+ struct ast_tm tm;
struct timeval tv;
struct ast_module_user *u;
char *userfielddata = NULL;
@@ -146,8 +146,8 @@
memset(sqlcmd, 0, 2048);
- ast_localtime(&cdr->start.tv_sec, &tm, NULL);
- strftime(timestr, 128, DATE_FORMAT, &tm);
+ ast_localtime(&cdr->start, &tm, NULL);
+ ast_strftime(timestr, sizeof(timestr), DATE_FORMAT, &tm);
db_reconnect:
if ((!connected) && (hostname || dbsock) && dbuser && password && dbname && dbtable ) {
@@ -326,19 +326,24 @@
return 0;
}
-static int my_load_module(void)
+static int my_load_module(int reload)
{
int res;
struct ast_config *cfg;
struct ast_variable *var;
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
const char *tmp;
char *temp;
- cfg = ast_config_load(config);
+ cfg = ast_config_load(config, config_flags);
if (!cfg) {
ast_log(LOG_WARNING, "Unable to load config for mysql CDR's: %s\n", config);
return AST_MODULE_LOAD_SUCCESS;
- }
+ } else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+ return AST_MODULE_LOAD_SUCCESS;
+
+ if (reload)
+ my_unload_module();
var = ast_variable_browse(cfg, "global");
if (!var) {
@@ -445,7 +450,7 @@
static int load_module(void)
{
- return my_load_module();
+ return my_load_module(0);
}
static int unload_module(void)
@@ -458,8 +463,7 @@
int ret;
ast_mutex_lock(&mysql_lock);
- my_unload_module();
- ret = my_load_module();
+ ret = my_load_module(1);
ast_mutex_unlock(&mysql_lock);
return ret;
Modified: trunk/res_config_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/res_config_mysql.c?view=diff&rev=427&r1=426&r2=427
==============================================================================
--- trunk/res_config_mysql.c (original)
+++ trunk/res_config_mysql.c Thu Aug 23 00:13:54 2007
@@ -534,7 +534,7 @@
return (int)numrows;
}
-static struct ast_config *config_mysql(const char *database, const char *table, const char *file, struct ast_config *cfg, int withcomments)
+static struct ast_config *config_mysql(const char *database, const char *table, const char *file, struct ast_config *cfg, struct ast_flags config_flags)
{
MYSQL_RES *result;
MYSQL_ROW row;
@@ -545,6 +545,7 @@
char last[80] = "";
int last_cat_metric = 0;
+ ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
last[0] = '\0';
if (!file || !strcmp(file, RES_CONFIG_MYSQL_CONF)) {
@@ -580,7 +581,7 @@
while ((row = mysql_fetch_row(result))) {
if (!strcmp(row[1], "#include")) {
- if (!ast_config_internal_load(row[2], cfg, 0)) {
+ if (!ast_config_internal_load(row[2], cfg, config_flags)) {
mysql_free_result(result);
ast_mutex_unlock(&dbread.lock);
ast_config_destroy(cfg);
@@ -721,10 +722,11 @@
static int parse_config(void)
{
struct ast_config *config = NULL;
+ struct ast_flags config_flags = { 0 };
const char *catg = "write";
int haswriteconfig = 0;
- if (!(config = ast_config_load(RES_CONFIG_MYSQL_CONF))) {
+ if (!(config = ast_config_load(RES_CONFIG_MYSQL_CONF, config_flags))) {
set_defaults(&dbwrite);
set_defaults(&dbread);
return 0;
@@ -856,7 +858,7 @@
}
conn->connected = 1;
- connect_time = time(NULL);
+ conn->connect_time = time(NULL);
if (mysql_select_db(&conn->handle, conn->name) != 0) {
ast_log(LOG_WARNING, "MySQL RealTime: Unable to select database: %s. Still Connected (%d) - %s.\n", conn->name, mysql_errno(&conn->handle), mysql_error(&conn->handle));
More information about the asterisk-addons-commits
mailing list