sip-router

SIP Router Project

Tasklist

FS#163 - enable milliseconds precision for accounting

Attached to Project: sip-router
Opened by Andrew Pogrebennyk (marduk) - Wednesday, 05 October 2011, 11:25 GMT
Last edited by Daniel-Constantin Mierla (miconda) - Thursday, 05 September 2013, 10:00 GMT
Task Type Feature Request
Category Core
Status Closed
Assigned To Daniel-Constantin Mierla (miconda)
Operating System All
Severity Low
Priority Normal
Reported Version 3.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Telecommunication platforms in Germany must collect CDR start/stop times with an accuracy of +/- 500 ms.
The attached patch is a WIP to achieve milliseconds precision with accounting.
I have added new column acc.time_hires (decimal 13,3) because mysql doesn’t support milliseconds precision with time and date datatypes. Human-readable representation can be achieved by:
select from_unixtime(time_hires) from acc;
My TODO: prepare sql files, readme, enable milliseconds precision with accounting to log and radius if necessary.
Not sure about the built-in cdr generation functionality as we are not using it (and we are still on 3.1.5).
But right now I would like to collect some feedback as the ultimate goal is to get this integrated into upstream.
So, I am willing to improve it. Any remarks and suggestions are welcome.

This task depends upon

Closed by  Daniel-Constantin Mierla (miconda)
Thursday, 05 September 2013, 10:00 GMT
Reason for closing:  Implemented
Additional comments about closing:  Implemented in master branch, given when time_mode=2 for acc module.
Comment by Timo Reimann (tr) - Wednesday, 05 October 2011, 16:26 GMT

The question on how to represent milliseocnd-precision time values properly has been discussed on the mailing list before, please take the following thread into consideration: http://lists.sip-router.org/pipermail/sr-users/2011-August/069704.html. Alex Hermann pretty much voted against DECIMAL and in favor of NUMERIC, see here: http://lists.sip-router.org/pipermail/sr-users/2011-August/069722.html.

Comment by Timo Reimann (tr) - Wednesday, 05 October 2011, 16:32 GMT

By the way, I noted the value range of timeval’s tv_usec field is architecture-dependent: On my Mac, it’s like [0,1000000) while on Linux I think it’s [0,1000). So when converting portions of timeval this should be accounted for.

Comment by Timo Reimann (tr) - Friday, 07 October 2011, 14:31 GMT

Please disregard my very last comment completely; I was in an alternate universe when I wrote that.

Comment by Andrew Pogrebennyk (marduk) - Friday, 07 October 2011, 14:45 GMT

:) ok, no problem

Comment by Daniel-Constantin Mierla (miconda) - Tuesday, 23 April 2013, 18:52 GMT

Revived from the mailing list – I see few issues and have some questions:

- the tm variable is declared set, but not used
- tz is also not used, gettimeofday() can take NULL as second parameter and iirc, tz is obsolete
- I wonder if gettimeofday() can actually fail and return code should be checked for error cases
- the names of the new column, respectively ‘time_hires’ sounds a bit strange to me, does it have any special meaning the word ‘hires’?

Overall, wouldn’t be better to keep the seconds and microseconds (as returned in a timeval structure) in separate columns. That means keeping the time column as it is and adding a new column for microsecs. Then people can get the precision as they want, including only down to the miliseconds if that is what they need.

Comment by Jon Bonilla (manwe) - Tuesday, 23 April 2013, 19:33 GMT

regarding “hires” I’d say it means “High Resolution”

Loading...