[sr-dev] git:master:750248ca: acc_radius : added radius time mode
Yasin CANER
yasin.caner at netgsm.com.tr
Mon Oct 26 21:38:56 CET 2015
Module: kamailio
Branch: master
Commit: 750248ca22f0b8f03373cae2a56d56c3e0ae6d81
URL: https://github.com/kamailio/kamailio/commit/750248ca22f0b8f03373cae2a56d56c3e0ae6d81
Author: Yasin CANER <yasin.caner at netgsm.com.tr>
Committer: Yasin CANER <yasin.caner at netgsm.com.tr>
Date: 2015-10-23T11:12:43+03:00
acc_radius : added radius time mode
added radius time mode for new event-timestamp . Format is seconds.microseconds
---
Modified: modules/acc_radius/acc_radius_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/750248ca22f0b8f03373cae2a56d56c3e0ae6d81.diff
Patch: https://github.com/kamailio/kamailio/commit/750248ca22f0b8f03373cae2a56d56c3e0ae6d81.patch
---
diff --git a/modules/acc_radius/acc_radius_mod.c b/modules/acc_radius/acc_radius_mod.c
index 5a660d6..e3be7df 100644
--- a/modules/acc_radius/acc_radius_mod.c
+++ b/modules/acc_radius/acc_radius_mod.c
@@ -74,6 +74,7 @@ static char *radius_config = 0;
int radius_flag = -1;
int radius_missed_flag = -1;
static int service_type = -1;
+int rad_time_mode=0;
void *rh;
/* rad extra variables */
static char *rad_extra_str = 0;
@@ -91,11 +92,12 @@ static cmd_export_t cmds[] = {
static param_export_t params[] = {
- {"radius_config", PARAM_STRING, &radius_config },
+ {"radius_config", PARAM_STRING, &radius_config },
{"radius_flag", INT_PARAM, &radius_flag },
{"radius_missed_flag", INT_PARAM, &radius_missed_flag },
{"service_type", INT_PARAM, &service_type },
- {"radius_extra", PARAM_STRING, &rad_extra_str },
+ {"radius_extra", PARAM_STRING, &rad_extra_str },
+ {"rad_time_mode", INT_PARAM, &rad_time_mode },
{0,0,0}
};
@@ -328,6 +330,8 @@ int acc_radius_send_request(struct sip_msg *req, acc_info_t *inf)
int m=0;
int o=0;
int rc_result=-1;
+ double tsecmicro;
+ char smicrosec[18];
send=NULL;
@@ -347,9 +351,18 @@ int acc_radius_send_request(struct sip_msg *req, acc_info_t *inf)
av_type = req->REQ_METHOD; /* method */
ADD_RAD_AVPAIR( RA_SIP_METHOD, &av_type, -1);
- /* unix time */
- av_type = (uint32_t)inf->env->ts;
- ADD_RAD_AVPAIR( RA_TIME_STAMP, &av_type, -1);
+ // Event Time Stamp with Microseconds
+ if(rad_time_mode==1){
+ gettimeofday(&inf->env->tv, NULL);
+ tsecmicro=inf->env->tv.tv_sec+((double)inf->env->tv.tv_usec/1000000.0);
+ //radius client doesn t support double so convert it
+ sprintf(smicrosec,"%f",tsecmicro);
+ ADD_RAD_AVPAIR(RA_TIME_STAMP, &smicrosec, -1);
+ }else{
+ av_type = (uint32_t)inf->env->ts;
+ ADD_RAD_AVPAIR(RA_TIME_STAMP, &av_type, -1);
+ }
+
/* add extra also */
o = accb.get_extra_attrs(rad_extra, req, inf->varr+attr_cnt,
More information about the sr-dev
mailing list