RADIUS Agents Inquiry

88 views
Skip to first unread message

Justin Mark Repollo

unread,
Nov 9, 2025, 2:20:29 PMNov 9
to cgr...@googlegroups.com

Hi CGRateS Community,

I’m currently setting up CGRateS with RADIUS agents integrated to a MikroTik router. I’ve been using some of the sample templates from GitHub as reference.

My setup runs in Docker containers — one for the CGRateS engine, one for PostgreSQL, and one for Redis. I’m also using the Omnitouch CGRateS UI to easily issue API commands and manage configurations.

So far, I’ve successfully configured and verified my Destinations, Destination Rates, Rates, Rating Plans, and Rating Profiles in the PostgreSQL database.

However, during testing, I encountered the following error:

[ERROR] Destination *any not authorized for account: cgrates.org:testuser, subject: *out:cgrates.org:data:testuser 2025/11/07 11:31:10 CGRateS <node1> [ERROR] <Rater> Error getting cost for account key <cgrates.org:testuser>: UNAUTHORIZED_DESTINATION 2025/11/07 11:31:10 CGRateS <node1> [WARNING] <SessionS> could not complete debit operation on session: <9331c9bcc07d2f86c9171eb270e1cceb61c2cadf>, error: <UNAUTHORIZED_DESTINATION>

It seems the rating engine cannot authorize the destination for this account.
I’ve attached my cgrates.json configuration and engine logs for reference.

Any guidance on what might be missing or misconfigured would be greatly appreciated.

Thank you!
Justin

cgr-engine_logs.txt
cgrates_radius.json

Armir Veliaj

unread,
Nov 10, 2025, 10:22:07 AMNov 10
to CGRateS
Hi Justin,

Based on the error you're receiving in the logs, it seems like there may be a misconfiguration with the Destinations. The *any value should not be placed in the Destinations, but in the DestinationRates configuration.

To have your full scenario and verify it, you can send us all your csv files, including the Destinations and DestinationRates.

Thanks,
Armir

Justin Mark Repollo

unread,
Nov 13, 2025, 3:26:26 AMNov 13
to cgr...@googlegroups.com

Hi Armir,

Thank you for your response.

I used the CGRateS API to add Destinations and DestinationRates. Below are the commands I executed:

Create the Destination:
curl -s http://192.168.1.132:2080/jsonrpc \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "id":1,
    "method":"ApierV2.SetTPDestination",
    "params":[{"TPid":"cgrates.org","ID":"Dest_DATA","Prefixes":["server1", "server2", "*any"]}]
  }'


Create the Rate:
curl -s http://192.168.1.132:2080/jsonrpc \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "id":1,
    "method":"ApierV1.SetTPRate",
    "params":[
      {
        "TPid":"cgrates.org",
        "ID":"Rate_DATA",
        "RateSlots":[
          {"ConnectFee":0,"Rate":0.005,"RateUnit":"1","RateIncrement":"1","GroupIntervalStart":""}
        ]
      }
    ]
  }'

Map Destination → Rate:
curl -s http://192.168.1.132:2080/jsonrpc \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "id":1,
    "method":"ApierV1.SetTPDestinationRate",
    "params":[
      {
        "TPid":"cgrates.org",
        "ID":"DestRate_DATA",
        "DestinationRates":[
          {"DestinationId":"Dest_DATA","RateId":"Rate_DATA","RoundingMethod":"*up","RoundingDecimals":4,"MaxCost":0,"MaxCostStrategy":""}
        ]
      }
    ]
  }'

Create the Rating Plan:
curl -s http://192.168.1.132:2080/jsonrpc \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "id":1,
    "method":"ApierV1.SetTPRatingPlan",
    "params":[
      {
        "TPid":"cgrates.org",
        "ID":"RatingPlan_DATA",
        "RatingPlanBindings":[
          {"DestinationRatesId":"DestRate_DATA","TimingID":"*any","Weight":10}
        ]
      }
    ]
  }'

image.png

image.png


Regards,
Justin

--
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 view this discussion visit https://groups.google.com/d/msgid/cgrates/cb39ad3e-e633-4af6-81a2-96415f5ba777n%40googlegroups.com.

Armir Veliaj

unread,
Nov 13, 2025, 6:26:50 AMNov 13
to CGRateS
Hi Justin,

As we suspected at first, and now after checking your APIs, the error is caused by the use of the value *any in the Destinations config.
There should not be "*any" in Destinations itself, instead, you can use "*any" in DestinationRates, where it is totally fine to have it.

Thanks,
Armir

Justin Mark Repollo

unread,
Nov 14, 2025, 6:00:20 AMNov 14
to cgr...@googlegroups.com

Hi Armir,

Thank you for your response.

I was able to resolve the issue — I can now see the sessions properly, and data balance deductions are working. However, I’m encountering a new problem: the cgrates-engine is being killed randomly.

