Question about Balances

74 views
Skip to first unread message

voipt...@gmail.com

unread,
Oct 19, 2015, 4:09:56 PM10/19/15
to CGRateS

Hi DanB,

I have an interesting issue with Balances. 

I used the ApierV1. EnableDisableBalance to disable a balance that I didn't want to use because it had Weight 0 and I wanted to only use the Balance with Weight 10.  So the balance was disabled no problem. 
Then I made some calls and CGRateS just created a new balance with Weight 0 and with a value of 0 and started deducting the calls from that new balance and sending the balance into negative.

Any idea why this is and where its getting the information to set that BalanceWeight to 0?

{
  "id": null,
  "result": {
    "Id": "*out:cgrates.org:1482229879",
    "BalanceMap": {
      "*monetary*out": [
        {
          "Uuid": "f647756f-72cd-4f2a-9c5e-214bc5e8d543",   ------ This is the balance I want to use
          "Id": "",
          "Value": 0,
          "ExpirationDate": "0001-01-01T00:00:00Z",
          "Weight": 10,
          "DestinationIds": "",
          "RatingSubject": "",
          "Category": "",
          "SharedGroup": "",
          "Timings": null,
          "TimingIDs": "",
          "Disabled": false
        },
        {
          "Uuid": "DEFAULT6c75b743-996c-478f-817b-480ae61fcbc0", ----- This is the balance that was disabled.
          "Id": "",
          "Value": -81.148022059,
          "ExpirationDate": "0001-01-01T00:00:00Z",
          "Weight": 0,
          "DestinationIds": "",
          "RatingSubject": "",
          "Category": "",
          "SharedGroup": "",
          "Timings": null,
          "TimingIDs": "",
          "Disabled": true
        },
        {
          "Uuid": "D22ebd02-2a1e-4e5d-b945-fa1227d5eeb1",  ----- This is the NEW balance that was created by CGRateS!
          "Id": "",
          "Value": -0.0253900004,
          "ExpirationDate": "0001-01-01T00:00:00Z",
          "Weight": 0,
          "DestinationIds": "",
          "RatingSubject": "",
          "Category": "",
          "SharedGroup": "",
          "Timings": null,
          "TimingIDs": "",
          "Disabled": false
        }

Any ideas?

Regards,

Errol

Dan-Cristian Bogos

unread,
Oct 19, 2015, 11:32:08 PM10/19/15
to cgr...@googlegroups.com

Hi Errol

Only default balance (weight 0) will go on negative. If that does not exist we will create one.

DanB.

--
You received this message because you are subscribed to the Google Groups "CGRateS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cgrates+u...@googlegroups.com.
To post to this group, send email to cgr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cgrates/2314a0ec-1ae7-4321-8c91-5f1e819b2c23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Errol Samuels

unread,
Oct 20, 2015, 7:50:08 AM10/20/15
to cgr...@googlegroups.com
DanB,
Thank you for your response but your answer has left me more confused than ever!

I was under the impression that we didn't need or shouldn't have balances with Weight 0 perhaps due to a misunderstanding after a discussion with rif.

So I went and created new balances with Weight 10 then disabled all the balances that had Weight 0 now from your answer it seems that we MUST have balances with Weight 0.  So does is *monetary balances with Weight 0 mandatory?

Please clarify.

Thanks

Errol

--
You received this message because you are subscribed to a topic in the Google Groups "CGRateS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cgrates/GqQQWqxmOzo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cgrates+u...@googlegroups.com.

To post to this group, send email to cgr...@googlegroups.com.

Dan-Cristian Bogos

unread,
Oct 20, 2015, 7:52:40 AM10/20/15
to cgr...@googlegroups.com

Hey Errol

You don't need to create yourself balances with 0 weight but if we need to go on negative we only go on default balance which is the one with weight 0. If you did not create one we will do it for u. Does that make sense?

DanB.

Errol Samuels

unread,
Oct 20, 2015, 8:04:02 AM10/20/15
to cgr...@googlegroups.com
DanB,

I was not aware before that only balances with Weight 0 are allow to go into negative.

So basically what you are saying is that if I am using Postpaid accounts which will require the account to go into negative then I need to create those accounts with Weight 0.  Which also means if I need to convert a Prepaid account to Postpaid I might as well create all the balances with Weight 0.

 Regards,

Errol



--
You received this message because you are subscribed to a topic in the Google Groups "CGRateS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cgrates/GqQQWqxmOzo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cgrates+u...@googlegroups.com.
To post to this group, send email to cgr...@googlegroups.com.

DanB

unread,
Oct 20, 2015, 2:40:12 PM10/20/15
to cgr...@googlegroups.com
Hi Errol,

Yes, that should be the way if you want to only have one balance.

DanB
You received this message because you are subscribed to the Google Groups "CGRateS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cgrates+u...@googlegroups.com.

To post to this group, send email to cgr...@googlegroups.com.

Errol Samuels

unread,
Oct 20, 2015, 2:44:11 PM10/20/15
to cgr...@googlegroups.com
I forgot to mentioned I was referring to *monetary balance so I assume with *voice balances I wouldn't use Weight 0 since I wouldn't want the account to go into negative.
Is that correct?


Dan-Cristian Bogos

unread,
Oct 20, 2015, 2:45:59 PM10/20/15
to cgr...@googlegroups.com

Well voice ones cannot go ever on negative.

DanB

Errol Samuels

unread,
Oct 20, 2015, 2:49:29 PM10/20/15
to cgr...@googlegroups.com
Hi DanB,

Yes I understand voice minutes can't go into negative but I am just making sure that I am clear with how these work as well.  So I just wanted to make sure that when I create the *Voice balance with Weight of 10 there will be no issue with CGRateS trying to create a default balance with Weight 0.

Thanks

Errol


Dan-Cristian Bogos

unread,
Oct 20, 2015, 2:54:57 PM10/20/15
to cgr...@googlegroups.com

Nope ... only monetary one is default created if it does not exist.

DanB

Reply all
Reply to author
Forward
0 new messages