46 #define DATE_FORMAT "%Y-%m-%d %T"
47 #define CONF_FILE "cdr_manager.conf"
48 #define CUSTOM_FIELDS_BUF_SIZE 1024
50 static const char name[] =
"cdr_manager";
90 if (reload && customfields) {
96 if (!strcasecmp(cat,
"general")) {
99 if (!strcasecmp(v->
name,
"enabled"))
104 }
else if (!strcasecmp(cat,
"mappings")) {
129 if (enablecdr && !newenablecdr)
131 else if (!enablecdr && newenablecdr)
133 enablecdr = newenablecdr;
141 char strStartTime[80] =
"";
142 char strAnswerTime[80] =
"";
143 char strEndTime[80] =
"";
165 ast_log(
LOG_ERROR,
"Unable to allocate channel for variable substitution.\n");
175 "AccountCode: %s\r\n"
177 "Destination: %s\r\n"
178 "DestinationContext: %s\r\n"
181 "DestinationChannel: %s\r\n"
182 "LastApplication: %s\r\n"
188 "BillableSeconds: %ld\r\n"
189 "Disposition: %s\r\n"
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
#define ast_rwlock_rdlock(a)
Main Channel structure associated with a channel.
char accountcode[AST_MAX_ACCOUNT_CODE]
Asterisk main include file. File version handling, generic pbx functions.
#define AST_RWLOCK_DEFINE_STATIC(rwlock)
char dstchannel[AST_MAX_EXTENSION]
#define ast_channel_unref(c)
Decrease channel reference count.
static struct ast_str * customfields
size_t ast_str_size(const struct ast_str *buf)
Returns the current maximum length (without reallocation) of the current buffer.
#define CUSTOM_FIELDS_BUF_SIZE
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category)
Goes through variables.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static void dummy(char *unused,...)
char dcontext[AST_MAX_EXTENSION]
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.
static int unload_module(void)
struct ast_cdr * ast_cdr_dup(struct ast_cdr *cdr)
Duplicate a record.
static int load_config(int reload)
Configuration File Parser.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
static int load_module(void)
struct ast_str * ast_str_create(size_t init_len)
Create a malloc'ed dynamic length string.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
char * ast_cdr_flags2str(int flags)
#define ast_rwlock_unlock(a)
void ast_config_destroy(struct ast_config *config)
Destroys a config.
char lastdata[AST_MAX_EXTENSION]
int ast_cdr_register(const char *name, const char *desc, ast_cdrbe be)
Register a CDR handling engine.
General Asterisk PBX channel definitions.
#define ast_config_load(filename, flags)
Load a config file.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
char * ast_category_browse(struct ast_config *config, const char *prev)
Goes through categories.
char dst[AST_MAX_EXTENSION]
char channel[AST_MAX_EXTENSION]
Core PBX routines and definitions.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
Responsible for call detail data.
char lastapp[AST_MAX_EXTENSION]
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".
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
static int manager_log(struct ast_cdr *cdr)
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.
char src[AST_MAX_EXTENSION]
#define ast_rwlock_wrlock(a)
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
struct ast_variable * next
char clid[AST_MAX_EXTENSION]
#define CONFIG_STATUS_FILEINVALID
struct ast_channel * ast_dummy_channel_alloc(void)
Create a fake channel structure.
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define manager_event(category, event, contents,...)
External routines may send asterisk manager events this way.
Asterisk module definitions.
char * ast_cdr_disp2str(int disposition)
Disposition to a string.
static ast_rwlock_t customfields_lock
void ast_cdr_unregister(const char *name)
Unregister a CDR handling engine.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
char userfield[AST_MAX_USER_FIELD]
#define CONFIG_STATUS_FILEUNCHANGED