Below is the ngrep output for reference:

T 2025/11/14 10:46:29.468035 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #1
{"method":"_goRPC_.Cancel","params":[{"Seq":21}],"id":24}

##
T 2025/11/14 10:46:29.468101 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #3
{"id":20,"result":null,"error":"RALS_ERROR:context deadline exceeded"}

#
T 2025/11/14 10:46:29.468108 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #4
{"method":"_goRPC_.Cancel","params":[{"Seq":20}],"id":25}

##
T 2025/11/14 10:46:29.468198 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #6
{"method":"Responder.MaxDebit","params":[{"Category":"data","Tenant":"cgrates.org","Subject":"testuser","Account":"testuser","Destination":"server1","TimeStart":"0001-01-01T00:00:00Z","TimeEnd":"0001-01-01T00:00:00.00465838Z","LoopIndex":0,"DurationIndex":9316760,"FallbackSubject":"","RatingInfos":null,"Increments":null,"ToR":"*data","ExtraFields":{"RemoteAddr":"136.158.122.86"},"MaxRate":0,"MaxRateUnit":0,"MaxCostSoFar":0,"CgrID":"e50b6b7afd71c7e3acce55104e2610ef6f71114b","RunID":"*default","ForceDuration":false,"PerformRounding":false,"DenyNegativeAccount":false,"DryRun":false,"APIOpts":{"*attrProfileIDs":null,"*context":"*sessions","*subsys":"*sessions"}}],"id":26}

#
T 2025/11/14 10:46:29.468222 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #7
{"id":25,"result":false,"error":null}

#
T 2025/11/14 10:46:29.468244 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #8
{"id":24,"result":false,"error":null}

##
T 2025/11/14 10:46:29.773044 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #10
{"method":"_goRPC_.Cancel","params":[{"Seq":22}],"id":27}

#
T 2025/11/14 10:46:29.773288 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #11
{"id":27,"result":false,"error":null}

##
T 2025/11/14 10:46:30.077630 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #13
{"method":"_goRPC_.Cancel","params":[{"Seq":23}],"id":28}

#
T 2025/11/14 10:46:30.077895 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #14
{"id":28,"result":false,"error":null}

##
T 2025/11/14 10:46:31.277504 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #16
{"method":"ThresholdSv1.ProcessEvent","params":[{"Tenant":"cgrates.org","ID":"8a2446a7-073f-4beb-bfd0-f60014abbcd6","Time":"2025-11-14T10:46:31.277375663+08:00","Event":{"AllowNegative":false,"BalanceSummaries":[{"UUID":"ba5f8e02-613b-4394-bff0-abe8cecb2020","ID":"100_data_balance","Type":"*data","Initial":94022803,"Value":89364423,"Weight":35,"Disabled":false}],"Disabled":false,"ID":"testuser","Tenant":"cgrates.org"},"APIOpts":{"*eventType":"AccountUpdate"}}],"id":29}

#
T 2025/11/14 10:46:31.279215 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #17
{"id":29,"result":null,"error":"NOT_FOUND"}

##
T 2025/11/14 10:46:31.468747 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #19
{"method":"_goRPC_.Cancel","params":[{"Seq":26}],"id":30}

#
T 2025/11/14 10:46:31.468826 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #20
{"id":22,"result":null,"error":"RALS_ERROR:context deadline exceeded"}

##
T 2025/11/14 10:46:31.468885 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #22
{"id":30,"result":false,"error":null}

##
T 2025/11/14 10:46:31.468915 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #24
{"method":"Responder.MaxDebit","params":[{"Category":"data","Tenant":"cgrates.org","Subject":"testuser","Account":"testuser","Destination":"server1","TimeStart":"0001-01-01T00:00:00Z","TimeEnd":"0001-01-01T00:00:00.00465838Z","LoopIndex":0,"DurationIndex":13975140,"FallbackSubject":"","RatingInfos":null,"Increments":null,"ToR":"*data","ExtraFields":{"RemoteAddr":"136.158.122.86"},"MaxRate":0,"MaxRateUnit":0,"MaxCostSoFar":0,"CgrID":"e50b6b7afd71c7e3acce55104e2610ef6f71114b","RunID":"*default","ForceDuration":false,"PerformRounding":false,"DenyNegativeAccount":false,"DryRun":false,"APIOpts":{"*attrProfileIDs":null,"*context":"*sessions","*subsys":"*sessions"}}],"id":31}

