SMS billing

48 views
Skip to first unread message

Abisai Matangira

unread,
Jun 11, 2025, 8:51:12 AMJun 11
to cgr...@googlegroups.com

Hello ,

Running into an issue with SMS billing where cost and debit behave differently.

The cost command works as expected.

Working cost command:

cost Tenant="[MyTenant]" Category="sms" Subject="[MyAccount]" AnswerTime="2025-06-11T14:45:00Z" Destination="[MyDestination]" Usage="1"

Result:

It correctly finds the event-based rate and gives the right cost.

JSON
{
    "Cost": 0.02,
    "Rates": { "..." : [ { "RateUnit": "1ns", "Value": 0.02 } ] },
    "Usage": "1ns"
}

When I try to actually debit it, the cost is 0.

Failing debit command:

debit Tenant="[MyTenant]" Category="sms" Account="[MyAccount]" Destination="[MyDestination]" TimeStart="2025-06-11T14:45:00Z" TimeEnd="2025-06-11T14:45:00Z" Usage="1" CallDuration="1"

Result:

The balance is unchanged and key fields are zero or null.

JSON
{
 "AccountSummary": { "Initial": 6.4, "Value": 6.4 },
 "Cost": 0,
 "RatedUsage": 0,
 "Timespans": [ { "Cost": 0, "RateInterval": null } ]
}

The debit output has "RateInterval": null", so it's clearly not finding a rate.

Are there any pointers to this

Thanks.

Armir Veliaj

unread,
Jun 12, 2025, 8:13:11 AMJun 12
to CGRateS
Hi Abisai,

The difference between the cost and debit results is that cost ignores user balances and just calculates based on rates, while debit considers user balances in its calculations.

Also the console command you used for debit does not contain the correct fields. To find all the possible correct commands in the cgr-console, you can type 'help', which will display all available commands in the correct format. In the case for debit the correct format command is:
Usage: debit Category="" Tenant="" Subject="" Account="" Destination="" TimeStart="0001-01-01T00:00:00Z" TimeEnd="0001-01-01T00:00:00Z" FallbackSubject="" ToR="" DryRun=false

e.g.   debit Tenant="cgrates.org" Category="sms" Subject="1001" Account="1001" Destination="1002" TimeStart="2025-06-11T14:45:00Z" TimeEnd="2025-06-11T14:45:00.000000001Z" ToR="*sms" DryRun=false


Thanks,
Armir
Reply all
Reply to author
Forward
0 new messages