]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Adding debugging and a default value for disconnect time. Also handle unset times...
authorWilliam King <william.king@quentustech.com>
Fri, 14 Sep 2012 20:16:58 +0000 (13:16 -0700)
committerWilliam King <william.king@quentustech.com>
Fri, 14 Sep 2012 20:17:08 +0000 (13:17 -0700)
src/mod/xml_int/mod_xml_radius/mod_xml_radius.c

index 035a16f7f3d973673cc3272c055640fd978b06be..d80e9e7d542bfbddd39d652155ed21da82a6e4d0 100644 (file)
@@ -368,7 +368,7 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                        switch_time_exp_t tm;
                                        
                                        if ( !time ) {
-                                               return SWITCH_STATUS_SUCCESS;
+                                               goto end_loop;
                                        }
                                        
                                        switch_time_exp_lt(&tm, time);
@@ -381,13 +381,16 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n");
                                                goto err;
                                        } 
+                                       if ( GLOBAL_DEBUG ) {
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: value: %s\n", (char *) av_value);
+                                       }
                                } else if ( strncmp( var, "h323-connect-time", 17) == 0 ) {
                                        switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel);
                                        switch_time_t time = profile->times->answered;
                                        switch_time_exp_t tm;
 
                                        if ( !time ) {
-                                               return SWITCH_STATUS_SUCCESS;
+                                               goto end_loop;
                                        }
                                        
                                        switch_time_exp_lt(&tm, time);
@@ -401,13 +404,20 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n");
                                                goto err;
                                        } 
+                                       if ( GLOBAL_DEBUG ) {
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: value: %s\n", (char *) av_value);
+                                       }
                                } else if ( strncmp( var, "h323-disconnect-time", 20) == 0 ) {
                                        switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel);
                                        switch_time_t time = profile->times->hungup;
                                        switch_time_exp_t tm;
 
                                        if ( !time ) {
-                                               return SWITCH_STATUS_SUCCESS;
+                                               if ( variable_secondary != NULL && strncmp(variable_secondary, "now", 3) == 0 ) {
+                                                       time = switch_time_now();
+                                               } else {
+                                                       goto end_loop;
+                                               }
                                        }
                                        
                                        switch_time_exp_lt(&tm, time);
@@ -421,6 +431,9 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n");
                                                goto err;
                                        } 
+                                       if ( GLOBAL_DEBUG ) {
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: value: %s\n", (char *) av_value);
+                                       }
                                } else if ( strncmp( var, "h323-disconnect-cause", 21) == 0 ) {
                                        switch_call_cause_t cause = switch_channel_get_cause(channel);
                                        av_value = switch_mprintf("h323-disconnect-cause=%x", cause);
@@ -500,6 +513,8 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: all params must have a name attribute\n");
                        goto err;
                }
+
+       end_loop:
                if ( av_value != NULL ) {
                        free(av_value);
                        av_value  = NULL;