Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acc: save cdr entries in UTC #1358

Closed
cruzccl opened this issue Dec 11, 2017 · 2 comments
Closed

acc: save cdr entries in UTC #1358

cruzccl opened this issue Dec 11, 2017 · 2 comments

Comments

@cruzccl
Copy link
Contributor

cruzccl commented Dec 11, 2017

Description

ACC module allows setting datetime fields in UTC via time_mode param.

However, this setting does not cause cdr entries to be saved in that format and I haven't found any equivalent parameter to achieve this.

Troubleshooting

Analyzing the code for MySQL database storage I have found that db_time2str_ex function defined in db_ut.c uses localtime().

Possible Solutions

Changing localtime() to gmtime() cdrs are saved in UTC, but it would be desirable to add a new module param that makes this configurable.

Additional Information

  • Kamailio Version - output of kamailio -v
version: kamailio 4.4.6 (x86_64/linux) 0a8379-dirty
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 0a8379 -dirty
compiled on 17:01:42 Dec  4 2017 with gcc 6.3.0

  • Operating System:
Linux 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) x86_64 GNU/Linux

Should I proceed and try to get a working PR to add this new modparam or there is currently a way to get this that I have missed (apart from setting system time to UTC)?

Thank you and regards,

@miconda
Copy link
Member

miconda commented Dec 11, 2017

A PR is more than welcome -- but no need for a new param, I think you can just reuse the exiting param and extend the functionality for cdrs -- I do not see a reason to have acc records in local time and cdrs in utc or the other way around.

cruzccl added a commit to cruzccl/kamailio that referenced this issue Dec 14, 2017
acc.time_mode modparam allows saving acc transactions time field using
the output of gmtime() when it is set to 4.

This commit aims to reuse this modparam for cdr entries, storing start_time
and end_time in gmtime if time_mode is 4.

Fixes kamailio#1358
cruzccl added a commit to cruzccl/kamailio that referenced this issue Dec 14, 2017
- reuse acc.time_mode modparam for cdr entries, storing start_time and
end_time in gmtime if time_mode is 4.

GH kamailio#1358
cruzccl added a commit to cruzccl/kamailio that referenced this issue Dec 15, 2017
- reuse acc.time_mode modparam for cdr entries, storing start_time and
end_time in gmtime if time_mode is 4.

GH kamailio#1358
@miconda
Copy link
Member

miconda commented Jan 3, 2018

Done with the merge of commits referenced above.

@miconda miconda closed this as completed Jan 3, 2018
miconda pushed a commit that referenced this issue Jan 19, 2018
- reuse acc.time_mode modparam for cdr entries, storing start_time and
end_time in gmtime if time_mode is 4.

GH #1358

(cherry picked from commit 63f747a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants