Begin on a crusade to end trailing whitespace!

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158072 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Terry Wilson
2008-11-20 17:48:58 +00:00
parent ad918da94f
commit 4f8242904a
10 changed files with 61 additions and 61 deletions

View File

@@ -1,6 +1,6 @@
# #
# Asterisk -- A telephony toolkit for Linux. # Asterisk -- A telephony toolkit for Linux.
# #
# Makefile for CDR backends # Makefile for CDR backends
# #
# Copyright (C) 1999-2006, Digium, Inc. # Copyright (C) 1999-2006, Digium, Inc.

View File

@@ -19,7 +19,7 @@
/*! \file /*! \file
* *
* \brief Adaptive ODBC CDR backend * \brief Adaptive ODBC CDR backend
* *
* \author Tilghman Lesher <cdr_adaptive_odbc__v1@the-tilghman.com> * \author Tilghman Lesher <cdr_adaptive_odbc__v1@the-tilghman.com>
* \ingroup cdr_drivers * \ingroup cdr_drivers
*/ */

View File

@@ -23,7 +23,7 @@
* \brief Comma Separated Value CDR records. * \brief Comma Separated Value CDR records.
* *
* \author Mark Spencer <markster@digium.com> * \author Mark Spencer <markster@digium.com>
* *
* \arg See also \ref AstCDR * \arg See also \ref AstCDR
* \ingroup cdr_drivers * \ingroup cdr_drivers
*/ */
@@ -62,26 +62,26 @@ static char *config = "cdr.conf";
"accountcode", accountcode is the account name of detail records, Master.csv contains all records * "accountcode", accountcode is the account name of detail records, Master.csv contains all records *
Detail records are configured on a channel basis, IAX and SIP are determined by user * Detail records are configured on a channel basis, IAX and SIP are determined by user *
DAHDI is determined by channel in dahdi.conf DAHDI is determined by channel in dahdi.conf
"source", "source",
"destination", "destination",
"destination context", "destination context",
"callerid", "callerid",
"channel", "channel",
"destination channel", (if applicable) "destination channel", (if applicable)
"last application", Last application run on the channel "last application", Last application run on the channel
"last app argument", argument to the last channel "last app argument", argument to the last channel
"start time", "start time",
"answer time", "answer time",
"end time", "end time",
duration, Duration is the whole length that the entire call lasted. ie. call rx'd to hangup duration, Duration is the whole length that the entire call lasted. ie. call rx'd to hangup
"end time" minus "start time" "end time" minus "start time"
billable seconds, the duration that a call was up after other end answered which will be <= to duration billable seconds, the duration that a call was up after other end answered which will be <= to duration
"end time" minus "answer time" "end time" minus "answer time"
"disposition", ANSWERED, NO ANSWER, BUSY "disposition", ANSWERED, NO ANSWER, BUSY
"amaflags", DOCUMENTATION, BILL, IGNORE etc, specified on a per channel basis like accountcode. "amaflags", DOCUMENTATION, BILL, IGNORE etc, specified on a per channel basis like accountcode.
"uniqueid", unique call identifier "uniqueid", unique call identifier
"userfield" user field set via SetCDRUserField "userfield" user field set via SetCDRUserField
----------------------------------------------------------*/ ----------------------------------------------------------*/
static char *name = "csv"; static char *name = "csv";
@@ -110,7 +110,7 @@ static int load_config(int reload)
ast_config_destroy(cfg); ast_config_destroy(cfg);
return 0; return 0;
} }
if ((tmp = ast_variable_retrieve(cfg, "csv", "usegmtime"))) { if ((tmp = ast_variable_retrieve(cfg, "csv", "usegmtime"))) {
usegmtime = ast_true(tmp); usegmtime = ast_true(tmp);
if (usegmtime) if (usegmtime)
@@ -238,7 +238,7 @@ static int build_csv_record(char *buf, size_t bufsize, struct ast_cdr *cdr)
append_string(buf, cdr->uniqueid, bufsize); append_string(buf, cdr->uniqueid, bufsize);
/* append the user field */ /* append the user field */
if(loguserfield) if(loguserfield)
append_string(buf, cdr->userfield,bufsize); append_string(buf, cdr->userfield,bufsize);
/* If we hit the end of our buffer, log an error */ /* If we hit the end of our buffer, log an error */
if (strlen(buf) < bufsize - 5) { if (strlen(buf) < bufsize - 5) {
/* Trim off trailing comma */ /* Trim off trailing comma */
@@ -290,7 +290,7 @@ static int csv_log(struct ast_cdr *cdr)
ast_log(LOG_WARNING, "Unable to create CSV record in %d bytes. CDR not recorded!\n", (int)sizeof(buf)); ast_log(LOG_WARNING, "Unable to create CSV record in %d bytes. CDR not recorded!\n", (int)sizeof(buf));
return 0; return 0;
} }
/* because of the absolutely unconditional need for the /* because of the absolutely unconditional need for the
highest reliability possible in writing billing records, highest reliability possible in writing billing records,
we open write and close the log file each time */ we open write and close the log file each time */
@@ -305,7 +305,7 @@ static int csv_log(struct ast_cdr *cdr)
ast_mutex_unlock(&mf_lock); ast_mutex_unlock(&mf_lock);
ast_log(LOG_ERROR, "Unable to re-open master file %s : %s\n", csvmaster, strerror(errno)); ast_log(LOG_ERROR, "Unable to re-open master file %s : %s\n", csvmaster, strerror(errno));
} }
if (!ast_strlen_zero(cdr->accountcode)) { if (!ast_strlen_zero(cdr->accountcode)) {
if (writefile(buf, cdr->accountcode)) if (writefile(buf, cdr->accountcode))
ast_log(LOG_WARNING, "Unable to write CSV record to account file '%s' : %s\n", cdr->accountcode, strerror(errno)); ast_log(LOG_WARNING, "Unable to write CSV record to account file '%s' : %s\n", cdr->accountcode, strerror(errno));
@@ -324,7 +324,7 @@ static int unload_module(void)
static int load_module(void) static int load_module(void)
{ {
int res; int res;
if(!load_config(0)) if(!load_config(0))
return AST_MODULE_LOAD_DECLINE; return AST_MODULE_LOAD_DECLINE;

View File

@@ -57,7 +57,7 @@ static char *name = "cdr-custom";
static char master[PATH_MAX]; static char master[PATH_MAX];
static char format[1024]=""; static char format[1024]="";
static int load_config(int reload) static int load_config(int reload)
{ {
struct ast_config *cfg; struct ast_config *cfg;
struct ast_variable *var; struct ast_variable *var;
@@ -85,7 +85,7 @@ static int load_config(int reload)
strcat(format,"\n"); strcat(format,"\n");
snprintf(master, sizeof(master),"%s/%s/%s", ast_config_AST_LOG_DIR, name, var->name); snprintf(master, sizeof(master),"%s/%s/%s", ast_config_AST_LOG_DIR, name, var->name);
if (var->next) { if (var->next) {
ast_log(LOG_NOTICE, "Sorry, only one mapping is supported at this time, mapping '%s' will be ignored at line %d.\n", var->next->name, var->next->lineno); ast_log(LOG_NOTICE, "Sorry, only one mapping is supported at this time, mapping '%s' will be ignored at line %d.\n", var->next->name, var->next->lineno);
break; break;
} }
} else } else
@@ -101,7 +101,7 @@ static int load_config(int reload)
ast_log(LOG_WARNING, "Failed to load configuration file. Module not activated.\n"); ast_log(LOG_WARNING, "Failed to load configuration file. Module not activated.\n");
} }
ast_mutex_unlock(&lock); ast_mutex_unlock(&lock);
return res; return res;
} }
@@ -158,7 +158,7 @@ static int load_module(void)
if (res) if (res)
ast_log(LOG_ERROR, "Unable to register custom CDR handling\n"); ast_log(LOG_ERROR, "Unable to register custom CDR handling\n");
return res; return res;
} else } else
return AST_MODULE_LOAD_DECLINE; return AST_MODULE_LOAD_DECLINE;
} }

