1. Asterisk
  2. ASTERISK-25179

CDR(billsec,f) and CDR(duration,f) report incorrect values


    • Frequency of Occurrence:



      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

      • cdr_object_get_duration()
      • cdr_object_get_billsec()

      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.

      1. ASTERISK-25179-13.diff
        2 kB
        Matt Jordan
      2. ASTERISK-25179-13-2.diff
        2 kB
        Matt Jordan

        Issue Links


          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Triage Triage Waiting for Feedback Waiting for Feedback
          2d 12h 1m 1 Rusty Newton 24/Jun/15 3:57 PM
          Waiting for Feedback Waiting for Feedback Waiting for Feedback Waiting for Feedback
          11h 29m 1 Gianluca Merlo 25/Jun/15 3:27 AM
          Waiting for Feedback Waiting for Feedback Triage Triage
          1 Gianluca Merlo 25/Jun/15 3:27 AM
          Triage Triage Open Open
          15h 39m 1 Rusty Newton 25/Jun/15 7:06 PM
          Open Open In Progress In Progress
          207d 15h 56m 1 Matt Jordan 19/Jan/16 10:03 AM
          In Progress In Progress Closed Closed
          1d 32m 1 Matt Jordan 20/Jan/16 10:35 AM
          Closed Closed Closed Closed
          1 Matt Jordan 20/Jan/16 10:35 AM


            • Votes:
              0 Vote for this issue
              5 Start watching this issue


              • Created: