49 #define CSV_LOG_DIR "/cdr-csv" 50 #define CSV_MASTER "/Master.csv" 52 #define DATE_FORMAT "%Y-%m-%d %T" 60 static const char config[] =
"cdr.conf";
128 for (; v; v = v->
next) {
129 if (!strcasecmp(v->
name,
"usegmtime")) {
131 }
else if (!strcasecmp(v->
name,
"accountlogs")) {
134 }
else if (!strcasecmp(v->
name,
"loguniqueid")) {
136 }
else if (!strcasecmp(v->
name,
"loguserfield")) {
138 }
else if (!strcasecmp(v->
name,
"newcdrcolumns")) {
149 int pos = strlen(buf), spos = 0,
error = -1;
151 if (pos >= bufsize - 4)
156 while(pos < bufsize - 3) {
163 buf[pos++] = s[spos];
177 int pos = strlen(buf);
179 snprintf(tmp,
sizeof(tmp),
"%d", s);
181 if (pos + strlen(tmp) > bufsize - 3)
184 strncat(buf, tmp, bufsize - strlen(buf) - 1);
197 if (strlen(buf) > bufsize - 3)
201 strncat(buf,
",", bufsize - strlen(buf) - 1);
259 if (strlen(buf) < bufsize - 5) {
261 buf[strlen(buf) - 1] =
'\0';
262 strncat(buf,
"\n", bufsize - strlen(buf) - 1);
274 if (!(f = fopen(file_path,
"a"))) {
289 if (strchr(acc,
'/') || (acc[0] ==
'.')) {
302 ast_log(
LOG_WARNING,
"Unable to create CSV record in %d bytes. CDR not recorded!\n", (
int)
sizeof(buf));
static ast_mutex_t f_lock
struct ast_variable * next
char accountcode[AST_MAX_ACCOUNT_CODE]
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
int ast_cdr_unregister(const char *name)
Unregister a CDR handling engine.
static const char config[]
static int writefile_account(char *s, char *acc)
char dstchannel[AST_MAX_EXTENSION]
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
#define CONFIG_STATUS_FILEINVALID
char dcontext[AST_MAX_EXTENSION]
static int load_config(int reload)
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
Structure for variables, used for configurations and for channel variables.
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
const char * ast_channel_amaflags2string(enum ama_flags flags)
Convert the enum representation of an AMA flag to a string representation.
#define ast_mutex_lock(a)
static char file_csv_master[PATH_MAX]
#define ast_strlen_zero(foo)
static int writefile(char *s, char *file_path)
char lastdata[AST_MAX_EXTENSION]
Configuration File Parser.
#define ast_config_load(filename, flags)
Load a config file.
int ast_cdr_register(const char *name, const char *desc, ast_cdrbe be)
Register a CDR handling engine.
General Asterisk PBX channel definitions.
Asterisk file paths, configured in asterisk.conf.
static int load_module(void)
char linkedid[AST_MAX_UNIQUEID]
void ast_config_destroy(struct ast_config *config)
Destroys a config.
char uniqueid[AST_MAX_UNIQUEID]
char dst[AST_MAX_EXTENSION]
char channel[AST_MAX_EXTENSION]
#define CONFIG_STATUS_FILEUNCHANGED
Responsible for call detail data.
char lastapp[AST_MAX_EXTENSION]
const char * ast_cdr_disp2str(int disposition)
Disposition to a string.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
static int build_csv_record(char *buf, size_t bufsize, struct ast_cdr *cdr)
static int csv_log(struct ast_cdr *cdr)
const char * ast_config_AST_LOG_DIR
Module has failed to load, may be in an inconsistent state.
int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm)
Special version of strftime(3) that handles fractions of a second. Takes the same arguments as strfti...
Structure used to handle boolean flags.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
char src[AST_MAX_EXTENSION]
char peeraccount[AST_MAX_ACCOUNT_CODE]
static int unload_module(void)
static int append_string(char *buf, const char *s, size_t bufsize)
int error(const char *format,...)
static int append_int(char *buf, int s, size_t bufsize)
char clid[AST_MAX_EXTENSION]
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define AST_MUTEX_DEFINE_STATIC(mutex)
char userfield[AST_MAX_USER_FIELD]
#define ast_mutex_unlock(a)
static int append_date(char *buf, struct timeval when, size_t bufsize)