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

Skyler skchopperguy at gmail.com
Tue Feb 21 03:48:25 EST 2012


Hi All,

My apologies, there was nothing to see here.

Skyler

On Mon, Feb 20, 2012 at 11:05 AM, Skyler <skchopperguy at gmail.com> wrote:

> Hi Daniel,
>
>  See, I knew my calculator was broken...where's my hammer!? ;o)
>
> > 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).
>
> Ok, so I am definitely confused then. Let me just ask, if _you_ wanted to
> charge 0.002 cents per minute on a destination, how would _you_ enter this
> into a billing profile?
>
> onpeak init rate: ?
> onpeak init interval: ?
> onpeak follow rate: ?
> onpeak follow interval: ?
>
>  While we're here, my other goal is to obtain a total $ amount on all
> calls for each source_external_contract_id and give this to the accounting
> department. Below is what I had in mind for a query. My interpretation is
> "15215 did 107 calls at a cost of $46.50" but that is definitely wrong, so
> how would you do a select query to obtain the correct total $'s?
>
> mysql> select source_external_contract_id, sum(customer_cost), count(*)
> from cdr group by source_external_contract_id;
> +-----------------------------+--------------------+----------+
> | source_external_contract_id | sum(customer_cost) | count(*) |
> +-----------------------------+--------------------+----------+
> |                             |               0.00 |        1 |
> | 15215                       |              46.50 |      107 |
> +-----------------------------+--------------------+----------+
> 2 rows in set (0.00 sec)
>
>
> TIA,
> Skyler
>
> On Mon, Feb 20, 2012 at 10:19 AM, Daniel Tiefnig <dtiefnig at sipwise.com>wrote:
>
>> 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
>>
>> ______________________________**_________________
>> Spce-user mailing list
>> Spce-user at lists.sipwise.com
>> http://lists.sipwise.com/**listinfo/spce-user<http://lists.sipwise.com/listinfo/spce-user>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sipwise.com/pipermail/spce-user_lists.sipwise.com/attachments/20120221/659d0b56/attachment-0001.html>


More information about the Spce-user mailing list