[asterisk-commits] murf: branch group/newcdr r171521 - in /team/group/newcdr: ./ apps/ cel/ chan...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 26 17:55:07 CST 2009


Author: murf
Date: Mon Jan 26 17:55:07 2009
New Revision: 171521

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=171521
Log:
These changes were inspired by Russell's 
reviewboard comments. And then, I went thru
all 4 pages of diff and tried my best to get
rid of the ugly red splotches against a green
background. In a few places, I got rid of 
red marks in the rest of the file, but not
super often. The red splotches are usually useless
spaces/tabs at the end of lines, or spaces mixed
with tabs at the beginning of a line.


Modified:
    team/group/newcdr/CHANGES
    team/group/newcdr/apps/app_celgenuserevent.c
    team/group/newcdr/cel/cel_custom.c
    team/group/newcdr/cel/cel_manager.c
    team/group/newcdr/cel/cel_pgsql.c
    team/group/newcdr/cel/cel_radius.c
    team/group/newcdr/cel/cel_sqlite.c
    team/group/newcdr/cel/cel_sqlite3_custom.c
    team/group/newcdr/channels/chan_dahdi.c
    team/group/newcdr/channels/chan_iax2.c
    team/group/newcdr/channels/chan_sip.c
    team/group/newcdr/configs/cel.conf.sample
    team/group/newcdr/configs/cel_custom.conf.sample
    team/group/newcdr/doc/cel-doc.tex
    team/group/newcdr/doc/celdriver.tex
    team/group/newcdr/funcs/func_channel.c
    team/group/newcdr/include/asterisk/cdr.h
    team/group/newcdr/include/asterisk/cel.h
    team/group/newcdr/main/cel.c
    team/group/newcdr/main/channel.c
    team/group/newcdr/main/event.c
    team/group/newcdr/main/pbx.c

Modified: team/group/newcdr/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/CHANGES?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/CHANGES (original)
+++ team/group/newcdr/CHANGES Mon Jan 26 17:55:07 2009
@@ -140,7 +140,7 @@
 
 Channel Event Logging
 ---------------------
- * A new interface, CEL, is introduced here. CEL logs single events, much like 
+ * A new interface, CEL, is introduced here. CEL logs single events, much like
    the AMI, but it differs from the AMI in that it logs to db backends much
    like CDR does; is based on the event subsystem introduced by Russell, and
    can share in all its benefits; allows multiple backends to operate like CDR;

Modified: team/group/newcdr/apps/app_celgenuserevent.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/apps/app_celgenuserevent.c?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/apps/app_celgenuserevent.c (original)
+++ team/group/newcdr/apps/app_celgenuserevent.c Mon Jan 26 17:55:07 2009
@@ -67,9 +67,7 @@
 	parse = ast_strdupa(data);
 	AST_STANDARD_APP_ARGS(args, parse);
 
-	u = ast_module_user_add(chan);
 	ast_cel_report_event(chan, CEL_USER_DEFINED, args.event, args.extra, NULL);
-	ast_module_user_remove(u);
 	return res;
 }
 
@@ -94,7 +92,7 @@
 	}
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Generate an User-Defined CEL event", 
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Generate an User-Defined CEL event",
 				.load = load_module,
 				.unload = unload_module,
 	);

Modified: team/group/newcdr/cel/cel_custom.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/cel/cel_custom.c?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/cel/cel_custom.c (original)
+++ team/group/newcdr/cel/cel_custom.c Mon Jan 26 17:55:07 2009
@@ -66,7 +66,7 @@
 static char format[1024]="";
 static struct ast_event_sub *event_sub = NULL;
 
-static int load_config(int reload) 
+static int load_config(int reload)
 {
 	struct ast_config *cfg;
 	struct ast_variable *var;
@@ -108,7 +108,7 @@
 		}
 	}
 	ast_mutex_unlock(&lock);
-	
+
 	return res;
 }
 
@@ -170,9 +170,9 @@
 	if (load_config(0)) {
 		return AST_MODULE_LOAD_DECLINE;
 	}
-	
+
 	event_sub = ast_event_subscribe(AST_EVENT_CEL, custom_log, "Custom CSV logging", NULL, AST_EVENT_IE_END);
-	
+
 	if (mf) {
 		fclose(mf);
 		mf = NULL;
@@ -193,7 +193,7 @@
 	} else {
 		return AST_MODULE_LOAD_SUCCESS;
 	}
-	
+
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Customizable Comma Separated Values CEL Backend",

Modified: team/group/newcdr/cel/cel_manager.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/cel/cel_manager.c?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/cel/cel_manager.c (original)
+++ team/group/newcdr/cel/cel_manager.c Mon Jan 26 17:55:07 2009
@@ -45,8 +45,8 @@
 #include "asterisk/manager.h"
 #include "asterisk/config.h"
 
-#define DATE_FORMAT 	"%Y-%m-%d %T"
-#define CONF_FILE	"cel_manager.conf"
+#define DATE_FORMAT     "%Y-%m-%d %T"
+#define CONF_FILE	    "cel_manager.conf"
 
 #define CUSTOM_FIELDS_BUF_SIZE 1024
 
@@ -63,25 +63,25 @@
 	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
 	struct ast_variable *v;
 	int newenablecel = 0;
-	
+
 	cfg = ast_config_load(CONF_FILE, config_flags);
 	if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
 		ast_log(LOG_NOTICE,"CEL manager backend: config file has not changed.\n");
 		return 0;
 	}
-	
+
 	if (reload && customfields) {
 		ast_free(customfields);
 	}
 	customfields = NULL;
