return SWITCH_STATUS_SUCCESS;
}
-/* static switch_status_t name (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream) */
-SWITCH_STANDARD_API(mod_xml_radius_connect_test)
-{
- int result = 0;
- VALUE_PAIR *send = NULL, *recv = NULL;
- char msg[512 * 10 + 1] = {0};
- uint32_t service = PW_AUTHENTICATE_ONLY;
- rc_handle *new_handle = NULL;
- switch_xml_t fields;
-
- if ( GLOBAL_DEBUG ) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: starting connection test\n");
- }
-
- mod_xml_radius_new_handle(&new_handle, globals.auth_invite_configs);
-
- if ((fields = switch_xml_child(globals.auth_invite_configs, "fields")) == NULL ) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n");
- goto err;
- }
-
- if ( mod_xml_radius_add_params(NULL, NULL, new_handle, &send, fields) !=SWITCH_STATUS_SUCCESS ) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n");
- goto err;
- }
-
- if (rc_avpair_add(new_handle, &send, PW_SERVICE_TYPE, &service, -1, 0) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n");
- return SWITCH_STATUS_SUCCESS;
- }
-
- result = rc_auth(new_handle, 0, send, &recv, msg);
-
- if ( GLOBAL_DEBUG ) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: result(RC=%d) %s \n", result, msg);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: finished connection test\n");
- }
-
- err:
- if ( recv ) {
- rc_avpair_free(recv);
- recv = NULL;
- }
- if ( send ) {
- rc_avpair_free(send);
- send = NULL;
- }
- if ( new_handle ) {
- rc_destroy(new_handle);
- new_handle = NULL;
- }
-
- return SWITCH_STATUS_SUCCESS;
-}
-
switch_xml_t mod_xml_radius_auth_invite(switch_event_t *params) {
int result = 0, param_idx = 0;
VALUE_PAIR *send = NULL, *recv = NULL, *service_vp = NULL;
status = switch_xml_bind_search_function(mod_xml_radius_directory_search, switch_xml_parse_section_string("directory"), NULL);
}
- SWITCH_ADD_API(mod_xml_radius_api_interface, "xml_radius_connect_test", "mod_xml_radius connection test", mod_xml_radius_connect_test, NULL);
SWITCH_ADD_API(mod_xml_radius_api_interface, "xml_radius_debug", "mod_xml_radius toggle debug", mod_xml_radius_debug_api, NULL);
switch_core_add_state_handler(&state_handlers);