Author: cparker Date: Tue Feb 5 13:00:03 2008 New Revision: 7529 Modified: freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/radius/dictionary Log: Enhancements from MODEVENT-13 Modified: freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c ============================================================================== --- freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c (original) +++ freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c Tue Feb 5 13:00:03 2008 @@ -182,6 +182,14 @@ profile = switch_channel_get_caller_profile(channel); if(profile) { + if(profile->username) { + if (rc_avpair_add(rad_config, &send, PW_USER_NAME, (void *)profile->username, -1, 0) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "failed adding User-Name: %s\n", profile->username); + rc_destroy(rad_config); + return SWITCH_STATUS_TERM; + } + } if(profile->caller_id_number) { if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *)profile->caller_id_number, -1, PW_FS_PEC) == NULL) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, @@ -214,6 +222,54 @@ return SWITCH_STATUS_TERM; } } + if(profile->network_addr) { + if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *)profile->network_addr, -1, 0) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "failed adding Framed-IP-Address: %s\n", profile->network_addr); + rc_destroy(rad_config); + return SWITCH_STATUS_TERM; + } + } + if(profile->rdnis) { + if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *)profile->rdnis, -1, PW_FS_PEC) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis); + rc_destroy(rad_config); + return SWITCH_STATUS_TERM; + } + } + if(profile->context) { + if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *)profile->context, -1, PW_FS_PEC) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "failed adding Freeswitch-Context: %s\n", profile->context); + rc_destroy(rad_config); + return SWITCH_STATUS_TERM; + } + } + if(profile->ani) { + if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *)profile->ani, -1, PW_FS_PEC) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "failed adding Freeswitch-ANI: %s\n", profile->ani); + rc_destroy(rad_config); + return SWITCH_STATUS_TERM; + } + } + if(profile->aniii) { + if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *)profile->aniii, -1, PW_FS_PEC) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "failed adding Freeswitch-ANIII: %s\n", profile->aniii); + rc_destroy(rad_config); + return SWITCH_STATUS_TERM; + } + } + if(profile->source) { + if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *)profile->source, -1, PW_FS_PEC) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "failed adding Freeswitch-Source: %s\n", profile->source); + rc_destroy(rad_config); + return SWITCH_STATUS_TERM; + } + } if(profile->caller_extension && profile->caller_extension->last_application->application_name) { if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP, (void *)profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) { @@ -330,6 +386,14 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Finished calculating billable time\n"); + if(profile->username) { + if (rc_avpair_add(rad_config, &send, PW_USER_NAME, (void *)profile->username, -1, 0) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "failed adding User-Name: %s\n", profile->username); + rc_destroy(rad_config); + return SWITCH_STATUS_TERM; + } + } if(profile->caller_id_number) { if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *)profile->caller_id_number, -1, PW_FS_PEC) == NULL) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, @@ -362,6 +426,54 @@ return SWITCH_STATUS_TERM; } } + if(profile->network_addr) { + if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *)profile->network_addr, -1, 0) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "failed adding Framed-IP-Address: %s\n", profile->network_addr); + rc_destroy(rad_config); + return SWITCH_STATUS_TERM; + } + } + if(profile->rdnis) { + if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *)profile->rdnis, -1, PW_FS_PEC) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis); + rc_destroy(rad_config); + return SWITCH_STATUS_TERM; + } + } + if(profile->context) { + if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *)profile->context, -1, PW_FS_PEC) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "failed adding Freeswitch-Context: %s\n", profile->context); + rc_destroy(rad_config); + return SWITCH_STATUS_TERM; + } + } + if(profile->ani) { + if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *)profile->ani, -1, PW_FS_PEC) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "failed adding Freeswitch-ANI: %s\n", profile->ani); + rc_destroy(rad_config); + return SWITCH_STATUS_TERM; + } + } + if(profile->aniii) { + if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *)profile->aniii, -1, PW_FS_PEC) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "failed adding Freeswitch-ANIII: %s\n", profile->aniii); + rc_destroy(rad_config); + return SWITCH_STATUS_TERM; + } + } + if(profile->source) { + if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *)profile->source, -1, PW_FS_PEC) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "failed adding Freeswitch-Source: %s\n", profile->source); + rc_destroy(rad_config); + return SWITCH_STATUS_TERM; + } + } if(profile->caller_extension && profile->caller_extension->last_application->application_name) { if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP, (void *)profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) { Modified: freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h ============================================================================== --- freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h (original) +++ freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h Tue Feb 5 13:00:03 2008 @@ -51,9 +51,13 @@ #define PW_FS_HANGUPCAUSE 13 #define PW_FS_BILLUSEC 15 #define PW_FS_AMAFLAGS 16 +#define PW_FS_RDNIS 17 +#define PW_FS_CONTEXT 18 +#define PW_FS_SOURCE 19 #define PW_FS_CALLSTARTDATE 20 #define PW_FS_CALLANSWERDATE 21 #define PW_FS_CALLTRANSFERDATE 22 #define PW_FS_CALLENDDATE 23 + #endif Modified: freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/radius/dictionary ============================================================================== --- freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/radius/dictionary (original) +++ freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/radius/dictionary Tue Feb 5 13:00:03 2008 @@ -266,10 +266,12 @@ ATTRIBUTE Freeswitch-Lastapp 10 string Freeswitch ATTRIBUTE Freeswitch-Lastdata 11 string Freeswitch ATTRIBUTE Freeswitch-Disposition 12 string Freeswitch -ATTRIBUTE Freeswitch-Hangupcause 13 integer Freeswitch -ATTRIBUTE Freeswitch-Billusec 15 integer Freeswitch -ATTRIBUTE Freeswitch-AMAFlags 16 integer Freeswitch - +ATTRIBUTE Freeswitch-Hangupcause 13 integer Freeswitch +ATTRIBUTE Freeswitch-Billusec 15 integer Freeswitch +ATTRIBUTE Freeswitch-AMAFlags 16 integer Freeswitch +ATTRIBUTE Freeswitch-RDNIS 17 string Freeswitch +ATTRIBUTE Freeswitch-Context 18 string Freeswitch +ATTRIBUTE Freeswitch-Source 19 string Freeswitch ATTRIBUTE Freeswitch-Callstartdate 20 string Freeswitch ATTRIBUTE Freeswitch-Callanswerdate 21 string Freeswitch ATTRIBUTE Freeswitch-Calltransferdate 22 string Freeswitch