[Spce-user] 2.4 Billing - charges incorrect - possible bug?

Daniel Tiefnig dtiefnig at sipwise.com
Mon Feb 20 13:19:09 EST 2012


On 02/20/2012 06:42 PM, Skyler wrote:
> Stored Billing Fees:

> onpeak init rate: 0.002
> onpeak init interval: 60
> onpeak follow rate: 0.002
> onpeak follow interval: 60

> My goal with above settings is to charge $0.002 per minute[...]

Well this won't work out that way. As you can see in the admin web
interface, you need to specify the "rate in cent per second". With the
above settings, you'll charge 0.002 * 60 cent per minute. I know this is
a bit confusing in the beginning.

> Two things that strike me as wrong. First is call duration, in
> www_csc I see 03:45 and in accounting.cdr I see 224.010. My logic
> tells me that one of these is in minutes, the other is in seconds and
> also one of these should be correct, but my calculator says they
> don't add up together in any way ;).

Hmm, my biologically built-in calculator says it's correct. :o)

224.010 seconds is 3 minutes (180 seconds) plus 44.010 seconds. As
accounting for the customer is done per commenced second, this rounds up
to 45 seconds. So it's 03:45 really.

> Second, in www_csc I see the charge as $0.0048 but in the
> accounting.cdr I see customer_cost: 0.48. Also the corresponding
> cdrexport shows customer_cost: 0.48 as well.

That's because the DB, the CDR export and the SOAP / XML-RPC functions
handle money in hundredths of your currency. So it's 0.48 ¢ in the DB
actually, which equates to 60 (interval length) * 4 (no. intervals) *
0.002 (rate in cent per second).

> In www_csc the display of 0.0048 indicates the db would be
> decimal(10,4), but in accounting.cdr is decimal(10,2). Shouldn't
> accounting.cdr be decimal(10,4) to match?

Same as above: As it's using ¢, it only stores 2 decimals for the value.

> So I changed it to decimal(10,4) and that fixed the decimal trouble.

Hmm, which trouble, actually? :o)

Let me know if you still see any wrong numbers.

br,
daniel




More information about the Spce-user mailing list