[asterisk-commits] murf: branch murf/newcdr r62544 - in /team/murf/newcdr: cel/ doc/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue May 1 13:40:08 MST 2007


Author: murf
Date: Tue May  1 15:40:07 2007
New Revision: 62544

URL: http://svn.digium.com/view/asterisk?view=rev&rev=62544
Log:
OK, groovy... I got the pgsql, tds, odbc, sqlite, radius packages/tarballs, and installed them, and now all the backends compile.

Modified:
    team/murf/newcdr/cel/cel_pgsql.c
    team/murf/newcdr/cel/cel_radius.c
    team/murf/newcdr/cel/cel_sqlite.c
    team/murf/newcdr/cel/cel_sqlite3_custom.c
    team/murf/newcdr/doc/celdriver.tex

Modified: team/murf/newcdr/cel/cel_pgsql.c
URL: http://svn.digium.com/view/asterisk/team/murf/newcdr/cel/cel_pgsql.c?view=diff&rev=62544&r1=62543&r2=62544
==============================================================================
--- team/murf/newcdr/cel/cel_pgsql.c (original)
+++ team/murf/newcdr/cel/cel_pgsql.c Tue May  1 15:40:07 2007
@@ -64,7 +64,6 @@
 
 #define DATE_FORMAT "%Y-%m-%d %T"
 
-static char *name = "pgsql";
 static char *config = "cel_pgsql.conf";
 static char *pghostname = NULL, *pgdbname = NULL, *pgdbuser = NULL, *pgpassword = NULL, *pgdbport = NULL, *table = NULL;
 static int connected = 0;
@@ -75,7 +74,7 @@
 static PGresult	*result = NULL;
 static struct ast_event_sub *event_sub = 0;
 
-static int pgsql_log(const struct ast_event *event, void *userdata)
+static void pgsql_log(const struct ast_event *event, void *userdata)
 {
 	struct tm tm;
 	char sqlcmd[2048] = "", timestr[128];
@@ -92,7 +91,7 @@
 		userdefname = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_USEREVENT_NAME);
 
 	
-	cel_set_backend_channel_vars(chan, eventtype, userdefname, eventtime);
+	cel_set_backend_channel_vars((struct ast_channel *)chan, eventtype, userdefname, eventtime);
 	ast_mutex_lock(&pgsql_lock);
 
 	localtime_r(&eventtime,&tm);
@@ -114,14 +113,14 @@
 		char *uniqueid=NULL;
 
 		/* Maximum space needed would be if all characters needed to be escaped, plus a trailing NULL */
-		if ((clid = alloca(strlen(chan->cid.name) * 2 + 1)) != NULL)
-			PQescapeString(clid, chan->cid.name, strlen(chan->cid.name));
+		if ((clid = alloca(strlen(chan->cid.cid_name) * 2 + 1)) != NULL)
+			PQescapeString(clid, chan->cid.cid_name, strlen(chan->cid.cid_name));
 		if ((context = alloca(strlen(chan->context) * 2 + 1)) != NULL)
 			PQescapeString(context, chan->context, strlen(chan->context));
 		if ((channel = alloca(strlen(chan->name) * 2 + 1)) != NULL)
 			PQescapeString(channel, chan->name, strlen(chan->name));
-		if ((app = alloca(strlen(chan->app) * 2 + 1)) != NULL)
-			PQescapeString(app, chan->app, strlen(chan->app));
+		if ((app = alloca(strlen(chan->appl) * 2 + 1)) != NULL)
+			PQescapeString(app, chan->appl, strlen(chan->appl));
 		if ((appdata = alloca(strlen(chan->data) * 2 + 1)) != NULL)
 			PQescapeString(appdata, chan->data, strlen(chan->data));
 		if ((uniqueid = alloca(strlen(chan->uniqueid) * 2 + 1)) != NULL)
@@ -131,7 +130,7 @@
 		if ((!clid) || (!context) || (!channel) || (!app) || (!appdata) || (!uniqueid)) {
 			ast_log(LOG_ERROR, "cel_pgsql:  Out of memory error (insert fails)\n");
 			ast_mutex_unlock(&pgsql_lock);
-			return -1;
+			return;
 		}
 
 		if (option_debug > 1)