##
T 2025/11/14 10:46:31.583028 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #26
{"id":21,"result":{"Category":"data","Tenant":"cgrates.org","Subject":"testuser","Account":"testuser","Destination":"server1","ToR":"*data","Cost":0,"Timespans":[{"TimeStart":"0001-01-01T00:00:00Z","TimeEnd":"0001-01-01T00:00:00.00465838Z","Cost":0,"RateInterval":{"Timing":null,"Rating":{"ConnectFee":0,"RoundingMethod":"","RoundingDecimals":0,"MaxCost":0,"MaxCostStrategy":"","Rates":[{"GroupIntervalStart":0,"Value":0,"RateIncrement":1,"RateUnit":1}]},"Weight":0},"DurationIndex":0,"Increments":[{"Duration":1,"Cost":0,"BalanceInfo":{"Unit":{"UUID":"ba5f8e02-613b-4394-bff0-abe8cecb2020","ID":"100_data_balance","Value":89364423,"DestinationID":"server1","Consumed":1,"Factor":1,"Category":"data","ToR":"*data","RateInterval":null},"Monetary":null,"AccountID":"cgrates.org:testuser"},"CompressFactor":4658380}],"RoundIncrement":null,"MatchedSubject":"ba5f8e02-613b-4394-bff0-abe8cecb2020","MatchedPrefix":"server1","MatchedDestId":"*any","RatingPlanId":"*none","CompressFactor":1}],"RatedUsage":4658380,"AccountSummary":{"Tenant":"cgrates.org","ID":"testuser","BalanceSummaries":[{"UUID":"ba5f8e02-613b-4394-bff0-abe8cecb2020","ID":"100_data_balance","Type":"*data","Initial":94022803,"Value":89364423,"Weight":35,"Disabled":false}],"AllowNegative":false,"Disabled":false}},"error":null}

##
T 2025/11/14 10:46:33.470609 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #28
{"method":"_goRPC_.Cancel","params":[{"Seq":31}],"id":32}

##
T 2025/11/14 10:46:33.470710 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #30
{"id":23,"result":null,"error":"RALS_ERROR:context deadline exceeded"}

##
T 2025/11/14 10:46:33.470840 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #32
{"id":32,"result":false,"error":null}

##
T 2025/11/14 10:46:35.021026 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #34
{"method":"ThresholdSv1.ProcessEvent","params":[{"Tenant":"cgrates.org","ID":"d22ecf55-88cb-43fc-805b-7c8073b33a67","Time":"2025-11-14T10:46:35.020941522+08:00","Event":{"AllowNegative":false,"BalanceSummaries":[{"UUID":"ba5f8e02-613b-4394-bff0-abe8cecb2020","ID":"100_data_balance","Type":"*data","Initial":89364423,"Value":84706043,"Weight":35,"Disabled":false}],"Disabled":false,"ID":"testuser","Tenant":"cgrates.org"},"APIOpts":{"*eventType":"AccountUpdate"}}],"id":33}

#
T 2025/11/14 10:46:35.021206 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #35
{"id":33,"result":null,"error":"NOT_FOUND"}

##
T 2025/11/14 10:46:35.324089 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #37
{"id":26,"result":{"Category":"data","Tenant":"cgrates.org","Subject":"testuser","Account":"testuser","Destination":"server1","ToR":"*data","Cost":0,"Timespans":[{"TimeStart":"0001-01-01T00:00:00Z","TimeEnd":"0001-01-01T00:00:00.00465838Z","Cost":0,"RateInterval":{"Timing":null,"Rating":{"ConnectFee":0,"RoundingMethod":"","RoundingDecimals":0,"MaxCost":0,"MaxCostStrategy":"","Rates":[{"GroupIntervalStart":0,"Value":0,"RateIncrement":1,"RateUnit":1}]},"Weight":0},"DurationIndex":0,"Increments":[{"Duration":1,"Cost":0,"BalanceInfo":{"Unit":{"UUID":"ba5f8e02-613b-4394-bff0-abe8cecb2020","ID":"100_data_balance","Value":84706043,"DestinationID":"server1","Consumed":1,"Factor":1,"Category":"data","ToR":"*data","RateInterval":null},"Monetary":null,"AccountID":"cgrates.org:testuser"},"CompressFactor":4658380}],"RoundIncrement":null,"MatchedSubject":"ba5f8e02-613b-4394-bff0-abe8cecb2020","MatchedPrefix":"server1","MatchedDestId":"*any","RatingPlanId":"*none","CompressFactor":1}],"RatedUsage":4658380,"AccountSummary":{"Tenant":"cgrates.org","ID":"testuser","BalanceSummaries":[{"UUID":"ba5f8e02-613b-4394-bff0-abe8cecb2020","ID":"100_data_balance","Type":"*data","Initial":89364423,"Value":84706043,"Weight":35,"Disabled":false}],"AllowNegative":false,"Disabled":false}},"error":null}

