[asterisk-commits] seanbright: branch group/newcdr r202881 - in /team/group/newcdr: cel/ configs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 23 23:23:31 CDT 2009


Author: seanbright
Date: Tue Jun 23 23:23:27 2009
New Revision: 202881

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=202881
Log:
Update FreeTDS documenation and sample configuration.

Modified:
    team/group/newcdr/cel/cel_tds.c
    team/group/newcdr/configs/cel_tds.conf.sample

Modified: team/group/newcdr/cel/cel_tds.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/cel/cel_tds.c?view=diff&rev=202881&r1=202880&r2=202881
==============================================================================
--- team/group/newcdr/cel/cel_tds.c (original)
+++ team/group/newcdr/cel/cel_tds.c Tue Jun 23 23:23:27 2009
@@ -86,7 +86,7 @@
 
 struct cel_tds_config {
 	AST_DECLARE_STRING_FIELDS(
-		AST_STRING_FIELD(hostname);
+		AST_STRING_FIELD(connection);
 		AST_STRING_FIELD(database);
 		AST_STRING_FIELD(username);
 		AST_STRING_FIELD(password);
@@ -148,7 +148,7 @@
 retry:
 	/* Ensure that we are connected */
 	if (!settings->connected) {
-		ast_log(LOG_NOTICE, "Attempting to reconnect to %s (Attempt %d)\n", settings->hostname, attempt);
+		ast_log(LOG_NOTICE, "Attempting to reconnect to %s (Attempt %d)\n", settings->connection, attempt);
 		if (mssql_connect()) {
 			/* Connect failed */
 			if (attempt++ < 3) {
@@ -352,14 +352,20 @@
 		return -1;
 	}
 
-	DBSETLAPP(login,     "TSQL");
-	DBSETLUSER(login,    (char *) settings->username);
-	DBSETLPWD(login,     (char *) settings->password);
-	DBSETLCHARSET(login, (char *) settings->charset);
-	DBSETLNATLANG(login, (char *) settings->language);
-
-	if ((settings->dbproc = dbopen(login, (char *) settings->hostname)) == NULL) {
-		ast_log(LOG_ERROR, "Unable to connect to %s\n", settings->hostname);
+	DBSETLAPP(login,  "TSQL");
+	DBSETLUSER(login, (char *) settings->username);
+	DBSETLPWD(login,  (char *) settings->password);
+
+	if (!ast_strlen_zero(settings->charset)) {
+		DBSETLCHARSET(login, (char *) settings->charset);
+	}
+
+	if (!ast_strlen_zero(settings->language)) {
+		DBSETLNATLANG(login, (char *) settings->language);
+	}
+
+	if ((settings->dbproc = dbopen(login, (char *) settings->connection)) == NULL) {
+		ast_log(LOG_ERROR, "Unable to connect to %s\n", settings->connection);
 		dbloginfree(login);
 		return -1;
 	}
@@ -451,11 +457,11 @@
 	/* Clear out any existing settings */
 	ast_string_field_init(settings, 0);
 
-	ptr = ast_variable_retrieve(cfg, "global", "hostname");
-	if (ptr) {
-		ast_string_field_set(settings, hostname, ptr);
+	ptr = ast_variable_retrieve(cfg, "global", "connection");
+	if (ptr) {
+		ast_string_field_set(settings, connection, ptr);
 	} else {
-		ast_log(LOG_ERROR, "Failed to connect: Database server hostname not specified.\n");
+		ast_log(LOG_ERROR, "Failed to connect: Database connection name not specified.\n");
 		goto failed;
 	}
 
@@ -486,15 +492,11 @@
 	ptr = ast_variable_retrieve(cfg, "global", "charset");
 	if (ptr) {
 		ast_string_field_set(settings, charset, ptr);
-	} else {
-		ast_string_field_set(settings, charset, "iso_1");
 	}
 
 	ptr = ast_variable_retrieve(cfg, "global", "language");
 	if (ptr) {
 		ast_string_field_set(settings, language, ptr);
-	} else {
-		ast_string_field_set(settings, language, "us_english");
 	}
 
 	ptr = ast_variable_retrieve(cfg, "global", "table");

Modified: team/group/newcdr/configs/cel_tds.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/configs/cel_tds.conf.sample?view=diff&rev=202881&r1=202880&r2=202881
==============================================================================
--- team/group/newcdr/configs/cel_tds.conf.sample (original)
+++ team/group/newcdr/configs/cel_tds.conf.sample Tue Jun 23 23:23:27 2009
@@ -1,11 +1,69 @@
-; Sample Asterisk config file for CEL logging to FreeTDS
+;
+; Asterisk Channel Event Logging (CEL) - FreeTDS Backend
+;
 
 ;[global]
-;hostname=fs.malico.loc
-;port=1433
+
+; Connection
+;
+; Use the 'connection' keyword to specify one of the instance names from your
+; 'freetds.conf' file.  Note that 'freetds.conf' is not an Asterisk
+; configuration file, but one specific to the FreeTDS library.  See the FreeTDS
+; documentation on 'freetds.conf' for more information:
+;
+;         http://www.freetds.org/userguide/freetdsconf.htm
+;
+; Accepted values: One of the connections specified in freetds.conf
+
+;connection=ConnectionFromFreeTDSConf
+
+; Database Name
+;
+; The 'dbname' keyword specifies the database name to use when logging CEL
+; records.
+;
+; Accepted values: Any valid database name
+
 ;dbname=MalicoHN
-;user=mangUsr
-;password=
-;charset=BIG5
+
+; Database Table Name
+;
+; The 'table' keyword identifies which database table is used to log CEL
+; records.
+;
+; Accepted value: Any valid table name
+; Default value:  If not specified, a table named 'cel' is assumed
+
 ;table=cel
 
+; Credentials
+;
+; The 'username' and 'password' keywords specify the user credentials that
+; Asterisk should use when connecting to the database.
+;
+; Accepted value: Any valid username and password
+
+;username=mangUsr
+;password=
+
+; Language
+;
+; The 'language' keyword changes the language which are used for error and
+; information messages returned by SQL Server.  Each database and user has their
+; own default value, and this default can be overriden here.
+;
+; Accepted value: Any language installed on the target SQL Server.
+; Default value:  Server default
+
+;language=us_english
+
+; Character Set
+;
+; The 'charset' setting is used to change the character set used when connecting
+; to the database server.  Each database and database user has their own
+; character set setting, and this default can be overriden here.
+;
+; Accepted value: Any valid character set available on the target server.
+; Default value:  Server setting
+
+;charset=BIG5




More information about the asterisk-commits mailing list