@@ -139,8 +138,8 @@
 
 		snprintf(sqlcmd,sizeof(sqlcmd),"INSERT INTO %s (eventtime,clid,clidnum,exten,context,channel,"
 				 "app,appdata,amaflags,accountcode,uniqueid) VALUES"
-				 " ('%s','%s','%s','%s','%s', '%s','%s','%s','%s',%ld,%ld,'%s',%ld,'%s','%s','%s')",
-				 table,timestr,clid,chan->cid.num, chan->exten, context,channel, lastapp, lastdata,
+				 " ('%s','%s','%s','%s','%s', '%s','%s','%s',%d,'%s','%s')",
+				 table,timestr,clid,chan->cid.cid_num, chan->exten, context,channel, app, appdata,
 				 chan->amaflags, chan->accountcode, uniqueid);
 		
 		if (option_debug > 2)
@@ -163,7 +162,7 @@
 				ast_log(LOG_ERROR, "cel_pgsql: Reason: %s\n", pgerror);
 				connected = 0;
 				ast_mutex_unlock(&pgsql_lock);
-				return -1;
+				return;
 			}
 		}
 		result = PQexec(conn, sqlcmd);
@@ -185,11 +184,11 @@
 				}
 			}
 			ast_mutex_unlock(&pgsql_lock);
-			return -1;
+			return;
 		}
 	}
 	ast_mutex_unlock(&pgsql_lock);
-	return 0;
+	return;
 }
 
 static int my_unload_module(void)
@@ -295,7 +294,7 @@
 		connected = 0;
 	}
 
-	event_sub = ast_event_subscribe(AST_EVENT_CEL, csv_log, NULL, "CEL PGSQL backend", AST_EVENT_IE_END);
+	event_sub = ast_event_subscribe(AST_EVENT_CEL, pgsql_log, NULL, "CEL PGSQL backend", AST_EVENT_IE_END);
 
 	if (!event_sub)
 		return AST_MODULE_LOAD_DECLINE;

Modified: team/murf/newcdr/cel/cel_radius.c
URL: http://svn.digium.com/view/asterisk/team/murf/newcdr/cel/cel_radius.c?view=diff&rev=62544&r1=62543&r2=62544
==============================================================================
--- team/murf/newcdr/cel/cel_radius.c (original)
+++ team/murf/newcdr/cel/cel_radius.c Tue May  1 15:40:07 2007
@@ -85,8 +85,6 @@
 	RADIUS_FLAG_LOGUSERFIELD = (1 << 2)
 };
 
-static char *desc = "RADIUS CEL Backend";
-static char *name = "radius";
 static char *cel_config = "cel.conf";
 
 static char radiuscfg[PATH_MAX] = "/etc/radiusclient-ng/radiusclient.conf";
@@ -107,11 +105,11 @@
 		return -1;
 
 	/* Account code */
-	if (!rc_avpair_add(rh, send, PW_AST_ACCT_CODE, &chan->accountcode, strlen(chan->accountcode), VENDOR_CODE))
+	if (!rc_avpair_add(rh, send, PW_AST_ACCT_CODE, (char**)&chan->accountcode, strlen(chan->accountcode), VENDOR_CODE))
 		return -1;
 
  	/* Source */
-	if (!rc_avpair_add(rh, send, PW_AST_SRC, &chan->cid.num, strlen(chan->cid.num), VENDOR_CODE))
+	if (!rc_avpair_add(rh, send, PW_AST_SRC, &chan->cid.cid_num, strlen(chan->cid.cid_num), VENDOR_CODE))
 		return -1;
 
  	/* Destination */
@@ -123,15 +121,15 @@
 		return -1;
 
 	/* Caller ID */
-	if (!rc_avpair_add(rh, send, PW_AST_CLID, &chan->cid.name, strlen(chan->cid.name), VENDOR_CODE))
+	if (!rc_avpair_add(rh, send, PW_AST_CLID, &chan->cid.cid_name, strlen(chan->cid.cid_name), VENDOR_CODE))
 		return -1;
 
 	/* Channel */
-	if (!rc_avpair_add(rh, send, PW_AST_CHAN, &chan->name, strlen(chan->name), VENDOR_CODE))
+	if (!rc_avpair_add(rh, send, PW_AST_CHAN, (char**)&chan->name, strlen(chan->name), VENDOR_CODE))
 		return -1;
 
 	/* Last Application */
