mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-05 18:13:27 +00:00
FS-1327 --resolve
This commit is contained in:
parent
138224d816
commit
3d461d7cde
@ -153,6 +153,9 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
|
|||||||
switch_time_exp_t tm;
|
switch_time_exp_t tm;
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
|
|
||||||
|
char *radius_avpair_data;
|
||||||
|
char *delim;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Entering my_on_routing\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Entering my_on_routing\n");
|
||||||
|
|
||||||
if (globals.shutdown) {
|
if (globals.shutdown) {
|
||||||
@ -203,6 +206,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
|
|||||||
if (channel) {
|
if (channel) {
|
||||||
/*switch_call_cause_t cause; */
|
/*switch_call_cause_t cause; */
|
||||||
switch_caller_profile_t *profile;
|
switch_caller_profile_t *profile;
|
||||||
|
const char *radius_avpair = switch_channel_get_variable(channel, "radius_avpair");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
cause = switch_channel_get_cause(channel);
|
cause = switch_channel_get_cause(channel);
|
||||||
@ -365,6 +369,29 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (radius_avpair) {
|
||||||
|
radius_avpair_data = strdup(radius_avpair + (strncmp(radius_avpair, "ARRAY::", 7) ? 0 : 7));
|
||||||
|
do {
|
||||||
|
delim = strstr(radius_avpair_data, "|:");
|
||||||
|
|
||||||
|
if (delim) {
|
||||||
|
*delim = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rc_avpair_add(rad_config, &send, PW_FS_AVPAIR, (void *) radius_avpair_data, -1, PW_FS_PEC) == NULL) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-AVPair: %s\n", radius_avpair_data);
|
||||||
|
rc_destroy(rad_config);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "added Freeswitch-AVPair: %s\n", radius_avpair_data);
|
||||||
|
|
||||||
|
if (delim) {
|
||||||
|
radius_avpair_data = delim + 2;
|
||||||
|
}
|
||||||
|
} while (delim);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "profile == NULL\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "profile == NULL\n");
|
||||||
}
|
}
|
||||||
@ -406,6 +433,9 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
|
|||||||
switch_time_exp_t tm;
|
switch_time_exp_t tm;
|
||||||
char buffer[32] = "";
|
char buffer[32] = "";
|
||||||
|
|
||||||
|
char *radius_avpair_data;
|
||||||
|
char *delim;
|
||||||
|
|
||||||
if (globals.shutdown) {
|
if (globals.shutdown) {
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
@ -457,6 +487,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
|
|||||||
if (channel) {
|
if (channel) {
|
||||||
switch_call_cause_t cause;
|
switch_call_cause_t cause;
|
||||||
switch_caller_profile_t *profile;
|
switch_caller_profile_t *profile;
|
||||||
|
const char *radius_avpair = switch_channel_get_variable(channel, "radius_avpair");
|
||||||
|
|
||||||
cause = switch_channel_get_cause(channel);
|
cause = switch_channel_get_cause(channel);
|
||||||
if (rc_avpair_add(rad_config, &send, PW_FS_HANGUPCAUSE, &cause, -1, PW_FS_PEC) == NULL) {
|
if (rc_avpair_add(rad_config, &send, PW_FS_HANGUPCAUSE, &cause, -1, PW_FS_PEC) == NULL) {
|
||||||
@ -649,6 +680,28 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (radius_avpair) {
|
||||||
|
radius_avpair_data = strdup(radius_avpair + (strncmp(radius_avpair, "ARRAY::", 7) ? 0 : 7));
|
||||||
|
do {
|
||||||
|
delim = strstr(radius_avpair_data, "|:");
|
||||||
|
|
||||||
|
if (delim) {
|
||||||
|
*delim = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rc_avpair_add(rad_config, &send, PW_FS_AVPAIR, (void *) radius_avpair_data, -1, PW_FS_PEC) == NULL) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-AVPair: %s\n", radius_avpair_data);
|
||||||
|
rc_destroy(rad_config);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "added Freeswitch-AVPair: %s\n", radius_avpair_data);
|
||||||
|
|
||||||
|
if (delim) {
|
||||||
|
radius_avpair_data = delim + 2;
|
||||||
|
}
|
||||||
|
} while (delim);
|
||||||
|
}
|
||||||
|
|
||||||
} else { /* no profile, can't create data to send */
|
} else { /* no profile, can't create data to send */
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "profile == NULL\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "profile == NULL\n");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user