View File

@@ -17,7 +17,7 @@
/*! \file /*! \file
* *
* \brief Asterisk Call Manager CDR records. * \brief Asterisk Call Manager CDR records.
* *
* See also * See also
* \arg \ref AstCDR * \arg \ref AstCDR
* \arg \ref AstAMI * \arg \ref AstAMI
@@ -80,14 +80,14 @@ static int load_config(int reload)
enablecdr = 0; enablecdr = 0;
return 0; return 0;
} }
while ( (cat = ast_category_browse(cfg, cat)) ) { while ( (cat = ast_category_browse(cfg, cat)) ) {
if (!strcasecmp(cat, "general")) { if (!strcasecmp(cat, "general")) {
v = ast_variable_browse(cfg, cat); v = ast_variable_browse(cfg, cat);
while (v) { while (v) {
if (!strcasecmp(v->name, "enabled")) if (!strcasecmp(v->name, "enabled"))
newenablecdr = ast_true(v->value); newenablecdr = ast_true(v->value);
v = v->next; v = v->next;
} }
} else if (!strcasecmp(cat, "mappings")) { } else if (!strcasecmp(cat, "mappings")) {
@@ -102,13 +102,13 @@ static int load_config(int reload)
ast_log(LOG_WARNING, "No more buffer space to add other custom fields\n"); ast_log(LOG_WARNING, "No more buffer space to add other custom fields\n");
break; break;
} }
} }
v = v->next; v = v->next;
} }
} }
} }
ast_config_destroy(cfg); ast_config_destroy(cfg);
if (enablecdr && !newenablecdr) if (enablecdr && !newenablecdr)
@@ -134,7 +134,7 @@ static int manager_log(struct ast_cdr *cdr)
ast_localtime(&cdr->start, &timeresult, NULL); ast_localtime(&cdr->start, &timeresult, NULL);
ast_strftime(strStartTime, sizeof(strStartTime), DATE_FORMAT, &timeresult); ast_strftime(strStartTime, sizeof(strStartTime), DATE_FORMAT, &timeresult);
if (cdr->answer.tv_sec) { if (cdr->answer.tv_sec) {
ast_localtime(&cdr->answer, &timeresult, NULL); ast_localtime(&cdr->answer, &timeresult, NULL);
ast_strftime(strAnswerTime, sizeof(strAnswerTime), DATE_FORMAT, &timeresult); ast_strftime(strAnswerTime, sizeof(strAnswerTime), DATE_FORMAT, &timeresult);

View File

@@ -19,7 +19,7 @@
/*! \file /*! \file
* *
* \brief ODBC CDR Backend * \brief ODBC CDR Backend
* *
* \author Brian K. West <brian@bkw.org> * \author Brian K. West <brian@bkw.org>
* *
* See also: * See also:
@@ -115,7 +115,7 @@ static SQLHSTMT execute_cb(struct odbc_obj *obj, void *data)
} }
ODBC_res = SQLExecDirect(stmt, (unsigned char *)sqlcmd, SQL_NTS); ODBC_res = SQLExecDirect(stmt, (unsigned char *)sqlcmd, SQL_NTS);
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) { if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) {
ast_verb(11, "cdr_odbc: Error in ExecDirect: %d\n", ODBC_res); ast_verb(11, "cdr_odbc: Error in ExecDirect: %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_STMT, stmt); SQLFreeHandle(SQL_HANDLE_STMT, stmt);
@@ -167,7 +167,7 @@ static int odbc_load_module(int reload)
break; break;
} else if (cfg == CONFIG_STATUS_FILEUNCHANGED) } else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
break; break;
var = ast_variable_browse(cfg, "global"); var = ast_variable_browse(cfg, "global");
if (!var) { if (!var) {
/* nothing configured */ /* nothing configured */

