summaryrefslogtreecommitdiff
path: root/cdr
diff options
context:
space:
mode:
Diffstat (limited to 'cdr')
-rw-r--r--cdr/cdr_adaptive_odbc.c6
-rw-r--r--cdr/cdr_csv.c5
-rw-r--r--cdr/cdr_custom.c12
-rw-r--r--cdr/cdr_manager.c2
-rw-r--r--cdr/cdr_odbc.c9
-rw-r--r--cdr/cdr_pgsql.c12
-rw-r--r--cdr/cdr_radius.c4
-rw-r--r--cdr/cdr_syslog.c14
-rw-r--r--cdr/cdr_tds.c8
9 files changed, 36 insertions, 36 deletions
diff --git a/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c
index 4bf3602cb..a590fb32a 100644
--- a/cdr/cdr_adaptive_odbc.c
+++ b/cdr/cdr_adaptive_odbc.c
@@ -433,7 +433,7 @@ static int odbc_log(struct ast_cdr *cdr)
ast_strftime(colbuf, sizeof(colbuf), "%Y-%m-%d %H:%M:%S", &tm);
colptr = colbuf;
} else {
- ast_cdr_getvar(cdr, entry->cdrname, &colptr, colbuf, sizeof(colbuf), 0, datefield ? 0 : 1);
+ ast_cdr_format_var(cdr, entry->cdrname, &colptr, colbuf, sizeof(colbuf), datefield ? 0 : 1);
}
if (colptr) {
@@ -472,9 +472,9 @@ static int odbc_log(struct ast_cdr *cdr)
* form (but only when we're dealing with a character-based field).
*/
if (strcasecmp(entry->name, "disposition") == 0) {
- ast_cdr_getvar(cdr, entry->name, &colptr, colbuf, sizeof(colbuf), 0, 0);
+ ast_cdr_format_var(cdr, entry->name, &colptr, colbuf, sizeof(colbuf), 0);
} else if (strcasecmp(entry->name, "amaflags") == 0) {
- ast_cdr_getvar(cdr, entry->name, &colptr, colbuf, sizeof(colbuf), 0, 0);
+ ast_cdr_format_var(cdr, entry->name, &colptr, colbuf, sizeof(colbuf), 0);
}
/* Truncate too-long fields */
diff --git a/cdr/cdr_csv.c b/cdr/cdr_csv.c
index 5cfde82d7..a6f8a4dc0 100644
--- a/cdr/cdr_csv.c
+++ b/cdr/cdr_csv.c
@@ -234,7 +234,7 @@ static int build_csv_record(char *buf, size_t bufsize, struct ast_cdr *cdr)
/* Disposition */
append_string(buf, ast_cdr_disp2str(cdr->disposition), bufsize);
/* AMA Flags */
- append_string(buf, ast_cdr_flags2str(cdr->amaflags), bufsize);
+ append_string(buf, ast_channel_amaflags2string(cdr->amaflags), bufsize);
/* Unique ID */
if (loguniqueid)
append_string(buf, cdr->uniqueid, bufsize);
@@ -285,9 +285,6 @@ static int csv_log(struct ast_cdr *cdr)
char buf[1024];
char csvmaster[PATH_MAX];
snprintf(csvmaster, sizeof(csvmaster),"%s/%s/%s", ast_config_AST_LOG_DIR, CSV_LOG_DIR, CSV_MASTER);
-#if 0
- printf("[CDR] %s ('%s' -> '%s') Dur: %ds Bill: %ds Disp: %s Flags: %s Account: [%s]\n", cdr->channel, cdr->src, cdr->dst, cdr->duration, cdr->billsec, ast_cdr_disp2str(cdr->disposition), ast_cdr_flags2str(cdr->amaflags), cdr->accountcode);
-#endif
if (build_csv_record(buf, sizeof(buf), cdr)) {
ast_log(LOG_WARNING, "Unable to create CSV record in %d bytes. CDR not recorded!\n", (int)sizeof(buf));
return 0;
diff --git a/cdr/cdr_custom.c b/cdr/cdr_custom.c
index 290e5344d..2a3b1a1dd 100644
--- a/cdr/cdr_custom.c
+++ b/cdr/cdr_custom.c
@@ -67,20 +67,20 @@ AST_THREADSTORAGE(custom_buf);
static const char name[] = "cdr-custom";
-struct cdr_config {
+struct cdr_custom_config {
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(filename);
AST_STRING_FIELD(format);
);
ast_mutex_t lock;
- AST_RWLIST_ENTRY(cdr_config) list;
+ AST_RWLIST_ENTRY(cdr_custom_config) list;
};
-static AST_RWLIST_HEAD_STATIC(sinks, cdr_config);
+static AST_RWLIST_HEAD_STATIC(sinks, cdr_custom_config);
static void free_config(void)
{
- struct cdr_config *sink;
+ struct cdr_custom_config *sink;
while ((sink = AST_RWLIST_REMOVE_HEAD(&sinks, list))) {
ast_mutex_destroy(&sink->lock);
ast_free(sink);
@@ -103,7 +103,7 @@ static int load_config(void)
var = ast_variable_browse(cfg, "mappings");
while (var) {
if (!ast_strlen_zero(var->name) && !ast_strlen_zero(var->value)) {
- struct cdr_config *sink = ast_calloc_with_stringfields(1, struct cdr_config, 1024);
+ struct cdr_custom_config *sink = ast_calloc_with_stringfields(1, struct cdr_custom_config, 1024);
if (!sink) {
ast_log(LOG_ERROR, "Unable to allocate memory for configuration settings.\n");
@@ -130,7 +130,7 @@ static int custom_log(struct ast_cdr *cdr)
{
struct ast_channel *dummy;
struct ast_str *str;
- struct cdr_config *config;
+ struct cdr_custom_config *config;
/* Batching saves memory management here. Otherwise, it's the same as doing an allocation and free each time. */
if (!(str = ast_str_thread_get(&custom_buf, 16))) {
diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c
index a82bcf989..e3ae7a57d 100644
--- a/cdr/cdr_manager.c
+++ b/cdr/cdr_manager.c
@@ -203,7 +203,7 @@ static int manager_log(struct ast_cdr *cdr)
cdr->accountcode, cdr->src, cdr->dst, cdr->dcontext, cdr->clid, cdr->channel,
cdr->dstchannel, cdr->lastapp, cdr->lastdata, strStartTime, strAnswerTime, strEndTime,
cdr->duration, cdr->billsec, ast_cdr_disp2str(cdr->disposition),
- ast_cdr_flags2str(cdr->amaflags), cdr->uniqueid, cdr->userfield,buf);
+ ast_channel_amaflags2string(cdr->amaflags), cdr->uniqueid, cdr->userfield,buf);
return 0;
}
diff --git a/cdr/cdr_odbc.c b/cdr/cdr_odbc.c
index 7ea2f041f..022d75210 100644
--- a/cdr/cdr_odbc.c
+++ b/cdr/cdr_odbc.c
@@ -124,10 +124,13 @@ static SQLHSTMT execute_cb(struct odbc_obj *obj, void *data)
SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &cdr->billsec, 0, NULL);
}
- if (ast_test_flag(&config, CONFIG_DISPOSITIONSTRING))
- SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(ast_cdr_disp2str(cdr->disposition)) + 1, 0, ast_cdr_disp2str(cdr->disposition), 0, NULL);
- else
+ if (ast_test_flag(&config, CONFIG_DISPOSITIONSTRING)) {
+ char *disposition;
+ disposition = ast_strdupa(ast_cdr_disp2str(cdr->disposition));
+ SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(disposition) + 1, 0, disposition, 0, NULL);
+ } else {
SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &cdr->disposition, 0, NULL);
+ }
SQLBindParameter(stmt, 12, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &cdr->amaflags, 0, NULL);
SQLBindParameter(stmt, 13, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(cdr->accountcode), 0, cdr->accountcode, 0, NULL);
diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c
index 906f0227c..dc73de477 100644
--- a/cdr/cdr_pgsql.c
+++ b/cdr/cdr_pgsql.c
@@ -222,9 +222,9 @@ static int pgsql_log(struct ast_cdr *cdr)
AST_RWLIST_RDLOCK(&psql_columns);
AST_RWLIST_TRAVERSE(&psql_columns, cur, list) {
/* For fields not set, simply skip them */
- ast_cdr_getvar(cdr, cur->name, &value, buf, sizeof(buf), 0, 0);
+ ast_cdr_format_var(cdr, cur->name, &value, buf, sizeof(buf), 0);
if (strcmp(cur->name, "calldate") == 0 && !value) {
- ast_cdr_getvar(cdr, "start", &value, buf, sizeof(buf), 0, 0);
+ ast_cdr_format_var(cdr, "start", &value, buf, sizeof(buf), 0);
}
if (!value) {
if (cur->notnull && !cur->hasdefault) {
@@ -286,7 +286,7 @@ static int pgsql_log(struct ast_cdr *cdr)
} else if (strcmp(cur->name, "duration") == 0 || strcmp(cur->name, "billsec") == 0) {
if (cur->type[0] == 'i') {
/* Get integer, no need to escape anything */
- ast_cdr_getvar(cdr, cur->name, &value, buf, sizeof(buf), 0, 0);
+ ast_cdr_format_var(cdr, cur->name, &value, buf, sizeof(buf), 0);
LENGTHEN_BUF2(13);
ast_str_append(&sql2, 0, "%s%s", first ? "" : ",", value);
} else if (strncmp(cur->type, "float", 5) == 0) {
@@ -302,18 +302,18 @@ static int pgsql_log(struct ast_cdr *cdr)
} else if (strcmp(cur->name, "disposition") == 0 || strcmp(cur->name, "amaflags") == 0) {
if (strncmp(cur->type, "int", 3) == 0) {
/* Integer, no need to escape anything */
- ast_cdr_getvar(cdr, cur->name, &value, buf, sizeof(buf), 0, 1);
+ ast_cdr_format_var(cdr, cur->name, &value, buf, sizeof(buf), 1);
LENGTHEN_BUF2(13);
ast_str_append(&sql2, 0, "%s%s", first ? "" : ",", value);
} else {
/* Although this is a char field, there are no special characters in the values for these fields */
- ast_cdr_getvar(cdr, cur->name, &value, buf, sizeof(buf), 0, 0);
+ ast_cdr_format_var(cdr, cur->name, &value, buf, sizeof(buf), 0);
LENGTHEN_BUF2(31);
ast_str_append(&sql2, 0, "%s'%s'", first ? "" : ",", value);
}
} else {
/* Arbitrary field, could be anything */
- ast_cdr_getvar(cdr, cur->name, &value, buf, sizeof(buf), 0, 0);
+ ast_cdr_format_var(cdr, cur->name, &value, buf, sizeof(buf), 0);
if (strncmp(cur->type, "int", 3) == 0) {
long long whatever;
if (value && sscanf(value, "%30lld", &whatever) == 1) {
diff --git a/cdr/cdr_radius.c b/cdr/cdr_radius.c
index 92ec8a4b4..2bf2002fe 100644
--- a/cdr/cdr_radius.c
+++ b/cdr/cdr_radius.c
@@ -170,12 +170,12 @@ static int build_radius_record(VALUE_PAIR **tosend, struct ast_cdr *cdr)
return -1;
/* Disposition */
- tmp = ast_cdr_disp2str(cdr->disposition);
+ tmp = ast_strdupa(ast_cdr_disp2str(cdr->disposition));
if (!rc_avpair_add(rh, tosend, PW_AST_DISPOSITION, tmp, strlen(tmp), VENDOR_CODE))
return -1;
/* AMA Flags */
- tmp = ast_cdr_flags2str(cdr->amaflags);
+ tmp = ast_strdupa(ast_channel_amaflags2string(cdr->amaflags));
if (!rc_avpair_add(rh, tosend, PW_AST_AMA_FLAGS, tmp, strlen(tmp), VENDOR_CODE))
return -1;
diff --git a/cdr/cdr_syslog.c b/cdr/cdr_syslog.c
index 8a7f07713..dec4d65e9 100644
--- a/cdr/cdr_syslog.c
+++ b/cdr/cdr_syslog.c
@@ -60,7 +60,7 @@ AST_THREADSTORAGE(syslog_buf);
static const char name[] = "cdr-syslog";
-struct cdr_config {
+struct cdr_syslog_config {
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(ident);
AST_STRING_FIELD(format);
@@ -68,14 +68,14 @@ struct cdr_config {
int facility;
int priority;
ast_mutex_t lock;
- AST_LIST_ENTRY(cdr_config) list;
+ AST_LIST_ENTRY(cdr_syslog_config) list;
};
-static AST_RWLIST_HEAD_STATIC(sinks, cdr_config);
+static AST_RWLIST_HEAD_STATIC(sinks, cdr_syslog_config);
static void free_config(void)
{
- struct cdr_config *sink;
+ struct cdr_syslog_config *sink;
while ((sink = AST_RWLIST_REMOVE_HEAD(&sinks, list))) {
ast_mutex_destroy(&sink->lock);
ast_free(sink);
@@ -86,7 +86,7 @@ static int syslog_log(struct ast_cdr *cdr)
{
struct ast_channel *dummy;
struct ast_str *str;
- struct cdr_config *sink;
+ struct cdr_syslog_config *sink;
/* Batching saves memory management here. Otherwise, it's the same as doing an
allocation and free each time. */
@@ -174,7 +174,7 @@ static int load_config(int reload)
}
while ((catg = ast_category_browse(cfg, catg))) {
- struct cdr_config *sink;
+ struct cdr_syslog_config *sink;
if (!strcasecmp(catg, "general")) {
continue;
@@ -186,7 +186,7 @@ static int load_config(int reload)
continue;
}
- sink = ast_calloc_with_stringfields(1, struct cdr_config, 1024);
+ sink = ast_calloc_with_stringfields(1, struct cdr_syslog_config, 1024);
if (!sink) {
ast_log(AST_LOG_ERROR,
diff --git a/cdr/cdr_tds.c b/cdr/cdr_tds.c
index dd75dbb46..aef57b55d 100644
--- a/cdr/cdr_tds.c
+++ b/cdr/cdr_tds.c
@@ -176,7 +176,7 @@ retry:
settings->table,
accountcode, src, dst, dcontext, clid, channel,
dstchannel, lastapp, lastdata, start, answer, end, hrduration,
- hrbillsec, ast_cdr_disp2str(cdr->disposition), ast_cdr_flags2str(cdr->amaflags), uniqueid,
+ hrbillsec, ast_cdr_disp2str(cdr->disposition), ast_channel_amaflags2string(cdr->amaflags), uniqueid,
userfield
);
} else {
@@ -196,7 +196,7 @@ retry:
settings->table,
accountcode, src, dst, dcontext, clid, channel,
dstchannel, lastapp, lastdata, start, answer, end, cdr->duration,
- cdr->billsec, ast_cdr_disp2str(cdr->disposition), ast_cdr_flags2str(cdr->amaflags), uniqueid,
+ cdr->billsec, ast_cdr_disp2str(cdr->disposition), ast_channel_amaflags2string(cdr->amaflags), uniqueid,
userfield
);
}
@@ -226,7 +226,7 @@ retry:
settings->table,
accountcode, src, dst, dcontext, clid, channel,
dstchannel, lastapp, lastdata, start, answer, end, hrduration,
- hrbillsec, ast_cdr_disp2str(cdr->disposition), ast_cdr_flags2str(cdr->amaflags), uniqueid
+ hrbillsec, ast_cdr_disp2str(cdr->disposition), ast_channel_amaflags2string(cdr->amaflags), uniqueid
);
} else {
erc = dbfcmd(settings->dbproc,
@@ -245,7 +245,7 @@ retry:
settings->table,
accountcode, src, dst, dcontext, clid, channel,
dstchannel, lastapp, lastdata, start, answer, end, cdr->duration,
- cdr->billsec, ast_cdr_disp2str(cdr->disposition), ast_cdr_flags2str(cdr->amaflags), uniqueid
+ cdr->billsec, ast_cdr_disp2str(cdr->disposition), ast_channel_amaflags2string(cdr->amaflags), uniqueid
);
}
}