##
T 2025/11/14 10:46:38.621368 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #39
{"method":"ThresholdSv1.ProcessEvent","params":[{"Tenant":"cgrates.org","ID":"a046a813-62f1-4bba-8847-2dd3776782ad","Time":"2025-11-14T10:46:38.621269048+08:00","Event":{"AllowNegative":false,"BalanceSummaries":[{"UUID":"ba5f8e02-613b-4394-bff0-abe8cecb2020","ID":"100_data_balance","Type":"*data","Initial":84706043,"Value":80047663,"Weight":35,"Disabled":false}],"Disabled":false,"ID":"testuser","Tenant":"cgrates.org"},"APIOpts":{"*eventType":"AccountUpdate"}}],"id":34}

#
T 2025/11/14 10:46:38.621522 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #40
{"id":34,"result":null,"error":"NOT_FOUND"}

##
T 2025/11/14 10:46:38.926858 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #42
{"id":31,"result":{"Category":"data","Tenant":"cgrates.org","Subject":"testuser","Account":"testuser","Destination":"server1","ToR":"*data","Cost":0,"Timespans":[{"TimeStart":"0001-01-01T00:00:00Z","TimeEnd":"0001-01-01T00:00:00.00465838Z","Cost":0,"RateInterval":{"Timing":null,"Rating":{"ConnectFee":0,"RoundingMethod":"","RoundingDecimals":0,"MaxCost":0,"MaxCostStrategy":"","Rates":[{"GroupIntervalStart":0,"Value":0,"RateIncrement":1,"RateUnit":1}]},"Weight":0},"DurationIndex":0,"Increments":[{"Duration":1,"Cost":0,"BalanceInfo":{"Unit":{"UUID":"ba5f8e02-613b-4394-bff0-abe8cecb2020","ID":"100_data_balance","Value":80047663,"DestinationID":"server1","Consumed":1,"Factor":1,"Category":"data","ToR":"*data","RateInterval":null},"Monetary":null,"AccountID":"cgrates.org:testuser"},"CompressFactor":4658380}],"RoundIncrement":null,"MatchedSubject":"ba5f8e02-613b-4394-bff0-abe8cecb2020","MatchedPrefix":"server1","MatchedDestId":"*any","RatingPlanId":"*none","CompressFactor":1}],"RatedUsage":4658380,"AccountSummary":{"Tenant":"cgrates.org","ID":"testuser","BalanceSummaries":[{"UUID":"ba5f8e02-613b-4394-bff0-abe8cecb2020","ID":"100_data_balance","Type":"*data","Initial":84706043,"Value":80047663,"Weight":35,"Disabled":false}],"AllowNegative":false,"Disabled":false}},"error":null}

######
T 2025/11/14 10:46:57.885567 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #48
{"method":"SessionSv1.UpdateSession","params":[{"GetAttributes":false,"UpdateSession":true,"ForceDuration":false,"ProcessThresholds":false,"ProcessStats":false,"AttributeIDs":null,"ThresholdIDs":null,"StatIDs":null,"Tenant":"cgrates.org","ID":"54d73a3","Time":"2025-11-14T10:46:57.885433486+08:00","Event":{"Account":"testuser","AnswerTime":"1763088417*now","Category":"data","Destination":"server1","OriginHost":"192.168.0.113","OriginID":"80a0000c-modified","RemoteAddr":"136.158.122.86","RequestType":"*prepaid","SetupTime":"1763088417*now","Subject":"testuser","ToR":"*data","Usage":14232760},"APIOpts":{}}],"id":35}

#
T 2025/11/14 10:46:57.885885 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #49
{"method":"Responder.MaxDebit","params":[{"Category":"data","Tenant":"cgrates.org","Subject":"testuser","Account":"testuser","Destination":"server1","TimeStart":"0001-01-01T00:00:00Z","TimeEnd":"0001-01-01T00:00:00.01423276Z","LoopIndex":0,"DurationIndex":28207900,"FallbackSubject":"","RatingInfos":null,"Increments":null,"ToR":"*data","ExtraFields":{"RemoteAddr":"136.158.122.86"},"MaxRate":0,"MaxRateUnit":0,"MaxCostSoFar":0,"CgrID":"e50b6b7afd71c7e3acce55104e2610ef6f71114b","RunID":"*default","ForceDuration":false,"PerformRounding":false,"DenyNegativeAccount":false,"DryRun":false,"APIOpts":{"*attrProfileIDs":null,"*context":"*sessions","*subsys":"*sessions"}}],"id":36}

##
T 2025/11/14 10:46:58.184715 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #51
{"method":"SessionSv1.UpdateSession","params":[{"GetAttributes":false,"UpdateSession":true,"ForceDuration":false,"ProcessThresholds":false,"ProcessStats":false,"AttributeIDs":null,"ThresholdIDs":null,"StatIDs":null,"Tenant":"cgrates.org","ID":"801ee00","Time":"2025-11-14T10:46:58.184592812+08:00","Event":{"Account":"testuser","AnswerTime":"1763088417*now","Category":"data","Destination":"server1","OriginHost":"192.168.0.113","OriginID":"80a0000c-modified","RemoteAddr":"136.158.122.86","RequestType":"*prepaid","SetupTime":"1763088417*now","Subject":"testuser","ToR":"*data","Usage":14232760},"APIOpts":{}}],"id":37}

