[asterisk-commits] trunk r12475 - in /trunk: cdr/cdr_tds.c configs/cdr_tds.conf.sample

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Mar 8 15:12:21 MST 2006


Author: mogorman
Date: Wed Mar  8 16:12:20 2006
New Revision: 12475

URL: http://svn.digium.com/view/asterisk?rev=12475&view=rev
Log:
allows the table field to be configurable for
cdr_tds.conf.  patch provided by bug 6629 with
minor change.

Modified:
    trunk/cdr/cdr_tds.c
    trunk/configs/cdr_tds.conf.sample

Modified: trunk/cdr/cdr_tds.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_tds.c?rev=12475&r1=12474&r2=12475&view=diff
==============================================================================
--- trunk/cdr/cdr_tds.c (original)
+++ trunk/cdr/cdr_tds.c Wed Mar  8 16:12:20 2006
@@ -89,6 +89,7 @@
 static char *config = "cdr_tds.conf";
 
 static char *hostname = NULL, *dbname = NULL, *dbuser = NULL, *password = NULL, *charset = NULL, *language = NULL;
+static char *table = NULL;
 
 static int connected = 0;
 
@@ -135,7 +136,7 @@
 
 	sprintf(
 		sqlcmd,
-		"INSERT INTO cdr "
+		"INSERT INTO %s "
 		"("
 			"accountcode, "
 			"src, "
@@ -175,6 +176,7 @@
 			"'%s', "	/* amaflags */
 			"'%s'"		/* uniqueid */
 		")",
+		table,
 		accountcode,
 		src,
 		dst,
@@ -415,6 +417,7 @@
 	if (password) free(password);
 	if (charset) free(charset);
 	if (language) free(language);
+	if (table) free(table);
 
 	return 0;
 }
@@ -475,6 +478,13 @@
 	else
 		language = strdup("us_english");
 
+	ptr = ast_variable_retrieve(cfg,"global","table");
+	if (ptr == NULL) {
+		ast_log(LOG_DEBUG,"cdr_tds: table not specified.  Assuming cdr\n");
+		ptr = "cdr";
+	}
+	table = strdup(ptr);
+
 	ast_config_destroy(cfg);
 
 	mssql_connect();

Modified: trunk/configs/cdr_tds.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/cdr_tds.conf.sample?rev=12475&r1=12474&r2=12475&view=diff
==============================================================================
--- trunk/configs/cdr_tds.conf.sample (original)
+++ trunk/configs/cdr_tds.conf.sample Wed Mar  8 16:12:20 2006
@@ -7,3 +7,5 @@
 ;user=mangUsr
 ;password=
 ;charset=BIG5
+;table=cdr
+



More information about the asterisk-commits mailing list