From 486031d1023ec453083da218df1a23945f64868f Mon Sep 17 00:00:00 2001 From: Yasin Date: Fri, 2 Oct 2015 09:52:55 +0300 Subject: [PATCH] acc_radius : more logging for radius added more log about radius result. it makes better to understand problem. i checked freeradiusclient.h and radiusclient-ng.h to have all defined variables. --- modules/acc_radius/acc_radius_mod.c | 33 +++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/modules/acc_radius/acc_radius_mod.c b/modules/acc_radius/acc_radius_mod.c index f9327ad2398..3ec064b9297 100644 --- a/modules/acc_radius/acc_radius_mod.c +++ b/modules/acc_radius/acc_radius_mod.c @@ -327,7 +327,8 @@ int acc_radius_send_request(struct sip_msg *req, acc_info_t *inf) int i; int m=0; int o=0; - + int rc_result=-1; + send=NULL; attr_cnt = accb.get_core_attrs( req, inf->varr, inf->iarr, inf->tarr ); @@ -384,14 +385,28 @@ int acc_radius_send_request(struct sip_msg *req, acc_info_t *inf) inf->tarr, 0))!=0 ); } - if (rc_acct(rh, SIP_PORT, send)!=OK_RC) { - LM_ERR("radius-ing failed\n"); - goto error; - } - rc_avpair_free(send); - /* free memory allocated by extra2strar */ - free_strar_mem( &(inf->tarr[m-o]), &(inf->varr[m-o]), o, m); - return 1; + rc_result=rc_acct(rh, SIP_PORT, send); + + if (rc_result==ERROR_RC) { + LM_ERR("Radius accounting - ERROR - \n"); + goto error; + }else if(rc_result==BADRESP_RC){ + LM_ERR("Radius accounting - BAD RESPONSE \n"); + goto error; + }else if(rc_result==TIMEOUT_RC){ + LM_ERR("Radius accounting - TIMEOUT \n"); + goto error; + }else if(rc_result==REJECT_RC){ + LM_ERR("Radius accounting - REJECTED \n"); + goto error; + }else if(rc_result==OK_RC){ + LM_DBG("Radius accounting - OK \n"); + } + + rc_avpair_free(send); + /* free memory allocated by extra2strar */ + free_strar_mem( &(inf->tarr[m-o]), &(inf->varr[m-o]), o, m); + return 1; error: rc_avpair_free(send);