[asterisk-commits] pabelanger: branch pabelanger/CDRSettings r335013 - /team/pabelanger/CDRSetti...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 8 19:20:18 CDT 2011
Author: pabelanger
Date: Thu Sep 8 19:20:15 2011
New Revision: 335013
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=335013
Log:
Update cdr_csv.c
Modified:
team/pabelanger/CDRSettings/cdr/cdr_csv.c
Modified: team/pabelanger/CDRSettings/cdr/cdr_csv.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/CDRSettings/cdr/cdr_csv.c?view=diff&rev=335013&r1=335012&r2=335013
==============================================================================
--- team/pabelanger/CDRSettings/cdr/cdr_csv.c (original)
+++ team/pabelanger/CDRSettings/cdr/cdr_csv.c Thu Sep 8 19:20:15 2011
@@ -50,7 +50,7 @@
#define DATE_FORMAT "%Y-%m-%d %T"
static int usegmtime = 0;
-static int accountlogs;
+static int accountlogs = 1;
static int loguniqueid = 0;
static int loguserfield = 0;
static int loaded = 0;
@@ -95,52 +95,53 @@
static int load_config(int reload)
{
struct ast_config *cfg;
- struct ast_variable *var;
- const char *tmp;
+ struct ast_variable *v;
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
if (!(cfg = ast_config_load(config, config_flags)) || cfg == CONFIG_STATUS_FILEINVALID) {
ast_log(LOG_WARNING, "unable to load config: %s\n", config);
return 0;
- } else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+ } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
return 1;
+ }
accountlogs = 1;
usegmtime = 0;
loguniqueid = 0;
loguserfield = 0;
- if (!(var = ast_variable_browse(cfg, "csv"))) {
+ if (!(v = ast_variable_browse(cfg, "csv"))) {
ast_config_destroy(cfg);
return 0;
}
- if ((tmp = ast_variable_retrieve(cfg, "csv", "usegmtime"))) {
- usegmtime = ast_true(tmp);
- if (usegmtime)
- ast_debug(1, "logging time in GMT\n");
- }
-
- /* Turn on/off separate files per accountcode. Default is on (as before) */
- if ((tmp = ast_variable_retrieve(cfg, "csv", "accountlogs"))) {
- accountlogs = ast_true(tmp);
- if (accountlogs) {
- ast_debug(1, "logging in separate files per accountcode\n");
- }
- }
-
- if ((tmp = ast_variable_retrieve(cfg, "csv", "loguniqueid"))) {
- loguniqueid = ast_true(tmp);
- if (loguniqueid)
- ast_debug(1, "logging CDR field UNIQUEID\n");
- }
-
- if ((tmp = ast_variable_retrieve(cfg, "csv", "loguserfield"))) {
- loguserfield = ast_true(tmp);
- if (loguserfield)
- ast_debug(1, "logging CDR user-defined field\n");
- }
-
+ for (; v; v = v->next) {
+ if (!strcasecmp(v->name, "usegmtime")) {
+ usegmtime = ast_true(v->value);
+ if (usegmtime) {
+ ast_debug(1, "logging time in GMT\n");
+ }
+ }
+ /* Turn on/off separate files per accountcode. Default is on (as before) */
+ if (!strcasecmp(v->name, "accountlogs")) {
+ accountlogs = ast_true(v->value);
+ if (accountlogs) {
+ ast_debug(1, "logging in separate files per accountcode\n");
+ }
+ }
+ if (!strcasecmp(v->name, "loguniqueid")) {
+ loguniqueid = ast_true(v->value);
+ if (loguniqueid) {
+ ast_debug(1, "logging CDR field UNIQUEID\n");
+ }
+ }
+ if (!strcasecmp(v->name, "loguserfield")) {
+ loguserfield = ast_true(v->value);
+ if (loguserfield) {
+ ast_debug(1, "logging CDR user-defined field\n");
+ }
+ }
+ }
ast_config_destroy(cfg);
return 1;
}
@@ -337,8 +338,9 @@
{
int res;
- if(!load_config(0))
+ if (!load_config(0)) {
return AST_MODULE_LOAD_DECLINE;
+ }
if ((res = ast_cdr_register(name, ast_module_info->description, csv_log))) {
ast_log(LOG_ERROR, "Unable to register CSV CDR handling\n");
More information about the asterisk-commits
mailing list