-	if (!rc_avpair_add(rh, send, PW_AST_LAST_APP, &chan->app, strlen(chan->app), VENDOR_CODE))
+	if (!rc_avpair_add(rh, send, PW_AST_LAST_APP, &chan->appl, strlen(chan->appl), VENDOR_CODE))
 		return -1;
 
 	/* Last Data */
@@ -155,18 +153,18 @@
 
 	if (ast_test_flag(&global_flags, RADIUS_FLAG_LOGUNIQUEID)) {
 		/* Unique ID */
-		if (!rc_avpair_add(rh, send, PW_AST_UNIQUE_ID, &chan->uniqueid, strlen(chan->uniqueid), VENDOR_CODE))
+		if (!rc_avpair_add(rh, send, PW_AST_UNIQUE_ID, (char**)&chan->uniqueid, strlen(chan->uniqueid), VENDOR_CODE))
 			return -1;
 	}
 
 	/* Setting Acct-Session-Id & User-Name attributes for proper generation
 	   of Acct-Unique-Session-Id on server side */ 
 	/* Channel */
-	if (!rc_avpair_add(rh, send, PW_USER_NAME, &chan->channel, strlen(chan->channel), 0))
+	if (!rc_avpair_add(rh, send, PW_USER_NAME, (char**)&chan->name, strlen(chan->name), 0))
 		return -1;
 
 	/* Unique ID */
-	if (!rc_avpair_add(rh, send, PW_ACCT_SESSION_ID, &chan->uniqueid, strlen(chan->uniqueid), 0))
+	if (!rc_avpair_add(rh, send, PW_ACCT_SESSION_ID, (char**)&chan->uniqueid, strlen(chan->uniqueid), 0))
 		return -1;
 
 	return 0;
@@ -187,19 +185,19 @@
 	if (eventtype == CEL_USER_DEFINED)
 		userdefname = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_USEREVENT_NAME);
 
-	cel_set_backend_channel_vars(chan, eventtype, userdefname, eventtime);
-	
-	if (build_radius_record(&send, chan, eventtype, eventtime, userdefname)) {
+	cel_set_backend_channel_vars((struct ast_channel*)chan, eventtype, userdefname, eventtime);
+	
+	if (build_radius_record(&send, (struct ast_channel*)chan, eventtype, eventtime, (char*)userdefname)) {
 		if (option_debug)
 			ast_log(LOG_DEBUG, "Unable to create RADIUS record. CEL not recorded!\n");
-		return result;
+		return;
 	}
 	
 	result = rc_acct(rh, 0, send);
 	if (result != OK_RC)
 		ast_log(LOG_ERROR, "Failed to record Radius CEL record!\n");
 
-	return result;
+	return;
 }
 
 static int unload_module(void)
@@ -240,7 +238,7 @@
 		return -1;
 	}
 	
-	event_sub = ast_event_subscribe(AST_EVENT_CEL, csv_log, NULL, "CEL Radius Logging", AST_EVENT_IE_END);
+	event_sub = ast_event_subscribe(AST_EVENT_CEL, radius_log, NULL, "CEL Radius Logging", AST_EVENT_IE_END);
 	
 	if (!event_sub)
 		return AST_MODULE_LOAD_DECLINE;

Modified: team/murf/newcdr/cel/cel_sqlite.c
URL: http://svn.digium.com/view/asterisk/team/murf/newcdr/cel/cel_sqlite.c?view=diff&rev=62544&r1=62543&r2=62544
==============================================================================
--- team/murf/newcdr/cel/cel_sqlite.c (original)
+++ team/murf/newcdr/cel/cel_sqlite.c Tue May  1 15:40:07 2007
@@ -56,6 +56,7 @@
 #include "asterisk/module.h"
 #include "asterisk/logger.h"
 #include "asterisk/utils.h"
+#include "asterisk/cel.h"
 
 #define LOG_UNIQUEID	0
 #define LOG_USERFIELD	0
@@ -63,7 +64,6 @@
 /* When you change the DATE_FORMAT, be sure to change the CHAR(19) below to something else */
 #define DATE_FORMAT "%Y-%m-%d %T"
 
-static char *name = "sqlite";
 static sqlite* db = NULL;
 static struct ast_event_sub *event_sub = 0;
 
@@ -106,7 +106,7 @@
 	if (eventtype == CEL_USER_DEFINED)
 		userdefname = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_USEREVENT_NAME);
 