-	
+
 	if (!cfg) {
 		ast_log(LOG_WARNING, "Failed to load configuration file. CEL manager Module not activated.\n");
 		/* Standard configuration */
 		enablecel = 0;
 		return 0;
 	}
-	
+
 	if (!ast_variable_browse(cfg, "general")) {
 		/* nothing configured */
 		ast_config_destroy(cfg);
@@ -110,12 +110,11 @@
 						ast_log(LOG_WARNING, "No more buffer space to add other custom fields\n");
 						break;
 					}
-					
 				}
 			}
 		}
 	}
-	
+
 	ast_config_destroy(cfg);
 
 	if (enablecel && !newenablecel) {
@@ -130,10 +129,9 @@
 		} else {
 			ast_log(LOG_NOTICE, "Registered Asterisk Call Manager CEL handling\n");
 		}
-		
 	}
 	enablecel = newenablecel;
-	
+
 	return 1;
 }
 
@@ -180,7 +178,7 @@
 	t = eventtime;
 	ast_localtime(&t, &timeresult, NULL);
 	ast_strftime(strStartTime, sizeof(strStartTime), DATE_FORMAT, &timeresult);
-	
+
 	manager_event(EVENT_FLAG_CALL, "CEL",
         "EventName: %s\r\n"
 	    "AccountCode: %s\r\n"

Modified: team/group/newcdr/cel/cel_pgsql.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/cel/cel_pgsql.c?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/cel/cel_pgsql.c (original)
+++ team/group/newcdr/cel/cel_pgsql.c Mon Jan 26 17:55:07 2009
@@ -183,7 +183,7 @@
 			}
 			return;
 		}
-		
+
 		ast_str_set(&sql, 0, "INSERT INTO %s (", table);
 		ast_str_set(&sql2, 0, " VALUES (");
 
@@ -191,7 +191,7 @@
 		AST_RWLIST_TRAVERSE(&psql_columns, cur, list) {
 			LENGTHEN_BUF1(strlen(cur->name) + 2);
 			ast_str_append(&sql, 0, "%s\"%s\"", first ? "" : ",", cur->name);
-			
+
 			if (strcmp(cur->name, "eventtime") == 0) {
 				if (strncmp(cur->type, "int", 3) == 0) {
 					LENGTHEN_BUF2(13);
@@ -359,7 +359,7 @@
 }
 
 static int my_unload_module(void)
-{ 
+{
 	struct columns *current;
 	/* Give all threads time to finish */
 	usleep(1);
@@ -408,7 +408,7 @@
 	const char *tmp;
 	PGresult *result;
 	struct columns *cur;
-	
+
 	if (!(var = ast_variable_browse(cfg, "global"))) {
 		ast_log(LOG_WARNING,"CEL pgsql config file missing global section.\n");
 		return AST_MODULE_LOAD_DECLINE;
@@ -484,7 +484,7 @@
 		ast_debug(3, "cel_pgsql: got password of %s\n", pgpassword);
 		ast_debug(3, "cel_pgsql: got sql table name of %s\n", table);
 	}
-	
+
 	conn = PQsetdbLogin(pghostname, pgdbport, NULL, NULL, pgdbname, pgdbuser, pgpassword);
 	if (PQstatus(conn) != CONNECTION_BAD) {
 		char sqlcmd[512];
@@ -512,7 +512,7 @@
 			unload_module();
 			return AST_MODULE_LOAD_DECLINE;
 		}
-		
+
 		rows = PQntuples(result);
 		for (i = 0; i < rows; i++) {
 			fname = PQgetvalue(result, i, 0);
@@ -563,7 +563,7 @@
 	} else if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
 		return AST_MODULE_LOAD_SUCCESS;
 	}
-	
+
 	res = process_my_load_module(cfg);
 	ast_config_destroy(cfg);
 

Modified: team/group/newcdr/cel/cel_radius.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/cel/cel_radius.c?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/cel/cel_radius.c (original)
+++ team/group/newcdr/cel/cel_radius.c Mon Jan 26 17:55:07 2009
@@ -92,12 +92,12 @@
 static rc_handle *rh = NULL;
 static struct ast_event_sub *event_sub = 0;
 
-static int build_radius_record(VALUE_PAIR **send, enum ast_cel_eventtype eventtype, 
-							   struct timeval eventtime, const char *userdefname, const char *cid_name, 
-							   const char *cid_num, const char *cid_ani, 
-							   const char *cid_rdnis, const char *cid_dnid, const char *exten, 
-							   const char *context, const char *channame, const char *appname, 
-							   const char *appdata, const char *accountcode, 
+static int build_radius_record(VALUE_PAIR **send, enum ast_cel_eventtype eventtype,
+							   struct timeval eventtime, const char *userdefname, const char *cid_name,
+							   const char *cid_num, const char *cid_ani,
+							   const char *cid_rdnis, const char *cid_dnid, const char *exten,
+							   const char *context, const char *channame, const char *appname,
+							   const char *appdata, const char *accountcode,
 							   const char *uniqueid, unsigned int amaflag, const char *linkedid)
 {
 	int recordtype = PW_STATUS_STOP;
@@ -112,15 +112,15 @@
 	if (!rc_avpair_add(rh, send, PW_AST_ACCT_CODE, (char**)&accountcode, strlen(accountcode), VENDOR_CODE)) {
 		return -1;
 	}
- 	/* Source */
+	/* Source */
 	if (!rc_avpair_add(rh, send, PW_AST_CIDNUM, &cid_num, strlen(cid_num), VENDOR_CODE)) {
 		return -1;
 	}
- 	/* Destination */
+	/* Destination */
 	if (!rc_avpair_add(rh, send, PW_AST_EXTEN, &exten, strlen(exten), VENDOR_CODE)) {
 		return -1;
 	}
- 	/* Destination context */
+	/* Destination context */
 	if (!rc_avpair_add(rh, send, PW_AST_CONTEXT, &context, strlen(context), VENDOR_CODE)) {
 		return -1;
 	}
@@ -191,7 +191,7 @@
 	const char *cid_ani, *cid_rdnis, *cid_name, *cid_num, *cid_dnid;
 	const char *exten, *context, *channame, *appname, *appdata, *accountcode, *uniqueid, *linkedid;
 	unsigned int amaflag;
-	
+
 	ast_log(LOG_NOTICE,"Logging event to radius interface\n");
 	eventtype = (enum ast_cel_eventtype)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TYPE);
 	eventtime.tv_sec = (time_t)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TIME);
@@ -222,7 +222,7 @@
 		}
 		return;
 	}
-	
+
 	result = rc_acct(rh, 0, send);
 	if (result != OK_RC) {
 		ast_log(LOG_ERROR, "Failed to record Radius CEL record!\n");
@@ -254,7 +254,7 @@
 	} else {
 		return AST_MODULE_LOAD_DECLINE;
 	}
-	
+
 	/* start logging */
 	rc_openlog("asterisk");
 
@@ -269,9 +269,9 @@
 		ast_log(LOG_NOTICE, "Cannot load radiusclient-ng dictionary file.\n");
 		return AST_MODULE_LOAD_DECLINE;
 	}