##
T 2025/11/14 10:46:58.486634 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #53
{"method":"SessionSv1.UpdateSession","params":[{"GetAttributes":false,"UpdateSession":true,"ForceDuration":false,"ProcessThresholds":false,"ProcessStats":false,"AttributeIDs":null,"ThresholdIDs":null,"StatIDs":null,"Tenant":"cgrates.org","ID":"dad4555","Time":"2025-11-14T10:46:58.4865107+08:00","Event":{"Account":"testuser","AnswerTime":"1763088417*now","Category":"data","Destination":"server1","OriginHost":"192.168.0.113","OriginID":"80a0000c-modified","RemoteAddr":"136.158.122.86","RequestType":"*prepaid","SetupTime":"1763088417*now","Subject":"testuser","ToR":"*data","Usage":14232760},"APIOpts":{}}],"id":38}

##
T 2025/11/14 10:46:59.886327 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #55
{"method":"_goRPC_.Cancel","params":[{"Seq":36}],"id":39}

##
T 2025/11/14 10:46:59.886384 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #57
{"method":"_goRPC_.Cancel","params":[{"Seq":35}],"id":40}

##
T 2025/11/14 10:46:59.886403 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #59
{"id":35,"result":null,"error":"RALS_ERROR:context deadline exceeded"}

##
T 2025/11/14 10:46:59.886515 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #61
{"method":"Responder.MaxDebit","params":[{"Category":"data","Tenant":"cgrates.org","Subject":"testuser","Account":"testuser","Destination":"server1","TimeStart":"0001-01-01T00:00:00Z","TimeEnd":"0001-01-01T00:00:00.01423276Z","LoopIndex":0,"DurationIndex":42440660,"FallbackSubject":"","RatingInfos":null,"Increments":null,"ToR":"*data","ExtraFields":{"RemoteAddr":"136.158.122.86"},"MaxRate":0,"MaxRateUnit":0,"MaxCostSoFar":0,"CgrID":"e50b6b7afd71c7e3acce55104e2610ef6f71114b","RunID":"*default","ForceDuration":false,"PerformRounding":false,"DenyNegativeAccount":false,"DryRun":false,"APIOpts":{"*attrProfileIDs":null,"*context":"*sessions","*subsys":"*sessions"}}],"id":41}

#
T 2025/11/14 10:46:59.886545 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #62
{"id":40,"result":false,"error":null}

#
T 2025/11/14 10:46:59.886565 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #63
{"id":39,"result":false,"error":null}

##
T 2025/11/14 10:47:00.186363 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #65
{"method":"_goRPC_.Cancel","params":[{"Seq":37}],"id":42}

#
T 2025/11/14 10:47:00.186538 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #66
{"id":42,"result":false,"error":null}

##
T 2025/11/14 10:47:00.501468 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #68
{"method":"_goRPC_.Cancel","params":[{"Seq":38}],"id":43}

#
T 2025/11/14 10:47:00.501669 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #69
{"id":43,"result":false,"error":null}

##
T 2025/11/14 10:47:01.894287 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #71
{"method":"_goRPC_.Cancel","params":[{"Seq":41}],"id":44}

#
T 2025/11/14 10:47:01.894357 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #72
{"id":37,"result":null,"error":"RALS_ERROR:context deadline exceeded"}

##
T 2025/11/14 10:47:01.894534 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #74
{"method":"Responder.MaxDebit","params":[{"Category":"data","Tenant":"cgrates.org","Subject":"testuser","Account":"testuser","Destination":"server1","TimeStart":"0001-01-01T00:00:00Z","TimeEnd":"0001-01-01T00:00:00.01423276Z","LoopIndex":0,"DurationIndex":56673420,"FallbackSubject":"","RatingInfos":null,"Increments":null,"ToR":"*data","ExtraFields":{"RemoteAddr":"136.158.122.86"},"MaxRate":0,"MaxRateUnit":0,"MaxCostSoFar":0,"CgrID":"e50b6b7afd71c7e3acce55104e2610ef6f71114b","RunID":"*default","ForceDuration":false,"PerformRounding":false,"DenyNegativeAccount":false,"DryRun":false,"APIOpts":{"*attrProfileIDs":null,"*context":"*sessions","*subsys":"*sessions"}}],"id":45}

#
T 2025/11/14 10:47:01.894673 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #75
{"id":44,"result":false,"error":null}

