From a5170df009c7008da415ae9a2689163519048d27 Mon Sep 17 00:00:00 2001 From: Mathieu Rene Date: Thu, 5 May 2011 13:45:14 -0400 Subject: [PATCH] mod_radius_cdr: Add 'Freeswitch-Direction' av pair --- .../event_handlers/mod_radius_cdr/mod_radius_cdr.c | 12 ++++++++++++ .../event_handlers/mod_radius_cdr/mod_radius_cdr.h | 1 + .../event_handlers/mod_radius_cdr/radius/dictionary | 1 + 3 files changed, 14 insertions(+) diff --git a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c index 440cbf90a7..1d4ec1335a 100644 --- a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c +++ b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c @@ -24,6 +24,7 @@ * Contributor(s): * * Chris Parker + * Mathieu Rene * * * mod_radius_cdr.c -- RADIUS CDR Module @@ -628,6 +629,17 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) rc_destroy(rad_config); goto end; } + + { + const char *direction_str = profile->direction == SWITCH_CALL_DIRECTION_INBOUND ? "inbound" : "outbound"; + + if (rc_avpair_add(rad_config, &send, PW_FS_DIRECTION, (void *) direction_str, -1, PW_FS_PEC) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Direction: %s\n", direction_str); + rc_destroy(rad_config); + goto end; + } + } + } else { /* no profile, can't create data to send */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "profile == NULL\n"); } diff --git a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h index e4e5a38afc..12badeb665 100644 --- a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h +++ b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h @@ -58,6 +58,7 @@ #define PW_FS_CALLANSWERDATE 21 #define PW_FS_CALLTRANSFERDATE 22 #define PW_FS_CALLENDDATE 23 +#define PW_FS_DIRECTION 24 #endif diff --git a/src/mod/event_handlers/mod_radius_cdr/radius/dictionary b/src/mod/event_handlers/mod_radius_cdr/radius/dictionary index 8c04c6dd93..e496fb3215 100644 --- a/src/mod/event_handlers/mod_radius_cdr/radius/dictionary +++ b/src/mod/event_handlers/mod_radius_cdr/radius/dictionary @@ -276,6 +276,7 @@ ATTRIBUTE Freeswitch-Callstartdate 20 string Freeswitch ATTRIBUTE Freeswitch-Callanswerdate 21 string Freeswitch ATTRIBUTE Freeswitch-Calltransferdate 22 string Freeswitch ATTRIBUTE Freeswitch-Callenddate 23 string Freeswitch +ATTRIBUTE Freeswitch-Direction 24 string Freeswitch # # Freeswitch-Hangupcause