-	
+
 	event_sub = ast_event_subscribe(AST_EVENT_CEL, radius_log, "CEL Radius Logging", NULL, AST_EVENT_IE_END);
-	
+
 	if (!event_sub) {
 		return AST_MODULE_LOAD_DECLINE;
 	} else {

Modified: team/group/newcdr/cel/cel_sqlite.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/cel/cel_sqlite.c?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/cel/cel_sqlite.c (original)
+++ team/group/newcdr/cel/cel_sqlite.c Mon Jan 26 17:55:07 2009
@@ -109,7 +109,7 @@
 	const char *cid_ani, *cid_rdnis, *cid_name, *cid_num, *cid_dnid;
 	const char *exten, *context, *channame, *appname, *appdata, *accountcode, *uniqueid, *userfield, *peer, *linkedid;
 	unsigned int amaflag;
-	
+
 	ast_log(LOG_NOTICE,"Logging event to sqlite interface\n");
 	eventtype = (enum ast_cel_eventtype)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TYPE);
 	eventtime.tv_sec = (time_t)ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TIME);
@@ -164,7 +164,7 @@
             ")", NULL, NULL, &zErr,
                 cid_name, cid_num, cid_ani, cid_rdnis, cid_dnid, exten, context,
 				channame, appname, appdata,
-				startstr, 
+				startstr,
 				amaflag,
 				accountcode,
 				userfield,
@@ -178,7 +178,7 @@
 		}
 		usleep(200);
 	}
-	
+
 	if (zErr) {
 		ast_log(LOG_ERROR, "cel_sqlite: %s\n", zErr);
 		free(zErr);
@@ -216,7 +216,7 @@
 		ast_log(LOG_ERROR, "cel_sqlite: The database (%s) does not exist; sqlite module declining load\n", fn);
 		return AST_MODULE_LOAD_DECLINE;
 	}
-	
+
 	db = sqlite_open(fn, AST_FILE_MODE, &zErr);
 	if (!db) {
 		ast_log(LOG_ERROR, "cel_sqlite: %s\n", zErr);
@@ -236,7 +236,7 @@
 
 		/* TODO: here we should probably create an index */
 	}
-	
+
 	event_sub = ast_event_subscribe(AST_EVENT_CEL, sqlite_log, "CEL sqlite logging backend", NULL, AST_EVENT_IE_END);
 	if (!event_sub) {
 		ast_log(LOG_ERROR, "Unable to register SQLite CEL handling\n");

Modified: team/group/newcdr/cel/cel_sqlite3_custom.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/cel/cel_sqlite3_custom.c?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/cel/cel_sqlite3_custom.c (original)
+++ team/group/newcdr/cel/cel_sqlite3_custom.c Mon Jan 26 17:55:07 2009
@@ -103,7 +103,7 @@
 		ast_log(LOG_WARNING, "%s: no mapping spec.\n", config_file);
 		return AST_MODULE_LOAD_DECLINE;
 	}
-	
+
 	/* Mapping must have a table name */
 	tmp = ast_variable_retrieve(cfg, "master", "table");
 	if (!ast_strlen_zero(tmp)) {
@@ -182,7 +182,7 @@
 	}
 
 	ast_dummy_channel_free(tchan);
-	
+
 	ast_mutex_lock(&lock);
 
 	for (count = 0; count < 5; count++) {
@@ -228,7 +228,7 @@
 		ast_log(LOG_NOTICE,"CEL sqlite3 declining to load, config problem.\n");
 		return AST_MODULE_LOAD_DECLINE;
 	}
-	
+
 	/* is the database there? */
 	snprintf(fn, sizeof(fn), "%s/master.db", ast_config_AST_LOG_DIR);
 	res = sqlite3_open(fn, &db);