-	cel_set_backend_channel_vars(chan, eventtype, userdefname, eventtime);
+	cel_set_backend_channel_vars((struct ast_channel*)chan, eventtype, userdefname, eventtime);
 
 	ast_mutex_lock(&sqlite_lock);
 
@@ -133,8 +133,8 @@
 				",'%q'"
 #				endif
 			")", NULL, NULL, &zErr,
-				chan->cid.name, chan->cid.num, chan->exten, chan->context,
-				chan->name, chan->app, chan->data,
+				chan->cid.cid_name, chan->cid.cid_num, chan->exten, chan->context,
+				chan->name, chan->appl, chan->data,
 				startstr, 
 				chan->amaflags,
 				chan->accountcode
@@ -153,7 +153,7 @@
 	}
 
 	ast_mutex_unlock(&sqlite_lock);
-	return res;
+	return;
 }
 
 static int unload_module(void)

Modified: team/murf/newcdr/cel/cel_sqlite3_custom.c
URL: http://svn.digium.com/view/asterisk/team/murf/newcdr/cel/cel_sqlite3_custom.c?view=diff&rev=62544&r1=62543&r2=62544
==============================================================================
--- team/murf/newcdr/cel/cel_sqlite3_custom.c (original)
+++ team/murf/newcdr/cel/cel_sqlite3_custom.c Tue May  1 15:40:07 2007
@@ -65,7 +65,6 @@
 
 static const char config_file[] = "cel_sqlite3_custom.conf";
 
-static char *desc = "Customizable SQLite3 CEL Backend";
 static char *name = "cel_sqlite3_custom";
 static sqlite3 *db = NULL;
 
@@ -163,11 +162,11 @@
 	char *userdefname = 0;
 	time_t eventtime = 0;
 	
-	chan = ast_event_get_ie_raw(event, AST_EVENT_IE_CHANPTR);
+	chan = (struct ast_channel *)ast_event_get_ie_raw(event, AST_EVENT_IE_CHANPTR);
 	eventtype = (enum ast_cel_eventtype)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TYPE);
 	eventtime = (time_t)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TIME);
 	if (eventtype == CEL_USER_DEFINED)
-		userdefname = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_USEREVENT_NAME);
+		userdefname = (char*)ast_event_get_ie_str(event, AST_EVENT_IE_CEL_USEREVENT_NAME);
 
 	cel_set_backend_channel_vars(chan, eventtype, userdefname, eventtime);
 
@@ -197,7 +196,7 @@
 
 	ast_mutex_unlock(&lock);
 
-	return res;
+	return;
 }
 
 static int unload_module(void)

Modified: team/murf/newcdr/doc/celdriver.tex
URL: http://svn.digium.com/view/asterisk/team/murf/newcdr/doc/celdriver.tex?view=diff&rev=62544&r1=62543&r2=62544
==============================================================================
--- team/murf/newcdr/doc/celdriver.tex (original)
+++ team/murf/newcdr/doc/celdriver.tex Tue May  1 15:40:07 2007
@@ -249,13 +249,13 @@
 	http://developer.berlios.de/projects/radiusclient-ng/
 		
 	Untar the source tarball.
-		root at localhost:/usr/local/src# tar xvfz radiusclient-ng-0.5.2.tar.gz
+		root at localhost:/usr/local/src# tar xvfz radiusclient-ng-0.5.5.1.tar.gz
 
 	Compile and install the library.
-		root at localhost:/usr/local/src# cd radiusclient-ng-0.5.2
-		root at localhost:/usr/local/src/radiusclient-ng-0.5.2# ./configure
-		root at localhost:/usr/local/src/radiusclient-ng-0.5.2# make
-		root at localhost:/usr/local/src/radiusclient-ng-0.5.2# make install
+		root at localhost:/usr/local/src# cd radiusclient-ng-0.5.5.1
+		root at localhost:/usr/local/src/radiusclient-ng-0.5.5.1# ./configure
+		root at localhost:/usr/local/src/radiusclient-ng-0.5.5.1# make
+		root at localhost:/usr/local/src/radiusclient-ng-0.5.5.1# make install
 \end{verbatim}
 
 \subsubsection{Configuration of the Radiusclient library}



More information about the asterisk-commits mailing list