View File

@@ -3,8 +3,8 @@
* *
* Copyright (C) 2003 - 2006 * Copyright (C) 2003 - 2006
* *
* Matthew D. Hardeman <mhardemn@papersoft.com> * Matthew D. Hardeman <mhardemn@papersoft.com>
* Adapted from the MySQL CDR logger originally by James Sharp * Adapted from the MySQL CDR logger originally by James Sharp
* *
* Modified September 2003 * Modified September 2003
* Matthew D. Hardeman <mhardemn@papersoft.com> * Matthew D. Hardeman <mhardemn@papersoft.com>
@@ -22,9 +22,9 @@
/*! \file /*! \file
* *
* \brief PostgreSQL CDR logger * \brief PostgreSQL CDR logger
* *
* \author Matthew D. Hardeman <mhardemn@papersoft.com> * \author Matthew D. Hardeman <mhardemn@papersoft.com>
* \extref PostgreSQL http://www.postgresql.org/ * \extref PostgreSQL http://www.postgresql.org/
* *
* See also * See also
@@ -125,7 +125,7 @@ static int pgsql_log(struct ast_cdr *cdr)
struct columns *cur; struct columns *cur;
struct ast_str *sql = ast_str_create(maxsize), *sql2 = ast_str_create(maxsize2); struct ast_str *sql = ast_str_create(maxsize), *sql2 = ast_str_create(maxsize2);
char buf[257], escapebuf[513], *value; char buf[257], escapebuf[513], *value;
if (!sql || !sql2) { if (!sql || !sql2) {
if (sql) { if (sql) {
ast_free(sql); ast_free(sql);
@@ -138,7 +138,7 @@ static int pgsql_log(struct ast_cdr *cdr)
ast_str_set(&sql, 0, "INSERT INTO %s (", table); ast_str_set(&sql, 0, "INSERT INTO %s (", table);
ast_str_set(&sql2, 0, " VALUES ("); ast_str_set(&sql2, 0, " VALUES (");
AST_RWLIST_RDLOCK(&psql_columns); AST_RWLIST_RDLOCK(&psql_columns);
AST_RWLIST_TRAVERSE(&psql_columns, cur, list) { AST_RWLIST_TRAVERSE(&psql_columns, cur, list) {
/* For fields not set, simply skip them */ /* For fields not set, simply skip them */
@@ -156,7 +156,7 @@ static int pgsql_log(struct ast_cdr *cdr)
} }
continue; continue;
} }
LENGTHEN_BUF1(strlen(cur->name) + 2); LENGTHEN_BUF1(strlen(cur->name) + 2);
ast_str_append(&sql, 0, "\"%s\",", cur->name); ast_str_append(&sql, 0, "\"%s\",", cur->name);

