[asterisk-commits] tilghman: branch 1.4 r113874 - in /branches/1.4: cdr/ configs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 9 13:57:34 CDT 2008


Author: tilghman
Date: Wed Apr  9 13:57:33 2008
New Revision: 113874

URL: http://svn.digium.com/view/asterisk?view=rev&rev=113874
Log:
If the [csv] section does not exist in cdr.conf, then an unload/load sequence
is needed to correct the problem.  Track whether the load succeeded with a
variable, so we can fix this with a simple reload event, instead.

Modified:
    branches/1.4/cdr/cdr_csv.c
    branches/1.4/configs/cdr.conf.sample

Modified: branches/1.4/cdr/cdr_csv.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/cdr/cdr_csv.c?view=diff&rev=113874&r1=113873&r2=113874
==============================================================================
--- branches/1.4/cdr/cdr_csv.c (original)
+++ branches/1.4/cdr/cdr_csv.c Wed Apr  9 13:57:33 2008
@@ -57,6 +57,7 @@
 static int usegmtime = 0;
 static int loguniqueid = 0;
 static int loguserfield = 0;
+static int loaded = 0;
 static char *config = "cdr.conf";
 
 /* #define CSV_LOGUNIQUEID 1 */
@@ -324,6 +325,7 @@
 static int unload_module(void)
 {
 	ast_cdr_unregister(name);
+	loaded = 0;
 	return 0;
 }
 
@@ -337,13 +339,21 @@
 	res = ast_cdr_register(name, ast_module_info->description, csv_log);
 	if (res) {
 		ast_log(LOG_ERROR, "Unable to register CSV CDR handling\n");
+	} else {
+		loaded = 1;
 	}
 	return res;
 }
 
 static int reload(void)
 {
-	load_config();
+	if (load_config()) {
+		loaded = 1;
+	} else {
+		loaded = 0;
+		ast_log(LOG_WARNING, "No [csv] section in cdr.conf.  Unregistering backend.\n");
+		ast_cdr_unregister(name);
+	}
 
 	return 0;
 }

Modified: branches/1.4/configs/cdr.conf.sample
URL: http://svn.digium.com/view/asterisk/branches/1.4/configs/cdr.conf.sample?view=diff&rev=113874&r1=113873&r2=113874
==============================================================================
--- branches/1.4/configs/cdr.conf.sample (original)
+++ branches/1.4/configs/cdr.conf.sample Wed Apr  9 13:57:33 2008
@@ -136,8 +136,8 @@
 
 [csv]
 usegmtime=yes    ; log date/time in GMT.  Default is "no"
-loguniqueid=yes  ; log uniqueid.  Default is "no
-loguserfield=yes ; log user field.  Default is "no
+loguniqueid=yes  ; log uniqueid.  Default is "no"
+loguserfield=yes ; log user field.  Default is "no"
 
 ;[radius]
 ;usegmtime=yes    ; log date/time in GMT




More information about the asterisk-commits mailing list