]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Enhancements from MODEVENT-13
authorChris Parker <cparker@segv.org>
Tue, 5 Feb 2008 18:00:03 +0000 (18:00 +0000)
committerChris Parker <cparker@segv.org>
Tue, 5 Feb 2008 18:00:03 +0000 (18:00 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7529 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h
src/mod/event_handlers/mod_radius_cdr/radius/dictionary

index bb3818ba280cfb0ef57c31766b60c79c6abdbea9..6a215a45696cb2261a7bcea47139f2f3a7f2244f 100644 (file)
@@ -182,6 +182,14 @@ static switch_status_t my_on_ring(switch_core_session_t *session)
                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 @@ static switch_status_t my_on_ring(switch_core_session_t *session)
                                        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 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
 
                        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 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
                                        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) {
index 918f24240f391d3f1fb904c3fc6ed49532b31256..e4e5a38afcb2d0a1dda51c416c366164b0c679b2 100644 (file)
 #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
index 0b173820a33248d20e5426b8fd017c986ecca5f5..fd84ffd771acce953660bbdcdd07881e38a81d0a 100644 (file)
@@ -266,10 +266,12 @@ ATTRIBUTE Freeswitch-Aniii                        9       string  Freeswitch
 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