42 #include RADIUS_HEADER_STR 50 #define DATE_FORMAT "%Y-%m-%d %T %z" 52 #define VENDOR_CODE 22736 84 static const char desc[] =
"RADIUS CDR Backend";
85 static const char name[] =
"radius";
88 #ifdef FREERADIUS_CLIENT 91 static char radiuscfg[
PATH_MAX] =
"/etc/radiusclient-ng/radiusclient.conf";
100 int recordtype = PW_STATUS_STOP;
105 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))
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);
263 if (!(rh = rc_read_config(radiuscfg))) {
264 ast_log(
LOG_NOTICE,
"Cannot load radiusclient-ng configuration file %s.\n", radiuscfg);
269 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.
int ast_cdr_unregister(const char *name)
Unregister a CDR handling engine.
char dstchannel[AST_MAX_EXTENSION]
#define ast_set2_flag(p, value, flag)
#define ast_test_flag(p, flag)
static struct ast_flags global_flags
#define CONFIG_STATUS_FILEINVALID
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).
const char * ast_channel_amaflags2string(enum ama_flags flags)
Convert the enum representation of an AMA flag to a string representation.
static const char cdr_config[]
char lastdata[AST_MAX_EXTENSION]
#define ast_debug(level,...)
Log a DEBUG message.
#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.
void ast_config_destroy(struct ast_config *config)
Destroys a config.
#define ast_strdupa(s)
duplicate a string in memory from the stack
char uniqueid[AST_MAX_UNIQUEID]
char dst[AST_MAX_EXTENSION]
char channel[AST_MAX_EXTENSION]
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 char radiuscfg[PATH_MAX]
static int build_radius_record(VALUE_PAIR **tosend, struct ast_cdr *cdr)
static int load_module(void)
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]
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
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 ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
char userfield[AST_MAX_USER_FIELD]