##
T 2025/11/14 10:47:03.898562 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #77
{"method":"_goRPC_.Cancel","params":[{"Seq":45}],"id":46}

#
T 2025/11/14 10:47:03.899103 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #78
{"id":38,"result":null,"error":"RALS_ERROR:context deadline exceeded"}

##
T 2025/11/14 10:47:03.899844 127.0.0.1:2012 -> 127.0.0.1:50436 [AP] #80
{"id":46,"result":false,"error":null}

######
T 2025/11/14 10:47:27.994209 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #86
{"method":"SessionSv1.UpdateSession","params":[{"GetAttributes":false,"UpdateSession":true,"ForceDuration":false,"ProcessThresholds":false,"ProcessStats":false,"AttributeIDs":null,"ThresholdIDs":null,"StatIDs":null,"Tenant":"cgrates.org","ID":"834ecb0","Time":"2025-11-14T10:47:27.979422948+08:00","Event":{"Account":"testuser","AnswerTime":"1763088447*now","Category":"data","Destination":"server1","OriginHost":"192.168.0.113","OriginID":"80a0000c-modified","RemoteAddr":"136.158.122.86","RequestType":"*prepaid","SetupTime":"1763088447*now","Subject":"testuser","ToR":"*data","Usage":66801790},"APIOpts":{}}],"id":47}

#
T 2025/11/14 10:47:28.007838 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #87
{"method":"Responder.MaxDebit","params":[{"Category":"data","Tenant":"cgrates.org","Subject":"testuser","Account":"testuser","Destination":"server1","TimeStart":"0001-01-01T00:00:00Z","TimeEnd":"0001-01-01T00:00:00.06680179Z","LoopIndex":0,"DurationIndex":123475210,"FallbackSubject":"","RatingInfos":null,"Increments":null,"ToR":"*data","ExtraFields":{"RemoteAddr":"136.158.122.86"},"MaxRate":0,"MaxRateUnit":0,"MaxCostSoFar":0,"CgrID":"e50b6b7afd71c7e3acce55104e2610ef6f71114b","RunID":"*default","ForceDuration":false,"PerformRounding":false,"DenyNegativeAccount":false,"DryRun":false,"APIOpts":{"*attrProfileIDs":null,"*context":"*sessions","*subsys":"*sessions"}}],"id":48}

##
T 2025/11/14 10:47:28.234715 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #89
{"method":"SessionSv1.UpdateSession","params":[{"GetAttributes":false,"UpdateSession":true,"ForceDuration":false,"ProcessThresholds":false,"ProcessStats":false,"AttributeIDs":null,"ThresholdIDs":null,"StatIDs":null,"Tenant":"cgrates.org","ID":"725a180","Time":"2025-11-14T10:47:28.234195619+08:00","Event":{"Account":"testuser","AnswerTime":"1763088447*now","Category":"data","Destination":"server1","OriginHost":"192.168.0.113","OriginID":"80a0000c-modified","RemoteAddr":"136.158.122.86","RequestType":"*prepaid","SetupTime":"1763088447*now","Subject":"testuser","ToR":"*data","Usage":66801790},"APIOpts":{}}],"id":49}

##
T 2025/11/14 10:47:28.545780 127.0.0.1:50436 -> 127.0.0.1:2012 [AP] #91
{"method":"SessionSv1.UpdateSession","params":[{"GetAttributes":false,"UpdateSession":true,"ForceDuration":false,"ProcessThresholds":false,"ProcessStats":false,"AttributeIDs":null,"ThresholdIDs":null,"StatIDs":null,"Tenant":"cgrates.org","ID":"75f4ae0","Time":"2025-11-14T10:47:28.541328985+08:00","Event":{"Account":"testuser","AnswerTime":"1763088447*now","Category":"data","Destination":"server1","OriginHost":"192.168.0.113","OriginID":"80a0000c-modified","RemoteAddr":"136.158.122.86","RequestType":"*prepaid","SetupTime":"1763088447*now","Subject":"testuser","ToR":"*data","Usage":66801790},"APIOpts":{}}],"id":50}


Regards,
Justin

Armir Veliaj

unread,
Nov 14, 2025, 10:56:26 AMNov 14
to CGRateS
Hi Justin,

The issue is caused by the way you defined the Rates, with both RateUnit and RateIncrement set to 1.
This makes the system calculate charges per each single byte. Given the large volume of data in bytes, this creates huge resource consumption. In most cases, you wouldn’t want to charge per byte.
The usual approach is to charge per KB or MB. You can adjust this by changing RateUnit and RateIncrement to 1024 for KB or 1048576 for MB.

Thanks,
Armir

Justin Mark Repollo

unread,
Nov 18, 2025, 5:14:44 AMNov 18
to cgr...@googlegroups.com
Hi Armir,