Modified: team/group/newcdr/channels/chan_dahdi.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/channels/chan_dahdi.c?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/channels/chan_dahdi.c (original)
+++ team/group/newcdr/channels/chan_dahdi.c Mon Jan 26 17:55:07 2009
@@ -5097,7 +5097,7 @@
 
 							ast_verb(3, "Started three way call on channel %d\n", p->channel);
 							ast_cel_report_event(p->subs[SUB_THREEWAY].owner, CEL_HOOKFLASH, NULL, NULL, chan);
-							
+
 							/* Start music on hold if appropriate */
 							if (ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) {
 								ast_queue_control_data(p->subs[SUB_THREEWAY].owner, AST_CONTROL_HOLD,
@@ -5150,7 +5150,7 @@
 							ast_channel_log("+++++ 3WAY ===== SUB_THREEWAY channel:", p->subs[SUB_THREEWAY].owner);
 							ast_channel_log("+++++ 3WAY ===== SUB_REAL channel:", p->subs[SUB_REAL].owner);
 							ast_channel_log("+++++ 3WAY ===== 'other' channel:", other); */
-							
+
 							/* get the youngest linked id and push it around */
 							if (strcmp(other->uniqueid, p->subs[SUB_REAL].owner->uniqueid) < 0)
 								firstlink = other->uniqueid;
@@ -5160,7 +5160,7 @@
 								firstlink = p->subs[SUB_THREEWAY].owner->uniqueid;
 							if (p->subs[SUB_REAL].owner->_bridge && strcmp(p->subs[SUB_REAL].owner->uniqueid, firstlink) < 0)
 								firstlink = p->subs[SUB_REAL].owner->_bridge->uniqueid;
-							
+
 							/* now, copy it around to all the linkedid fields */
 							ast_string_field_set(p->subs[SUB_THREEWAY].owner, linkedid, firstlink);
 							ast_string_field_set(p->subs[SUB_REAL].owner, linkedid, firstlink);
@@ -5449,10 +5449,10 @@
 	f = dahdi_handle_event(ast);
  
 	/* tell the cdr this zap device hung up */
- 	if (f == NULL) {
- 		ast_set_hangupsource(ast, ast->name, 0);
- 	}
-	
+	if (f == NULL) {
+		ast_set_hangupsource(ast, ast->name, 0);
+	}
+
 	return f;
 }
 

Modified: team/group/newcdr/channels/chan_iax2.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/channels/chan_iax2.c?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/channels/chan_iax2.c (original)
+++ team/group/newcdr/channels/chan_iax2.c Mon Jan 26 17:55:07 2009
@@ -9058,7 +9058,7 @@
 					}
 					ast_set_hangupsource(owner, owner->name, 0);
 				}
-				
+
 				/* Send ack immediately, before we destroy */
 				send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr->ts, NULL, 0,fr->iseqno);
 				iax2_destroy(fr->callno);

Modified: team/group/newcdr/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/channels/chan_sip.c?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/channels/chan_sip.c (original)
+++ team/group/newcdr/channels/chan_sip.c Mon Jan 26 17:55:07 2009
@@ -19243,7 +19243,7 @@
 		const char *xfersound = pbx_builtin_getvar_helper(target.chan1, "ATTENDED_TRANSFER_COMPLETE_SOUND");
 
 		ast_cel_report_event(target.chan1, CEL_ATTENDEDTRANSFER, NULL, transferer_linkedid, target.chan2);
-		
+
 		/* Tell transferer that we're done. */
 		transmit_notify_with_sipfrag(transferer, seqno, "200 OK", TRUE);
 		append_history(transferer, "Xfer", "Refer succeeded");

Modified: team/group/newcdr/configs/cel.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/configs/cel.conf.sample?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/configs/cel.conf.sample (original)
+++ team/group/newcdr/configs/cel.conf.sample Mon Jan 26 17:55:07 2009
@@ -3,7 +3,7 @@
 ;
 ; Channel Event Logging is a mechanism to provide fine-grained event information
 ; that can be used to generate billing information. Such event information can
-; be recorded to databases and files via pluggable backend modules. 
+; be recorded to databases and files via pluggable backend modules.
 ; Useful for billing, fraud prevention, compliance with
 ; Sarbanes-Oxley aka The Enron Act, QOS evaluations, and more.
 ;
@@ -16,13 +16,13 @@
 ;enable=no
 
 ; Define the apps you would like to track.
-;  You can use the keyword "all"-- If you do, please be aware that a tremendous amount of 
+;  You can use the keyword "all"-- If you do, please be aware that a tremendous amount of
 ;  logging will be done, and asterisk performance may be severely impacted.
 
 apps=dial,park
 
 ; Define the events you would like to track.
-; You can use the keyword "all" 
+; You can use the keyword "all"
 ; Possible events:
 ;       all         -- generate entries on all events.
 ;       CHAN_START  -- The time a channel was created

Modified: team/group/newcdr/configs/cel_custom.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/configs/cel_custom.conf.sample?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/configs/cel_custom.conf.sample (original)
+++ team/group/newcdr/configs/cel_custom.conf.sample Mon Jan 26 17:55:07 2009
@@ -3,7 +3,7 @@
 ;
 ; to get your csv output in a format tailored to your liking, uncomment the following
 ; and look for the output in the cel-custom/Master.csv file (usually in /var/log/asterisk).
-; 
+;
 ;
 ;[mappings]
 ;Master.csv => "${eventtype}","${eventtime}","${CALLERID(name)}","${CALLERID(num)}","${CALLERID(ANI)}","${CALLERID(RDNIS)}","${CALLERID(DNID)}","${CHANNEL(exten)}","${CHANNEL(context)}","${CHANNEL(channame)}","${CHANNEL(appname)}","${CHANNEL(appdata)}","${CHANNEL(amaflags)}","${CHANNEL(accountcode)}","${CHANNEL(uniqueid)},"${CHANNEL(peer)}","${CHANNEL(userfield)}"