View File

@@ -21,7 +21,7 @@
* \brief RADIUS CDR Support * \brief RADIUS CDR Support
* \author Philippe Sultan * \author Philippe Sultan
* \extref The Radius Client Library - http://developer.berlios.de/projects/radiusclient-ng/ * \extref The Radius Client Library - http://developer.berlios.de/projects/radiusclient-ng/
* *
* \arg See also \ref AstCDR * \arg See also \ref AstCDR
* \ingroup cdr_drivers * \ingroup cdr_drivers
*/ */
@@ -135,27 +135,27 @@ static int build_radius_record(VALUE_PAIR **tosend, struct ast_cdr *cdr)
/* Start Time */ /* Start Time */
ast_strftime(timestr, sizeof(timestr), DATE_FORMAT, ast_strftime(timestr, sizeof(timestr), DATE_FORMAT,
ast_localtime(&cdr->start, &tm, ast_localtime(&cdr->start, &tm,
ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME) ? "GMT" : NULL)); ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME) ? "GMT" : NULL));
if (!rc_avpair_add(rh, tosend, PW_AST_START_TIME, timestr, strlen(timestr), VENDOR_CODE)) if (!rc_avpair_add(rh, tosend, PW_AST_START_TIME, timestr, strlen(timestr), VENDOR_CODE))
return -1; return -1;
/* Answer Time */ /* Answer Time */
ast_strftime(timestr, sizeof(timestr), DATE_FORMAT, ast_strftime(timestr, sizeof(timestr), DATE_FORMAT,
ast_localtime(&cdr->answer, &tm, ast_localtime(&cdr->answer, &tm,
ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME) ? "GMT" : NULL)); ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME) ? "GMT" : NULL));
if (!rc_avpair_add(rh, tosend, PW_AST_ANSWER_TIME, timestr, strlen(timestr), VENDOR_CODE)) if (!rc_avpair_add(rh, tosend, PW_AST_ANSWER_TIME, timestr, strlen(timestr), VENDOR_CODE))
return -1; return -1;
/* End Time */ /* End Time */
ast_strftime(timestr, sizeof(timestr), DATE_FORMAT, ast_strftime(timestr, sizeof(timestr), DATE_FORMAT,
ast_localtime(&cdr->end, &tm, ast_localtime(&cdr->end, &tm,
ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME) ? "GMT" : NULL)); ast_test_flag(&global_flags, RADIUS_FLAG_USEGMTIME) ? "GMT" : NULL));
if (!rc_avpair_add(rh, tosend, PW_AST_END_TIME, timestr, strlen(timestr), VENDOR_CODE)) if (!rc_avpair_add(rh, tosend, PW_AST_END_TIME, timestr, strlen(timestr), VENDOR_CODE))
return -1; return -1;
/* Duration */ /* Duration */
if (!rc_avpair_add(rh, tosend, PW_AST_DURATION, &cdr->duration, 0, VENDOR_CODE)) if (!rc_avpair_add(rh, tosend, PW_AST_DURATION, &cdr->duration, 0, VENDOR_CODE))
return -1; return -1;
@@ -186,7 +186,7 @@ static int build_radius_record(VALUE_PAIR **tosend, struct ast_cdr *cdr)
} }
/* Setting Acct-Session-Id & User-Name attributes for proper generation /* Setting Acct-Session-Id & User-Name attributes for proper generation
of Acct-Unique-Session-Id on server side */ of Acct-Unique-Session-Id on server side */
/* Channel */ /* Channel */
if (!rc_avpair_add(rh, tosend, PW_USER_NAME, &cdr->channel, strlen(cdr->channel), 0)) if (!rc_avpair_add(rh, tosend, PW_USER_NAME, &cdr->channel, strlen(cdr->channel), 0))
return -1; return -1;
@@ -207,7 +207,7 @@ static int radius_log(struct ast_cdr *cdr)
ast_debug(1, "Unable to create RADIUS record. CDR not recorded!\n"); ast_debug(1, "Unable to create RADIUS record. CDR not recorded!\n");
return result; return result;
} }
result = rc_acct(rh, 0, tosend); result = rc_acct(rh, 0, tosend);
if (result != OK_RC) if (result != OK_RC)
ast_log(LOG_ERROR, "Failed to record Radius CDR record!\n"); ast_log(LOG_ERROR, "Failed to record Radius CDR record!\n");
@@ -235,9 +235,9 @@ static int load_module(void)
if ((tmp = ast_variable_retrieve(cfg, "radius", "radiuscfg"))) if ((tmp = ast_variable_retrieve(cfg, "radius", "radiuscfg")))
ast_copy_string(radiuscfg, tmp, sizeof(radiuscfg)); ast_copy_string(radiuscfg, tmp, sizeof(radiuscfg));
ast_config_destroy(cfg); ast_config_destroy(cfg);
} else } else
return AST_MODULE_LOAD_DECLINE; return AST_MODULE_LOAD_DECLINE;
/* start logging */ /* start logging */
rc_openlog("asterisk"); rc_openlog("asterisk");
@@ -252,7 +252,7 @@ static int load_module(void)
ast_log(LOG_NOTICE, "Cannot load radiusclient-ng dictionary file.\n"); ast_log(LOG_NOTICE, "Cannot load radiusclient-ng dictionary file.\n");
return AST_MODULE_LOAD_DECLINE; return AST_MODULE_LOAD_DECLINE;
} }
res = ast_cdr_register(name, desc, radius_log); res = ast_cdr_register(name, desc, radius_log);
return AST_MODULE_LOAD_SUCCESS; return AST_MODULE_LOAD_SUCCESS;
} }