I tried setting the RateUnit and RateIncrement to 1024 (KB) and 1048576 (MB), which reduced how often the process gets killed. I’ll continue adjusting the rate settings.

For a time-based use case, what is the correct category to use? Should it still be under data or should a different category be defined?

Regards,
Justin


Justin Mark Repollo

unread,
Nov 18, 2025, 5:14:51 AMNov 18
to cgr...@googlegroups.com
Hi Armir,

Additional inquiry regarding session disconnection when user balances reach the threshold, I believe this can be achieved using actions.

I tried to configure an action using the following command:



{
  "jsonrpc": "2.0",
  "id": 1,

  "method": "ApierV1.SetActions",
  "params": [
    {
      "ActionsId": "Action_Disconnect_testuser",
      "Actions": [
        {
          "Identifier": "*force_disconnect_sessions",
          "ExtraParameters": "tenant=cgrates.org&filters=*string:~*req.Account:testuser&limit=10&APIOpts=&Event=",
          "Weight": 10
        }
      ]
    }
  ]
}

However, when I tried to execute the action on the account, it failed with the following error:  
[ERROR] Error executing action *force_disconnect_sessions: invalid number of parameters <1> expected 5!

Regards,
Justin

Armir Veliaj

unread,
Nov 18, 2025, 11:41:27 AMNov 18
to CGRateS
 Hi Justin,
 
Regarding your first inquiry, the category depends  as it needs to match the rating profiles with the events that you are receiving.
Using ngrep can help you visualize the events.

And for your second inquiry the error is showing due to the format you have used in ExtraParemetrs.The fields should be separated with ';' instead of "&" symbol.
However if you have a bi-directional connection, the session should end as the balance is all consumed by itself,without using any actions.
If you have any other scenarios e.g: to monitor the balance and react on specific events, you need to use ActionTriggers and Thresholds not just  Actions.
The docs here may help too :  https://cgrates.readthedocs.io/en/latest/rals.html#actiontrigger
 
 Thanks,
 Armir

Justin Mark Repollo

unread,
Nov 19, 2025, 11:34:47 AM (13 days ago) Nov 19
to cgr...@googlegroups.com

Hi Armir,

Regarding the bidirectional setup, I’ve already configured:

 "sessions_conns": ["*bijson_localhost"]

under the RADIUS agent.

I also added the balance using:  
curl -X POST http://192.168.1.132:2080/jsonrpc      -H "Content-Type: application/json"      -d '{


           "jsonrpc": "2.0",
           "id": 1,

           "method": "ApierV1.SetBalance",
           "params": [
             {
               "Tenant": "cgrates.org",
               "Account": "testuser",
               "BalanceType": "*data",
               "Categories": "*any",
               "Balance": {
                 "ID": "30MB_data_balance",
                 "Value": "31457280",
                 "ExpiryTime": "*daily",
                 "Weight": 35,
                 "DestinationIDs": "Dest_DATA"
               }
             }
           ]
         }'

Verified balance have reaches 0 using:  
curl -X POST http://192.168.1.132:2080/jsonrpc      -H "Content-Type: application/json"      -d '{


           "jsonrpc": "2.0",
           "id": 1,

           "method": "ApierV2.GetAccount",
           "params": [
             {
               "Tenant": "cgrates.org",
               "Account": "testuser"
             }
           ]
         }'
{"id":1,"result":{"ID":"cgrates.org:testuser","BalanceMap":{"*data":[{"Uuid":"f1aa3b25-1506-42df-ac9c-8aefaef872d0","ID":"30MB_data_balance","Value":0,"ExpirationDate":"2025-11-20T15:00:41.554594392+08:00","Weight":35,"DestinationIDs":{"Dest_DATA":true},"RatingSubject":"","Categories":null,"SharedGroups":null,"Timings":null,"TimingIDs":null,"Disabled":false,"Factors":null,"Blocker":false}],"*monetary":[]},"UnitCounters":null,"ActionTriggers":null,"AllowNegative":false,"Disabled":false,"UpdateTime":"2025-11-19T15:08:30.414177991+08:00"},"error":null}

active_sessions return
  [
 {
  "Account": "testuser",
  "AnswerTime": "2025-11-19T15:11:37.657401258+08:00",
  "CGRID": "c4c267f67576b7a281e40c584ae8d7bc5c822de3",
  "Category": "data",
  "DebitInterval": "0s",
  "Destination": "server1",
  "DurationIndex": "105.074626ms",
  "ExtraFields": {
   "RemoteAddr": "192.168.1.11"
  },
  "LoopIndex": 28,
  "MaxCostSoFar": 0,
  "MaxRate": 0,
  "MaxRateUnit": "0s",
  "NextAutoDebit": "0001-01-01T00:00:00Z",
  "NodeID": "node1",
  "OriginHost": "192.168.1.11",
  "OriginID": "80900011-modified",
  "RequestType": "*prepaid",
  "RunID": "*default",
  "SetupTime": "2025-11-19T15:11:37.657400888+08:00",
  "Source": "SessionS_",
  "Subject": "testuser",
  "Tenant": "cgrates.org",
  "ToR": "*data",
  "Usage": "91.668553ms"
 }
]