Modified: team/group/newcdr/doc/cel-doc.tex
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/doc/cel-doc.tex?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/doc/cel-doc.tex (original)
+++ team/group/newcdr/doc/cel-doc.tex Mon Jan 26 17:55:07 2009
@@ -3,12 +3,12 @@
 
 CEL is being written with the hopes that it will help solve some of the problems
 that were difficult to address in CDR records. Some difficulties in CDR generation
-are the fact that the CDR record stores three events: the "Start" time, the "Answer" 
+are the fact that the CDR record stores three events: the "Start" time, the "Answer"
 time, and the "End" time. Billing time is usually the difference between "Answer" and
 "End", and total call duration was the difference in time from "Start" to "End".
-The trouble with this direct and simple approach is the fact that calls can be 
+The trouble with this direct and simple approach is the fact that calls can be
 transferred, put on hold, conferenced, forwarded, etc. In general, those doing billing
-applications in Asterisk find they have to do all sorts of very creative things to 
+applications in Asterisk find they have to do all sorts of very creative things to
 overcome the shortcomings of CDR records, often supplementing the CDR records with
 AGI scripts and manager event filters.
 
@@ -16,17 +16,17 @@
 
 The fundamental assumption is that the Channel is the fundamental communication object in asterisk,
 which basically provides a communication channel between two communication ports. It makes
-sense to have an event system aimed at recording important events on channels. Each 
+sense to have an event system aimed at recording important events on channels. Each
 Event is attached to a channel, like ANSWER or HANGUP. Some events are meant to connect
 two or more channels, like the BRIDGE_START event. Some events, like BLINDTRANSFER, are initiated
 by one channel, but affect two others. These events use the Peer field, like BRIDGE would,
 to point to the target channel.
 
 The design philosophy of CEL is to generate event data that can grouped together to form
-a billing record. This may not be a simple task, but we hope to provide a few different 
+a billing record. This may not be a simple task, but we hope to provide a few different
 examples that could be used as a basis for those involved in this effort.
 
-There are definite parallels between Manager events and CEL events; but there are some differences. 
+There are definite parallels between Manager events and CEL events; but there are some differences.
 Some events that are generated by CEL are not generated by the Manager interface (yet). CEL is
 optimized for databases, and Manager events are not. The focus of CEL is billing. The Manager interface
 is targeted to real-time monitoring and control of asterisk.
@@ -754,7 +754,7 @@
 Cause-txt: Normal Clearing
 \end{verbatim}
 
-And, humorously enough, the above 80 manager events, or 42 CEL events, correspond to the following 
+And, humorously enough, the above 80 manager events, or 42 CEL events, correspond to the following
 two CDR records (at the moment!):
 
 \begin{verbatim}
@@ -805,7 +805,7 @@
        exten         The extension in the dialplan
        context       The context in the dialplan
        channame      The name assigned to the channel in which the event took place
-       appname       The name of the current application 
+       appname       The name of the current application
        appdata       The arguments that will be handed to that application
        amaflags      The AMA flags associated with the event; user assignable.
        accountcode   A user assigned datum (string)
@@ -821,13 +821,13 @@
 \subsection{The CEL Function}
 
 The CEL function parallels the CDR function, for fetching values from the channel or event.
-It has some notable notable differences, though! For instance, CEL data is not stored on the 
+It has some notable notable differences, though! For instance, CEL data is not stored on the
 channel. Well, not much of it, anyway! You can use the CEL function to set the amaflags, accountcode,
 and userfield, which are stored on the channel.
 
 Channel variables are not available for reading from the CEL function, nor can any variable name other
 than what's in the list, be set. CDR's have a structure attached to the channel, where the CDR function
-could access the values stored there, or set the values there. CDR's could store their own variable 
+could access the values stored there, or set the values there. CDR's could store their own variable
 lists, but CEL has no such storage. There is no reason to store any event information, as they are
 immediately output to the various backends at the time they are generated.
 
@@ -858,8 +858,8 @@
      CELGenUserEvent(eventname)
 \end{verbatim}
 
-Please note that there is no restrictions on the name supplied. If it happens to match 
-a standard CEL event name, it will look like that event was generated. This could be 
+Please note that there is no restrictions on the name supplied. If it happens to match
+a standard CEL event name, it will look like that event was generated. This could be
 a blessing or a curse!
 
 

Modified: team/group/newcdr/doc/celdriver.tex
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/doc/celdriver.tex?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/doc/celdriver.tex (original)
+++ team/group/newcdr/doc/celdriver.tex Mon Jan 26 17:55:07 2009
@@ -4,7 +4,7 @@
 
 	Asterisk can currently store Channel Events into an MSSQL database in
 	two different ways:  cel\_odbc or cel\_tds
-	
+
 	Channel Event Records can be stored using unixODBC (which requires
 	the FreeTDS package) [cel\_odbc] or directly by using just the
 	FreeTDS package [cel\_tds]  The following provide some
@@ -85,7 +85,7 @@
 \end{verbatim}
 		And finally, create the 'cel' table in your mssql database.
 \begin{verbatim}