View File

@@ -20,14 +20,14 @@
/*! \file /*! \file
* *
* \brief Store CDR records in a SQLite database. * \brief Store CDR records in a SQLite database.
* *
* \author Holger Schurig <hs4233@mail.mn-solutions.de> * \author Holger Schurig <hs4233@mail.mn-solutions.de>
* \extref SQLite http://www.sqlite.org/ * \extref SQLite http://www.sqlite.org/
* *
* See also * See also
* \arg \ref Config_cdr * \arg \ref Config_cdr
* \arg http://www.sqlite.org/ * \arg http://www.sqlite.org/
* *
* Creates the database and table on-the-fly * Creates the database and table on-the-fly
* \ingroup cdr_drivers * \ingroup cdr_drivers
* *
@@ -151,7 +151,7 @@ static int sqlite_log(struct ast_cdr *cdr)
break; break;
usleep(200); usleep(200);
} }
if (zErr) { if (zErr) {
ast_log(LOG_ERROR, "cdr_sqlite: %s\n", zErr); ast_log(LOG_ERROR, "cdr_sqlite: %s\n", zErr);
ast_free(zErr); ast_free(zErr);
@@ -199,7 +199,7 @@ static int load_module(void)
/* TODO: here we should probably create an index */ /* TODO: here we should probably create an index */
} }
res = ast_cdr_register(name, ast_module_info->description, sqlite_log); res = ast_cdr_register(name, ast_module_info->description, sqlite_log);
if (res) { if (res) {
ast_log(LOG_ERROR, "Unable to register SQLite CDR handling\n"); ast_log(LOG_ERROR, "Unable to register SQLite CDR handling\n");

View File

@@ -21,10 +21,10 @@
* \brief Custom SQLite3 CDR records. * \brief Custom SQLite3 CDR records.
* *
* \author Adapted by Alejandro Rios <alejandro.rios@avatar.com.co> and * \author Adapted by Alejandro Rios <alejandro.rios@avatar.com.co> and
* Russell Bryant <russell@digium.com> from * Russell Bryant <russell@digium.com> from
* cdr_mysql_custom by Edward Eastman <ed@dm3.co.uk>, * cdr_mysql_custom by Edward Eastman <ed@dm3.co.uk>,
* and cdr_sqlite by Holger Schurig <hs4233@mail.mn-solutions.de> * and cdr_sqlite by Holger Schurig <hs4233@mail.mn-solutions.de>
* *
* *
* \arg See also \ref AstCDR * \arg See also \ref AstCDR
* *
@@ -178,7 +178,7 @@ static int load_config(int reload)
ast_config_destroy(cfg); ast_config_destroy(cfg);
return 0; return 0;
} }
/* Mapping must have a table name */ /* Mapping must have a table name */
tmp = ast_variable_retrieve(cfg, "master", "table"); tmp = ast_variable_retrieve(cfg, "master", "table");
if (!ast_strlen_zero(tmp)) if (!ast_strlen_zero(tmp))