Balance deduction works as expected, however when the balance reaches 0, no session disconnection is triggered.  

My current session config includes:
"debit_interval": "0",
"channel_sync_interval": "0"

Additional Observations
When using "debit_interval": "10s". I experience   <MAX_INCREMENTS_EXCEEDED with 10000000000> error

I've attached:
cgrates.json
cgrates_logs - ngrep logs for no disconnection using debit_interval=0
cg-engine_logs - engine logs when using debit_interval=10s
ngrep capture for debit_interval=10s


Regards,
Justin 
cg-engine_logs.txt
cgrates-radius1.json
cgrates_logs
debit_interval_10s

Armir Veliaj

unread,
Nov 20, 2025, 11:21:13 AM (12 days ago) Nov 20
to CGRateS
Hi Justin,


The Radius protocol doesnt't allow to disconnect directly from CGRateS, so it needs to checks often the max time available to disconnect. To make that disconnection more closer the time between queries, should be as lower as possible and the disconnection will be faster.
For the error you are having, based on the logs on the files that you got, the MAX_INCREMENTS_EXCEEDED  error, it shows that the rating is done still with increment  with value 1. Am not sure if you have updated your tariffplans with the new configuration for rating data. If not please do and sent us all your updated configs for all your tariffplans (Rates, DestinationRates, RatingProfiles, RatingPlans,etc..) together with ngrep logs and json config of CGRateS for any further checking.


Thanks,
Armir

Justin Mark Repollo

unread,
Nov 25, 2025, 5:53:33 AM (8 days ago) Nov 25
to cgr...@googlegroups.com

Hi Armir,

Here’s my current tariffplans response using the API commands:

=== GetTPDestinationIDs ===
{"id":1,"result":["Dest_DATA","Dest_TIME"],"error":null}

=== GetTPDestination (Dest_DATA) ===
{"id":1,"result":{"TPid":"cgrates.org","ID":"Dest_DATA","Prefixes":["server1","server2"]},"error":null}

=== GetTPRateIds ===
{"id":1,"result":["Rate_DATA","Rate_TIME"],"error":null}

=== GetTPRate (Rate_DATA) ===
{"id":1,"result":{"TPid":"cgrates.org","ID":"Rate_DATA","RateSlots":[{"ConnectFee":0,"Rate":0,"RateUnit":"10485760","RateIncrement":"10485760","GroupIntervalStart":"0"}]},"error":null}

=== GetTPDestinationRateIds ===
{"id":1,"result":["DestRate_DATA","DestRate_TIME"],"error":null}

=== GetTPDestinationRate (DestRate_DATA) ===
{"id":1,"result":{"TPid":"cgrates.org","ID":"DestRate_DATA","DestinationRates":[{"DestinationId":"Dest_DATA","RateId":"Rate_DATA","Rate":null,"RoundingMethod":"*up","RoundingDecimals":4,"MaxCost":0,"MaxCostStrategy":"*disconnect"}]},"error":null}

=== GetTPRatingPlanIds ===
{"id":1,"result":["RatingPlan_DATA","RatingPlan_TIME"],"error":null}

=== GetTPRatingPlan (RatingPlan_DATA) ===
{"id":1,"result":{"TPid":"cgrates.org","ID":"RatingPlan_DATA","RatingPlanBindings":[{"DestinationRatesId":"DestRate_DATA","TimingId":"*any","Weight":10}]},"error":null}

=== GetRatingProfileIDs ===
{"id":1,"result":["data:testuser"],"error":null}

=== GetRatingProfile (Tenant + Category + Subject) ===
{"id":1,"result":{"Id":"*out:cgrates.org:data:testuser","RatingPlanActivations":[{"ActivationTime":"2025-11-20T11:15:15.152131086+08:00","RatingPlanId":"RatingPlan_DATA","FallbackKeys":null}]},"error":null}

Regards,
Justin

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

Armir Veliaj

unread,
Nov 26, 2025, 10:30:52 AM (6 days ago) Nov 26
to CGRateS
Hi Justin,

Since you’re using Radius, "debit_interval": "10s" in the session config doesn’t apply, so it should be removed.
About the Rates config you sent: RateUnit and RateIncrement look fine (updated per 10MB instead of for 1 byte increment), but your Rate is 0, while before it had a different value. Was this intentional and is there a scenario you want to achieve?

I also suggest opening a new thread for each specific issue you may have in the future with updated configs and logs. This makes it also easier to track questions and can help community if they face the same issues.

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