I noticed, while reviewing CSV CDRs created with cdr_custom, that while CDR(billsec) and CDR(duration) report correct values, the corresponding high precision values CDR(billsec,f) and CDR(duration,f) are wrong. More specifically these values seem to be a thousandth of their non-high-precision counterpart (e.g. if CDR(billsec) is 37, CDR(billsec,f) is 0.037000 ).
It seems to me that the code in funcs/func_cdr.c gets this value via ast_cdr_getvar() (from main/cdr.c), and assumes that the returned value is in milliseconds, this dividing the value by 1000. The problem appears to be that ast_cdr_getvar() gets the value via cdr_object_format_property() and thus via two specialized functions
which both return the value in seconds. General assumptions seem to indicate that internal representation of these values should be considered in milliseconds. I hope you can verify my guesses, and provide a consistent fix.
As a side note, I can confirm that the issue was not present in the 1.8 series, and that the affected portions of code have been reorganized since then. In that version, values were returned in milliseconds, and the CDR() functions handled them properly.
|For Gerrit Dashboard: ASTERISK-25179|
|2034,4||funcs/func_cdr: Correctly report high precision values for duration and billsec||asterisk||Status: MERGED||+2||+1|
|2035,1||tests/cdr/cdr_manipulation: Add a test for the CDR dialplan function||testsuite||Status: MERGED||+2||+1|
|2044,3||funcs/func_cdr: Correctly report high precision values for duration and billsec||asterisk||Status: MERGED||+2||+1|