39 #ifdef FREERADIUS_CLIENT
40 #include <freeradius-client.h>
42 #include <radiusclient-ng.h>
51 #define DATE_FORMAT "%Y-%m-%d %T %z"
53 #define VENDOR_CODE 22736
85 static const char desc[] =
"RADIUS CDR Backend";
86 static const char name[] =
"radius";
89 #ifdef FREERADIUS_CLIENT
90 static char radiuscfg[PATH_MAX] =
"/etc/radiusclient/radiusclient.conf";
92 static char radiuscfg[PATH_MAX] =
"/etc/radiusclient-ng/radiusclient.conf";
97 static rc_handle *
rh = NULL;
101 int recordtype = PW_STATUS_STOP;
106 if (!rc_avpair_add(rh, tosend, PW_ACCT_STATUS_TYPE, &recordtype, 0, 0))
200 if (!rc_avpair_add(rh, tosend, PW_USER_NAME, &cdr->
channel, strlen(cdr->
channel), 0))
204 if (!rc_avpair_add(rh, tosend, PW_ACCT_SESSION_ID, &cdr->
uniqueid, strlen(cdr->
uniqueid), 0))
212 int result = ERROR_RC;
213 VALUE_PAIR *tosend = NULL;
216 ast_debug(1,
"Unable to create RADIUS record. CDR not recorded!\n");
220 result = rc_acct(rh, 0, tosend);
221 if (result != OK_RC) {
227 rc_avpair_free(tosend);
268 rc_openlog((
char *) tmp);
272 if (!(rh = rc_read_config(radiuscfg))) {
273 ast_log(
LOG_NOTICE,
"Cannot load radiusclient-ng configuration file %s.\n", radiuscfg);
278 if (rc_read_dictionary(rh, rc_conf_str(rh,
"dictionary"))) {
char accountcode[AST_MAX_ACCOUNT_CODE]
static int radius_log(struct ast_cdr *cdr)
Asterisk main include file. File version handling, generic pbx functions.
const char * ast_variable_retrieve(const struct ast_config *config, const char *category, const char *variable)
Gets a variable.
char dstchannel[AST_MAX_EXTENSION]
#define ast_set2_flag(p, value, flag)
#define ast_test_flag(p, flag)
static struct ast_flags global_flags
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).
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
char * ast_cdr_flags2str(int flags)
void ast_config_destroy(struct ast_config *config)
Destroys a config.
char lastdata[AST_MAX_EXTENSION]
#define ast_debug(level,...)
Log a DEBUG message.
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.
char dst[AST_MAX_EXTENSION]
char channel[AST_MAX_EXTENSION]
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".
static char radiuscfg[PATH_MAX]
static int build_radius_record(VALUE_PAIR **tosend, struct ast_cdr *cdr)
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 load_module(void)
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]
static int unload_module(void)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
char clid[AST_MAX_EXTENSION]
#define CONFIG_STATUS_FILEINVALID
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
char * ast_cdr_disp2str(int disposition)
Disposition to a string.
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]