[asterisk-commits] tilghman: trunk r279413 - in /trunk: ./ cdr/cdr_odbc.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jul 25 13:22:17 CDT 2010


Author: tilghman
Date: Sun Jul 25 13:22:13 2010
New Revision: 279413

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=279413
Log:
Merged revisions 279410 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r279410 | tilghman | 2010-07-25 13:21:27 -0500 (Sun, 25 Jul 2010) | 8 lines
  
  Don't re-register CDR module on reload.
  
  (closes issue #17304)
   Reported by: jnemeth
   Patches: 
         20100507__issue17304.diff.txt uploaded by tilghman (license 14)
   Tested by: jnemeth
........

Modified:
    trunk/   (props changed)
    trunk/cdr/cdr_odbc.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-1.8-merged (original)
+++ branch-1.8-merged Sun Jul 25 13:22:13 2010
@@ -1,1 +1,1 @@
-/branches/1.8:1-279056,279113,279227,279273,279280,279314,279390
+/branches/1.8:1-279056,279113,279227,279273,279280,279314,279390,279410

Modified: trunk/cdr/cdr_odbc.c
URL: http://svnview.digium.com/svn/asterisk/trunk/cdr/cdr_odbc.c?view=diff&rev=279413&r1=279412&r2=279413
==============================================================================
--- trunk/cdr/cdr_odbc.c (original)
+++ trunk/cdr/cdr_odbc.c Sun Jul 25 13:22:13 2010
@@ -54,6 +54,7 @@
 	CONFIG_USEGMTIME =         1 << 1,
 	CONFIG_DISPOSITIONSTRING = 1 << 2,
 	CONFIG_HRTIME =            1 << 3,
+	CONFIG_REGISTERED =        1 << 4,
 };
 
 static struct ast_flags config = { 0 };
@@ -242,14 +243,24 @@
 		ast_verb(3, "cdr_odbc: dsn is %s\n", dsn);
 		ast_verb(3, "cdr_odbc: table is %s\n", table);
 
-		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");
+		if (!ast_test_flag(&config, CONFIG_REGISTERED)) {
+			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");
+			} else {
+				ast_set_flag(&config, CONFIG_REGISTERED);
+			}
 		}
 	} while (0);
 
-	if (cfg && cfg != CONFIG_STATUS_FILEUNCHANGED && cfg != CONFIG_STATUS_FILEINVALID)
+	if (ast_test_flag(&config, CONFIG_REGISTERED) && (!cfg || dsn == NULL || table == NULL)) {
+		ast_cdr_unregister(name);
+		ast_clear_flag(&config, CONFIG_REGISTERED);
+	}
+
+	if (cfg && cfg != CONFIG_STATUS_FILEUNCHANGED && cfg != CONFIG_STATUS_FILEINVALID) {
 		ast_config_destroy(cfg);
+	}
 	return res;
 }
 




More information about the asterisk-commits mailing list