mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-01 19:43:03 +00:00
Version 0.2.0 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
14
cdr.c
14
cdr.c
@@ -193,7 +193,7 @@ int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *c)
|
|||||||
{
|
{
|
||||||
char *chan;
|
char *chan;
|
||||||
char *num, *name;
|
char *num, *name;
|
||||||
char tmp[AST_MAX_EXTENSION];
|
char tmp[AST_MAX_EXTENSION] = "";
|
||||||
if (cdr) {
|
if (cdr) {
|
||||||
chan = strlen(cdr->channel) ? cdr->channel : "<unknown>";
|
chan = strlen(cdr->channel) ? cdr->channel : "<unknown>";
|
||||||
if (strlen(cdr->channel))
|
if (strlen(cdr->channel))
|
||||||
@@ -214,7 +214,7 @@ int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *c)
|
|||||||
strncpy(cdr->src, num, sizeof(cdr->src) - 1);
|
strncpy(cdr->src, num, sizeof(cdr->src) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->state == AST_STATE_UP)
|
if (c->_state == AST_STATE_UP)
|
||||||
cdr->disposition = AST_CDR_ANSWERED;
|
cdr->disposition = AST_CDR_ANSWERED;
|
||||||
else
|
else
|
||||||
cdr->disposition = AST_CDR_NOANSWER;
|
cdr->disposition = AST_CDR_NOANSWER;
|
||||||
@@ -271,6 +271,16 @@ char *ast_cdr_flags2str(int flag)
|
|||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ast_cdr_setaccount(struct ast_channel *chan, char *account)
|
||||||
|
{
|
||||||
|
struct ast_cdr *cdr = chan->cdr;
|
||||||
|
|
||||||
|
strncpy(chan->accountcode, account, sizeof(chan->accountcode) - 1);
|
||||||
|
if (cdr)
|
||||||
|
strncpy(cdr->accountcode, chan->accountcode, sizeof(cdr->accountcode) - 1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ast_cdr_amaflags2int(char *flag)
|
int ast_cdr_amaflags2int(char *flag)
|
||||||
{
|
{
|
||||||
if (!strcasecmp(flag, "default"))
|
if (!strcasecmp(flag, "default"))
|
||||||
|
|||||||
12
logger.c
12
logger.c
@@ -166,6 +166,7 @@ static void init_logger_chain(void)
|
|||||||
/* Gotta have at least one. We'll make a NULL one */
|
/* Gotta have at least one. We'll make a NULL one */
|
||||||
logfiles = make_logfile("ignore", "", -1);
|
logfiles = make_logfile("ignore", "", -1);
|
||||||
}
|
}
|
||||||
|
ast_destroy(cfg);
|
||||||
ast_pthread_mutex_unlock(&loglock);
|
ast_pthread_mutex_unlock(&loglock);
|
||||||
|
|
||||||
|
|
||||||
@@ -227,9 +228,7 @@ extern void ast_log(int level, char *file, int line, char *function, char *fmt,
|
|||||||
struct logfile *f;
|
struct logfile *f;
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
|
||||||
if (!option_verbose && !option_debug && (!level)) {
|
if (!option_verbose && !option_debug && (!level)) {
|
||||||
va_end(ap);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ast_pthread_mutex_lock(&loglock);
|
ast_pthread_mutex_lock(&loglock);
|
||||||
@@ -240,12 +239,14 @@ extern void ast_log(int level, char *file, int line, char *function, char *fmt,
|
|||||||
/* Log events into the event log file, with a different format */
|
/* Log events into the event log file, with a different format */
|
||||||
strftime(date, sizeof(date), "%b %e %T", tm);
|
strftime(date, sizeof(date), "%b %e %T", tm);
|
||||||
fprintf(eventlog, "%s asterisk[%d]: ", date, getpid());
|
fprintf(eventlog, "%s asterisk[%d]: ", date, getpid());
|
||||||
|
va_start(ap, fmt);
|
||||||
vfprintf(eventlog, fmt, ap);
|
vfprintf(eventlog, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
fflush(eventlog);
|
fflush(eventlog);
|
||||||
} else
|
} else
|
||||||
/** Cannot use ast_log() from locked section of ast_log()!
|
/** Cannot use ast_log() from locked section of ast_log()!
|
||||||
ast_log(LOG_WARNING, "Unable to retrieve local time?\n"); **/
|
ast_log(LOG_WARNING, "Unable to retrieve local time?\n"); **/
|
||||||
fprintf(stderr, "ast_log: Unable to retrieve local time for %d?\n", t);
|
fprintf(stderr, "ast_log: Unable to retrieve local time for %ld?\n", t);
|
||||||
} else {
|
} else {
|
||||||
if (logfiles) {
|
if (logfiles) {
|
||||||
f = logfiles;
|
f = logfiles;
|
||||||
@@ -265,10 +266,10 @@ extern void ast_log(int level, char *file, int line, char *function, char *fmt,
|
|||||||
term_color(tmp3, linestr, COLOR_BRWHITE, 0, sizeof(tmp3)),
|
term_color(tmp3, linestr, COLOR_BRWHITE, 0, sizeof(tmp3)),
|
||||||
term_color(tmp4, function, COLOR_BRWHITE, 0, sizeof(tmp4)));
|
term_color(tmp4, function, COLOR_BRWHITE, 0, sizeof(tmp4)));
|
||||||
}
|
}
|
||||||
vfprintf(f->f, fmt, ap);
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
fflush(f->f);
|
vfprintf(f->f, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
fflush(f->f);
|
||||||
}
|
}
|
||||||
f = f->next;
|
f = f->next;
|
||||||
}
|
}
|
||||||
@@ -281,7 +282,6 @@ extern void ast_log(int level, char *file, int line, char *function, char *fmt,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast_pthread_mutex_unlock(&loglock);
|
ast_pthread_mutex_unlock(&loglock);
|
||||||
va_end(ap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void ast_verbose(char *fmt, ...)
|
extern void ast_verbose(char *fmt, ...)
|
||||||
|
|||||||
Reference in New Issue
Block a user