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

Skyler skchopperguy at gmail.com
Mon Feb 20 12:42:13 EST 2012


Hi all,

 I've recently started focusing with the billing part of CE to show
management how we could rate/invoice each office individually. After adding
new billing profile and rates, I noticed the call charges are not correct
after rating. Could someone clarify that I am entering the required
information properly? Maybe my math and the calculator I use is broken?

Billing Profile:

Handle: Test_Profile
name: Test_Profile
Interval Charge: 0.00
Interval Free Time: 0
Interval free Cash: 0.00
Currency: $
VAT Rate: 0
VAT Included: NO

Stored Billing Fees:

destination: 1777888
zone: Inter-Office
zone detailed: local network
onpeak init rate: 0.002
onpeak init interval: 60
onpeak follow rate: 0.002
onpeak follow interval: 60
offpeak init rate: 0.002
offpeak init interval: 60
offpeak follow rate: 0.002
offpeak follow interval: 60
use free time: NO


 My goal with above settings is to charge $0.002 per minute on all calls to
destination of 1777888*, when I make a call to a 1777888, the cdr shows the
call correctly BUT the charges seem to me to be wrong.

 In www_admin and www_csc I can see:  +17778884646  03:45  $ 0.0048
 20.02.2012 16:45:03

In accounting.cdr I see:

mysql> select * from cdr where call_id = 'ce4a21e2-e6900664 at 192.168.1.119
'\G;
*************************** 1. row ***************************
                                id: 108
                       update_time: 2012-02-20 16:48:59
                    source_user_id: 2b080f52-f555-4e76-a19a-b333bd4b7f4a
                source_provider_id: 1
     source_external_subscriber_id: 15215
       source_external_contract_id: 15215
                 source_account_id: 2
                       source_user: 17778884545
                     source_domain: dev.mydomain.com
                        source_cli: 17778884545
                       source_clir: 0
               destination_user_id: 99e28287-f342-4128-9d5a-42ef9b3990f0
           destination_provider_id: 1
destination_external_subscriber_id:
  destination_external_contract_id: 15215
            destination_account_id: 2
                  destination_user: 17778884646
                destination_domain: dev.mydomain.com
           destination_user_dialed: 17778884646
               destination_user_in: 17778884646
             destination_domain_in: dev.mydomain.com
                    peer_auth_user:
                   peer_auth_realm:
                         call_type: call
                       call_status: ok
                         call_code: 200
                        start_time: 1329756303.950
                          duration: 224.010
                           call_id: ce4a21e2-e6900664 at 192.168.1.119
                      carrier_cost: 0.00
                     reseller_cost: 0.00
                     customer_cost: 0.48
                 carrier_free_time: 0
                reseller_free_time: 0
                customer_free_time: 0
            carrier_billing_fee_id: NULL
           reseller_billing_fee_id: NULL
           customer_billing_fee_id: 2
           carrier_billing_zone_id: NULL
          reseller_billing_zone_id: NULL
          customer_billing_zone_id: 4
               frag_carrier_onpeak: NULL
              frag_reseller_onpeak: NULL
              frag_customer_onpeak: NULL
                     is_fragmented: NULL
                          rated_at: 2012-02-20 16:48:59
                     rating_status: ok
1 row in set (0.00 sec)

 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 ;). 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.

 So, I thought that was weird and took a look first to difference in
decimal points. 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?

mysql> SHOW COLUMNS FROM cdr WHERE Field = 'customer_cost';
+---------------+---------------+------+-----+---------+-------+
| Field         | Type          | Null | Key | Default | Extra |
+---------------+---------------+------+-----+---------+-------+
| customer_cost | decimal(10,2) | YES  |     | NULL    |       |
+---------------+---------------+------+-----+---------+-------+
1 row in set (0.00 sec)

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

mysql> ALTER TABLE accounting.cdr MODIFY customer_cost decimal(10,4);

Though still the math seems wrong to me, I don't know where to look for how
the 'floats' are calculated then written to db. Could the float calculation
be incorrect? or is it just me that is not entering the information
correctly? or maybe my interpretation of results is wrong?

 I would like to do a presentation to management this Friday but I know
they will 'Bash' me if they see any numbers not adding up (all they can do
is math and enjoy the pretty pictures as they don't understand anything
else I say anyway, haha /kidding).

Any help is appreciated! ;)

Skyler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sipwise.com/mailman/private/spce-user_lists.sipwise.com/attachments/20120220/eb8e33a0/attachment.html>


More information about the Spce-user mailing list