[asterisk-bugs] [Asterisk 0013366]: CDR billsec value accuracy

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Aug 26 10:48:51 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13366 
====================================================================== 
Reported By:                erousseau
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   13366
Category:                   CDR/General
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     new
Asterisk Version:           1.4.21 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-08-22 19:34 CDT
Last Modified:              2008-08-26 10:48 CDT
====================================================================== 
Summary:                    CDR billsec value accuracy
Description: 
We are using CDR for billing and we are now comparing billing information
from Asterisk CDR and billing information bringed by our PSTN operator. 

We have to face a minor but critical issue regarding the billsec value
accuracy. 

For some calls, the billsec value bringed by the operator is 1s more than
the billsec value reported by Asterisk in CDR. 

On the PSTN operator side, the billing process charges any second that has
been initiated. Meaning that for a call that took (billsec) 62.3 s (62 s
and 300 ms) the operator will report and charge a billsec value of 63.

I have looked the core code from Asterisk source and found the following
in main/cdr.c :

cdr->billsec = ast_tvzero(cdr->answer) ? 0 : cdr->end.tv_sec -
cdr->answer.tv_sec;

Imagine that cdr->end.tv_usec give 0.9s and that cdr->answer.tv_usec give
0.1s. The billsec value (as calculated by Asterisk) looks like simply
ignore the 0.8s that come from the tv_usec value difference...
====================================================================== 

---------------------------------------------------------------------- 
 (0091744) svnbot (reporter) - 2008-08-26 10:48
 http://bugs.digium.com/view.php?id=13366#c91744 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 140057

U   trunk/CHANGES
U   trunk/configs/cdr.conf.sample
U   trunk/include/asterisk/options.h
U   trunk/main/cdr.c

------------------------------------------------------------------------
r140057 | murf | 2008-08-26 10:48:50 -0500 (Tue, 26 Aug 2008) | 21 lines

(closes issue http://bugs.digium.com/view.php?id=13366)
Reported by: erousseau

This was a reasonable enhancement request, which was
easy to implement. Since it's an enhancement, it 
could only be applied to trunk.

Basically, for accounting where "initiated" seconds
are billed for, if the microseconds field on the end
time is greater than the microseconds field for the
answer time, add one second to the billsec field.

The implementation was requested by erousseau, and
I've implemented it as requested. I've updated the
CHANGES, the cdr.conf.sample, and the .h files
accordingly, to accept and set a flag for the
corresponding new option. cdr.c adds in the extra
second based on the usec fields if the option is
set. Tested, seems to be working fine.


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=140057 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-08-26 10:48 svnbot         Note Added: 0091744                          
======================================================================




More information about the asterisk-bugs mailing list