|
|
@ -241,9 +241,11 @@ static int cdr_read(struct ast_channel *chan, const char *cmd, char *parse,
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ast_test_flag(&flags, OPT_FLOAT) && (!strcasecmp("billsec", args.variable) || !strcasecmp("duration", args.variable))) {
|
|
|
|
if (ast_test_flag(&flags, OPT_FLOAT)
|
|
|
|
|
|
|
|
&& (!strcasecmp("billsec", args.variable) || !strcasecmp("duration", args.variable))) {
|
|
|
|
long ms;
|
|
|
|
long ms;
|
|
|
|
double dtime;
|
|
|
|
double dtime;
|
|
|
|
|
|
|
|
|
|
|
|
if (sscanf(tempbuf, "%30ld", &ms) != 1) {
|
|
|
|
if (sscanf(tempbuf, "%30ld", &ms) != 1) {
|
|
|
|
ast_log(AST_LOG_WARNING, "Unable to parse %s (%s) from the CDR for channel %s\n",
|
|
|
|
ast_log(AST_LOG_WARNING, "Unable to parse %s (%s) from the CDR for channel %s\n",
|
|
|
|
args.variable, tempbuf, ast_channel_name(chan));
|
|
|
|
args.variable, tempbuf, ast_channel_name(chan));
|
|
|
@ -259,6 +261,7 @@ static int cdr_read(struct ast_channel *chan, const char *cmd, char *parse,
|
|
|
|
struct ast_tm tm;
|
|
|
|
struct ast_tm tm;
|
|
|
|
/* tv_usec is suseconds_t, which could be int or long */
|
|
|
|
/* tv_usec is suseconds_t, which could be int or long */
|
|
|
|
long int tv_usec;
|
|
|
|
long int tv_usec;
|
|
|
|
|
|
|
|
|
|
|
|
if (sscanf(tempbuf, "%ld.%ld", &fmt_time.tv_sec, &tv_usec) != 2) {
|
|
|
|
if (sscanf(tempbuf, "%ld.%ld", &fmt_time.tv_sec, &tv_usec) != 2) {
|
|
|
|
ast_log(AST_LOG_WARNING, "Unable to parse %s (%s) from the CDR for channel %s\n",
|
|
|
|
ast_log(AST_LOG_WARNING, "Unable to parse %s (%s) from the CDR for channel %s\n",
|
|
|
|
args.variable, tempbuf, ast_channel_name(chan));
|
|
|
|
args.variable, tempbuf, ast_channel_name(chan));
|
|
|
@ -269,6 +272,7 @@ static int cdr_read(struct ast_channel *chan, const char *cmd, char *parse,
|
|
|
|
ast_strftime(tempbuf, sizeof(*tempbuf), "%Y-%m-%d %T", &tm);
|
|
|
|
ast_strftime(tempbuf, sizeof(*tempbuf), "%Y-%m-%d %T", &tm);
|
|
|
|
} else if (!strcasecmp("disposition", args.variable)) {
|
|
|
|
} else if (!strcasecmp("disposition", args.variable)) {
|
|
|
|
int disposition;
|
|
|
|
int disposition;
|
|
|
|
|
|
|
|
|
|
|
|
if (sscanf(tempbuf, "%8d", &disposition) != 1) {
|
|
|
|
if (sscanf(tempbuf, "%8d", &disposition) != 1) {
|
|
|
|
ast_log(AST_LOG_WARNING, "Unable to parse %s (%s) from the CDR for channel %s\n",
|
|
|
|
ast_log(AST_LOG_WARNING, "Unable to parse %s (%s) from the CDR for channel %s\n",
|
|
|
|
args.variable, tempbuf, ast_channel_name(chan));
|
|
|
|
args.variable, tempbuf, ast_channel_name(chan));
|
|
|
@ -278,6 +282,7 @@ static int cdr_read(struct ast_channel *chan, const char *cmd, char *parse,
|
|
|
|
strcpy(tempbuf, format_buf);
|
|
|
|
strcpy(tempbuf, format_buf);
|
|
|
|
} else if (!strcasecmp("amaflags", args.variable)) {
|
|
|
|
} else if (!strcasecmp("amaflags", args.variable)) {
|
|
|
|
int amaflags;
|
|
|
|
int amaflags;
|
|
|
|
|
|
|
|
|
|
|
|
if (sscanf(tempbuf, "%8d", &amaflags) != 1) {
|
|
|
|
if (sscanf(tempbuf, "%8d", &amaflags) != 1) {
|
|
|
|
ast_log(AST_LOG_WARNING, "Unable to parse %s (%s) from the CDR for channel %s\n",
|
|
|
|
ast_log(AST_LOG_WARNING, "Unable to parse %s (%s) from the CDR for channel %s\n",
|
|
|
|
args.variable, tempbuf, ast_channel_name(chan));
|
|
|
|
args.variable, tempbuf, ast_channel_name(chan));
|
|
|
@ -301,13 +306,15 @@ static int cdr_write(struct ast_channel *chan, const char *cmd, char *parse,
|
|
|
|
AST_APP_ARG(options);
|
|
|
|
AST_APP_ARG(options);
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if (ast_strlen_zero(parse) || !value || !chan)
|
|
|
|
if (ast_strlen_zero(parse) || !value || !chan) {
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AST_STANDARD_APP_ARGS(args, parse);
|
|
|
|
AST_STANDARD_APP_ARGS(args, parse);
|
|
|
|
|
|
|
|
|
|
|
|
if (!ast_strlen_zero(args.options))
|
|
|
|
if (!ast_strlen_zero(args.options)) {
|
|
|
|
ast_app_parse_options(cdr_func_options, &flags, NULL, args.options);
|
|
|
|
ast_app_parse_options(cdr_func_options, &flags, NULL, args.options);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!strcasecmp(args.variable, "accountcode")) {
|
|
|
|
if (!strcasecmp(args.variable, "accountcode")) {
|
|
|
|
ast_log(AST_LOG_WARNING, "Using the CDR function to set 'accountcode' is deprecated. Please use the CHANNEL function instead.\n");
|
|
|
|
ast_log(AST_LOG_WARNING, "Using the CDR function to set 'accountcode' is deprecated. Please use the CHANNEL function instead.\n");
|
|
|
|