-		CREATE TABLE cel ( 
+		CREATE TABLE cel (
 				[eventtype]     [varchar] (30)          NOT NULL ,
 		        [eventtime]     [datetime]              NOT NULL ,
 		        [cidname]       [varchar] (80)          NOT NULL ,
@@ -252,11 +252,11 @@
 
 \subsubsection{Installation of the Radiusclient library}
    Installation:
-\begin{verbatim}	
+\begin{verbatim}
 	Download the sources from:
-		
+
 	http://developer.berlios.de/projects/radiusclient-ng/
-		
+
 	Untar the source tarball.
 		root at localhost:/usr/local/src# tar xvfz radiusclient-ng-0.5.5.1.tar.gz
 
@@ -268,15 +268,15 @@
 \end{verbatim}
 
 \subsubsection{Configuration of the Radiusclient library}
-	
+
 	By default all the configuration files of the radiusclient library will
 	be in /usr/local/etc/radiusclient-ng directory.
-		
+
 	File "radiusclient.conf"
 		Open the file and find lines containing the following:
 
 			authserver      localhost
-	
+
 	This is the hostname or IP address of the RADIUS server used for 
 	authentication. You will have to change this unless the server is 
 	running on the same host as your Asterisk PBX.
@@ -287,10 +287,10 @@
 	on the same host as your Asterisk PBX.
 
 	File "servers" 
-		
+
 	RADIUS protocol uses simple access control mechanism based on shared
 	secrets that allows RADIUS servers to limit access from RADIUS clients.
-		
+
 	A RADIUS server is configured with a secret string and only RADIUS 
 	clients that have the same secret will be accepted.
 
@@ -304,7 +304,7 @@
 	are going to use.
 
 	File "dictionary"
-			
+
 	Asterisk uses some attributes that are not included in the 
 	dictionary of radiusclient library, therefore it is necessary to add 
 	them. A file called dictionary.digium (kept in the contrib dir)
@@ -321,7 +321,7 @@
 	Download sources tarball from:
 
 		http://freeradius.org/
-			
+
 	Untar, configure, build, and install the server:
 
 \begin{verbatim}
@@ -334,15 +334,15 @@
 
 	All the configuration files of FreeRADIUS server will be in 
 	/usr/local/etc/raddb directory. 
-		
+
 
 \subsubsection{Configuration of the FreeRADIUS Server}
-			
+
 	There are several files that have to be modified to configure the
 	RADIUS server. These are presented next.
 
 	File "clients.conf"
-			
+
 	File /usr/local/etc/raddb/clients.conf contains description of 
 	RADIUS clients that are allowed to use the server. For each of the 
 	clients you need to specify its hostname or IP address and also a 
@@ -362,19 +362,19 @@
 	The file already contains an entry for localhost (127.0.0.1), so if you
 	are running the RADIUS server on the same host as your Asterisk server,
 	then modify the existing entry instead, replacing the default password.
-		
+
 	File "dictionary"
-		
+
 	Note : as of version 1.1.2, the dictionary.digium file ships with FreeRADIUS. 
 	The following procedure brings the dictionary.digium file to previous versions 
 	of FreeRADIUS.
-	
+
 	File /usr/local/etc/raddb/dictionary contains the dictionary of 
 	FreeRADIUS server. You have to add the same dictionary file 
 	(dictionary.digium), which you added to the dictionary of radiusclient-ng
 	library. You can include it into the main file, adding the following line at the
 	end of file '/usr/local/etc/raddb/dictionary':
-		
+
 	\$INCLUDE /path/to/dictionary.digium
 
 	That will include the same new attribute definitions that are used 
@@ -388,7 +388,7 @@
 
         The module will be compiled as long as the radiusclient-ng
         library has been detected on your system.
-	
+
 	By default FreeRADIUS server will log all accounting requests into 
 	/usr/local/var/log/radius/radacct directory in form of plain text files. 
 	The server will create one file for each hostname in the directory. The 

Modified: team/group/newcdr/funcs/func_channel.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/funcs/func_channel.c?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/funcs/func_channel.c (original)
+++ team/group/newcdr/funcs/func_channel.c Mon Jan 26 17:55:07 2009
@@ -338,7 +338,6 @@
 	else if (!strcasecmp(data, "amaflags")) {
 		ast_channel_lock(chan);
 		if(isdigit(*value)) {
-			
 			sscanf(value, "%d", &chan->amaflags);
 		} else if (!strcasecmp(value,"OMIT")){
 			chan->amaflags = 1;
@@ -358,7 +357,7 @@
 		ast_channel_lock(chan);
 		if (ast_true(value)) 
 			ret = ast_channel_trace_enable(chan);
-		else if (ast_false(value)) 
+		else if (ast_false(value))
 			ret = ast_channel_trace_disable(chan);
 		else {
 			ret = -1;

Modified: team/group/newcdr/include/asterisk/cdr.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/include/asterisk/cdr.h?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/include/asterisk/cdr.h (original)
+++ team/group/newcdr/include/asterisk/cdr.h Mon Jan 26 17:55:07 2009
@@ -93,15 +93,15 @@
 	/*! Total time call is up, in seconds */
 	long int billsec;				
 	/*! What happened to the call */
-	long int disposition;			
+	long int disposition;
 	/*! What flags to use */
-	long int amaflags;				
+	long int amaflags;
 	/*! What account number to use */
-	char accountcode[AST_MAX_ACCOUNT_CODE];			
+	char accountcode[AST_MAX_ACCOUNT_CODE];
 	/*! Account number of the last person we talked to */
-	char peeraccount[AST_MAX_ACCOUNT_CODE];			
+	char peeraccount[AST_MAX_ACCOUNT_CODE];
 	/*! flags */
-	unsigned int flags;				
+	unsigned int flags;
 	/*! Unique Channel Identifier
 	 * 150 = 127 (max systemname) + "-" + 10 (epoch timestamp) + "." + 10 (monotonically incrementing integer) + NULL */
 	char uniqueid[150];

Modified: team/group/newcdr/include/asterisk/cel.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/include/asterisk/cel.h?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/include/asterisk/cel.h (original)
+++ team/group/newcdr/include/asterisk/cel.h Mon Jan 26 17:55:07 2009
@@ -41,13 +41,13 @@
 
 enum ast_cel_eventtype {
 	/*! channel birth */
-	  CEL_CHANNEL_START = 1, 
+	  CEL_CHANNEL_START = 1,
 	/*! channel end */
-	  CEL_CHANNEL_END = 2, 
+	  CEL_CHANNEL_END = 2,
 	/*! hangup terminates connection */
-	  CEL_HANGUP = 3, 
+	  CEL_HANGUP = 3,
 	/*! A ringing phone is answered */
-	  CEL_ANSWER = 4, 
+	  CEL_ANSWER = 4,
 	/*! an app starts */
 	  CEL_APP_START = 5,
 	/*! an app ends */
@@ -91,7 +91,7 @@
 	/*! this call was forwarded somewhere else  */
 	  CEL_FORWARD = 25,
 };
-	
+
 /* there was in the early stages of design, a concept of struct ast_cel,
    which would take over the role of ast_cdr; but this was eliminated from
    the design because the event stuff would make this very hard to manage;
@@ -99,7 +99,7 @@
    were easily added to the event arglists */
 
 /*! \brief Return TRUE if CEL subsystem is enabled */
-int check_cel_enabled(void);
+int ast_cel_check_enabled(void);
 
 /*! \brief Allocate a CEL record 
  * Returns a malloc'd ast_cel structure, returns NULL on error (malloc failure)
@@ -132,7 +132,7 @@
 
 
 int ast_cel_engine_init(void);
-inline int track_event(enum ast_cel_eventtype et);
+inline int ast_cel_track_event(enum ast_cel_eventtype et);
 void ast_cel_engine_term(void);
 int ast_cel_engine_reload(void);
 

Modified: team/group/newcdr/main/cel.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/main/cel.c?view=diff&rev=171521&r1=171520&r2=171521
==============================================================================
--- team/group/newcdr/main/cel.c (original)
+++ team/group/newcdr/main/cel.c Mon Jan 26 17:55:07 2009
@@ -2,8 +2,6 @@
  * Asterisk -- An open source telephony toolkit.
  *
  * Copyright (C) 2007, Digium, Inc.
- *
- * Steve Murphy <murf at digium.com>
  *
  * See http://www.asterisk.org for more information about
  * the Asterisk project. Please do not directly contact
@@ -56,7 +54,7 @@
 static struct ast_hashtab *appset = 0;
 static char cel_dateformat[256] = "";
 
-int check_cel_enabled()
+int ast_cel_check_enabled()
 {
 	return cel_enabled;
 }
@@ -64,7 +62,7 @@
 static char *handle_cli_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct ast_event_sub *sub = 0;
-	
+
 	switch (cmd) {
 	case CLI_INIT:
 		e->command = "cel show status";
@@ -79,10 +77,10 @@
 		return CLI_SHOWUSAGE;
 	}
 	ast_cli(a->fd, "CEL logging: %s\n", cel_enabled ? "enabled" : "disabled");
-	
+
 	if (cel_enabled) {
 		ast_event_lock_subscribers(AST_EVENT_CEL);
-		while ((sub=ast_event_next_subscriber(AST_EVENT_CEL, sub))) {
+		while ((sub = ast_event_next_subscriber(AST_EVENT_CEL, sub))) {
 			ast_cli(a->fd, "CEL registered backend: %s\n", ast_event_subscriber_get_description(sub));
 		}
 		ast_event_unlock_subscribers(AST_EVENT_CEL);
@@ -94,66 +92,66 @@
 
 static enum ast_cel_eventtype configevent2eventtype(char *eventname)
 {
-	if (strcasecmp(eventname,"ALL")==0) {
+	if (!strcasecmp(eventname,"ALL")) {
 		return 0;
-	} else if (strcasecmp(eventname,"CHAN_START")==0) {
+	} else if (!strcasecmp(eventname,"CHAN_START")) {
 		return CEL_CHANNEL_START;
-	} else if (strcasecmp(eventname,"CHAN_END")==0) {
+	} else if (!strcasecmp(eventname,"CHAN_END")) {
 		return CEL_CHANNEL_END;
-	} else if (strcasecmp(eventname,"ANSWER")==0) {
+	} else if (!strcasecmp(eventname,"ANSWER")) {
 		return CEL_ANSWER;
-	} else if (strcasecmp(eventname,"HANGUP")==0) {
+	} else if (!strcasecmp(eventname,"HANGUP")) {
 		return CEL_HANGUP;
-	} else if (strcasecmp(eventname,"APP_START")==0) {
+	} else if (!strcasecmp(eventname,"APP_START")) {
 		return CEL_APP_START;
-	} else if (strcasecmp(eventname,"APP_END")==0) {
+	} else if (!strcasecmp(eventname,"APP_END")) {
 		return CEL_APP_END;
-	} else if (strcasecmp(eventname,"BRIDGE_START")==0) {
+	} else if (!strcasecmp(eventname,"BRIDGE_START")) {
 		return CEL_BRIDGE_START;
-	} else if (strcasecmp(eventname,"BRIDGE_END")==0) {
+	} else if (!strcasecmp(eventname,"BRIDGE_END")) {
 		return CEL_BRIDGE_END;
-	} else if (strcasecmp(eventname,"BRIDGE_UPDATE")==0) {
+	} else if (!strcasecmp(eventname,"BRIDGE_UPDATE")) {
 		return CEL_BRIDGE_UPDATE;
-	} else if (strcasecmp(eventname,"CONF_START")==0) {
+	} else if (!strcasecmp(eventname,"CONF_START")) {
 		return CEL_CONF_START;
-	} else if (strcasecmp(eventname,"CONF_END")==0) {
+	} else if (!strcasecmp(eventname,"CONF_END")) {
 		return CEL_CONF_END;
-	} else if (strcasecmp(eventname,"PARK_START")==0) {
+	} else if (!strcasecmp(eventname,"PARK_START")) {
 		return CEL_PARK_START;
-	} else if (strcasecmp(eventname,"PARK_END")==0) {
+	} else if (!strcasecmp(eventname,"PARK_END")) {
 		return CEL_PARK_END;
-	} else if (strcasecmp(eventname,"TRANSFER")==0) {
+	} else if (!strcasecmp(eventname,"TRANSFER")) {
 		return CEL_TRANSFER;
-	} else if (strcasecmp(eventname,"USER_DEFINED")==0) {
+	} else if (!strcasecmp(eventname,"USER_DEFINED")) {
 		return CEL_USER_DEFINED;
-	} else if (strcasecmp(eventname,"CONF_ENTER")==0) {
+	} else if (!strcasecmp(eventname,"CONF_ENTER")) {
 		return CEL_CONF_ENTER;
-	} else if (strcasecmp(eventname,"CONF_EXIT")==0) {
+	} else if (!strcasecmp(eventname,"CONF_EXIT")) {
 		return CEL_CONF_EXIT;
-	} else if (strcasecmp(eventname,"BLINDTRANSFER")==0) {
+	} else if (!strcasecmp(eventname,"BLINDTRANSFER")) {
 		return CEL_BLINDTRANSFER;
-	} else if (strcasecmp(eventname,"ATTENDEDTRANSFER")==0) {
+	} else if (!strcasecmp(eventname,"ATTENDEDTRANSFER")) {
 		return CEL_ATTENDEDTRANSFER;
-	} else if (strcasecmp(eventname,"PICKUP")==0) {
+	} else if (!strcasecmp(eventname,"PICKUP")) {
 		return CEL_PICKUP;
-	} else if (strcasecmp(eventname,"FORWARD")==0) {
+	} else if (!strcasecmp(eventname,"FORWARD")) {
 		return CEL_FORWARD;
-	} else if (strcasecmp(eventname,"3WAY_START")==0) {
+	} else if (!strcasecmp(eventname,"3WAY_START")) {
 		return CEL_3WAY_START;
-	} else if (strcasecmp(eventname,"3WAY_END")==0) {
+	} else if (!strcasecmp(eventname,"3WAY_END")) {
 		return CEL_3WAY_END;
-	} else if (strcasecmp(eventname,"HOOKFLASH")==0) {
+	} else if (!strcasecmp(eventname,"HOOKFLASH")) {
 		return CEL_HOOKFLASH;
-	} else if (strcasecmp(eventname,"LINKEDID_END")==0) {
+	} else if (!strcasecmp(eventname,"LINKEDID_END")) {
 		return CEL_LINKEDID_END;
 	} else  {
 		return -1;
 	}
 }
 
-inline int track_event(enum ast_cel_eventtype et)
-{
-	return  (eventset & (1<<(int)et));
+inline int ast_cel_track_event(enum ast_cel_eventtype et)
+{
+	return (eventset & (1 << (int)et));
 }
 
 
@@ -164,7 +162,7 @@
 	const char *eventlist;
 	const char *applist;
 	int was_enabled;
-	int res=0;
+	int res = 0;
 	enum ast_cel_eventtype et;
 	struct ast_flags config_flags = { CONFIG_FLAG_FILEUNCHANGED };
 
@@ -176,14 +174,13 @@
 		/* first, free all the entries */
 		struct ast_hashtab_iter *it;
 		it = ast_hashtab_start_traversal(appset);
-		while ((str=ast_hashtab_next(it))) {
+		while ((str = ast_hashtab_next(it))) {
 			free(str);
 		}
 		ast_hashtab_destroy(appset, NULL);
-		appset=0;
-	}
-	
-	
+		appset = 0;
+	}
+
 	if ((config = ast_config_load2("cel.conf", "cel", config_flags))) {
 		if (config == CONFIG_STATUS_FILEUNCHANGED) {
 			return 0;
@@ -254,7 +251,7 @@
 			}
 			if ((applist = ast_variable_retrieve(config, "general", "apps"))) {
 				char *t1, *t2, *t3, *myapplist = ast_strdup(applist);
-				if (!track_event(CEL_APP_START) && !track_event(CEL_APP_END)) {
+				if (!ast_cel_track_event(CEL_APP_START) && !ast_cel_track_event(CEL_APP_END)) {
 					ast_log(LOG_ERROR, "An apps= config line, but not tracking APP events!\n");
 				} else {
 					int commacount = 0;
@@ -279,12 +276,11 @@
 						} else {
 							*t2 = 0;
 						}
-						
+
 						/*push t1 to the first non-blank char */
 						while (t1 && *t1 && isspace(*t1)) {
 							t1++;
-						}
-						
+						}					
 						if (t2 == t1) {

[... 378 lines stripped ...]



More information about the asterisk-commits mailing list