Clean up setting defaults, expose seqfile config option. Reported in MODEVENT-19
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7911 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
1433f77281
commit
950b8b1c13
|
@ -40,6 +40,7 @@ SWITCH_MODULE_DEFINITION(mod_radius_cdr, mod_radius_cdr_load, NULL, NULL);
|
|||
|
||||
static char cf[] = "mod_radius_cdr.conf";
|
||||
static char my_dictionary[PATH_MAX];
|
||||
static char my_seqfile[PATH_MAX];
|
||||
static char * my_deadtime; /* 0 */
|
||||
static char * my_timeout; /* 5 */
|
||||
static char * my_retries; /* 3 */
|
||||
|
@ -72,9 +73,9 @@ static rc_handle * my_radius_init(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (rc_add_config(rad_config, "seqfile", "/var/run/radius.seq", "mod_radius_cdr.c", 0) != 0) {
|
||||
if (rc_add_config(rad_config, "seqfile", my_seqfile, "mod_radius_cdr.c", 0) != 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"setting seqfile = /var/run/radius.seq failed\n");
|
||||
"setting seqfile = %s failed\n", my_seqfile);
|
||||
rc_destroy(rad_config);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -655,6 +656,9 @@ static switch_status_t load_config(void)
|
|||
|
||||
my_timeout = "5";
|
||||
my_retries = "3";
|
||||
my_deadtime = "0";
|
||||
strncpy(my_seqfile, "/var/run/radius.seq", PATH_MAX-1);
|
||||
strncpy(my_dictionary, "/usr/local/freeswitch/conf/radius/dictionary", PATH_MAX-1);
|
||||
|
||||
for( int i = 0; i < SERVER_MAX; i++ ) {
|
||||
my_servers[i][0] = '\0';
|
||||
|
@ -667,10 +671,10 @@ static switch_status_t load_config(void)
|
|||
|
||||
if ((settings = switch_xml_child(cfg, "settings"))) {
|
||||
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
|
||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||
|
||||
if (!strcmp(var, "acctserver")) {
|
||||
if (!strcmp(var, "acctserver")) {
|
||||
if (num_servers < SERVER_MAX) {
|
||||
strncpy(my_servers[num_servers],val,255-1);
|
||||
num_servers++;
|
||||
|
@ -679,15 +683,21 @@ static switch_status_t load_config(void)
|
|||
"you can only specify %d radius servers, ignoring excess server entry\n", SERVER_MAX);
|
||||
}
|
||||
}
|
||||
else if (!strcmp(var, "dictionary")) {
|
||||
else if (!strcmp(var, "dictionary")) {
|
||||
strncpy(my_dictionary,val,PATH_MAX-1);
|
||||
}
|
||||
else if (!strcmp(var, "seqfile")) {
|
||||
strncpy(my_seqfile,val,PATH_MAX-1);
|
||||
}
|
||||
else if (!strcmp(var, "radius_timeout")) {
|
||||
my_timeout = strdup(val);
|
||||
}
|
||||
else if (!strcmp(var, "radius_retries")) {
|
||||
my_retries = strdup(val);
|
||||
}
|
||||
else if (!strcmp(var, "radius_deadtime")) {
|
||||
my_deadtime = strdup(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
<configuration name="mod_radius_cdr.conf" description="RADIUS CDR Configuration">
|
||||
<settings>
|
||||
<!-- location of the radius dictionary files -->
|
||||
<!-- location of the radius dictionary file -->
|
||||
<param name="dictionary" value="/usr/local/freeswitch/conf/radius/dictionary"/>
|
||||
<!-- location of the radius sequence file -->
|
||||
<param name="dictionary" value="/var/run/radius.seq"/>
|
||||
|
||||
<!-- accounting servers, up to 8 allowed -->
|
||||
<!-- value is "host:port:secret", port is optional -->
|
||||
<!-- use IP ADDRESSES, not hostnames -->
|
||||
<param name="acctserver" value="127.0.0.1:1813:testing123"/>
|
||||
<param name="acctserver" value="10.0.0.254:1813:testing123"/>
|
||||
<param name="acctserver" value="192.168.10.10:1813:testing123"/>
|
||||
|
||||
<!-- number of retries for each server -->
|
||||
<param name="radius_retries" value="3"/>
|
||||
<!-- number of seconds to wait between retries -->
|
||||
<param name="radius_timeout" value="5"/>
|
||||
|
||||
<!-- The length of time in seconds that we skip a nonresponsive RADIUS
|
||||
server for transaction requests. Server(s) being in the "dead" state
|
||||
are tried only after all other non-dead servers have been tried and
|
||||
|
@ -17,13 +26,6 @@
|
|||
such interval and so on. This option is no-op if there is only one
|
||||
server in the list. Set to 0 in order to disable the feature. -->
|
||||
<param name="radius_deadtime" value="0"/>
|
||||
|
||||
<!-- accounting servers, up to 8 allowed -->
|
||||
<!-- value is "host:port:secret", port is optional -->
|
||||
<!-- use IP ADDRESSES, not hostnames -->
|
||||
<param name="acctserver" value="127.0.0.1:1813:testing123"/>
|
||||
<param name="acctserver" value="10.0.0.254:1813:testing123"/>
|
||||
<param name="acctserver" value="192.168.10.10:1813:testing123"/>
|
||||
</settings>
|
||||
</configuration>
|
||||
|
||||
|
|
Loading…
Reference in New Issue