cost simulation from cgr-console works but api call to authorize return maxusage 0

345 views
Skip to first unread message

ache...@gmail.com

unread,
Dec 1, 2020, 9:31:06 PM12/1/20
to CGRateS
Hi all,

I have a *voice balance attached to an account. Cost simulation via cgr-console shows appropriate usage and related. However SessionSv1.AuthorizeEventWithDigest does not authorize the call and returns MaxUsage 0. Please see captures below for more detail. 

Balance Map

[
 {
  "ActionTriggers": null,
  "AllowNegative": false,
  "BalanceMap": {
   "*voice": [
    {
     "Blocker": false,
     "Categories": {
      "call": true
     },
     "DestinationIDs": {
      "DR_BR": true
     },
     "Disabled": false,
     "ExpirationDate": "2021-12-02T01:28:42Z",
     "Factor": null,
     "ID": "PKG-RP_SINATOUT_3000_bo1qv07budgt6chb900g",
     "RatingSubject": "173fe19d-f449-49fd-a81f-a36c67eb63a6",
     "SharedGroups": {},
     "TimingIDs": {
      "*asap": true
     },
     "Timings": null,
     "Uuid": "f262a12a-4b54-46ee-a983-02decc740704",
     "Value": 3000,
     "Weight": 20
    }
   ]
  },
  "Disabled": false,
  "ID": "sinatzt:173fe19d-f449-49fd-a81f-a36c67eb63a6",
  "UnitCounters": null,
  "UpdateTime": "2020-12-02T01:28:42.202376438Z"
 }
]

----------------------------------------------------------------------------------------------------------------------------------------------
Ngrep from Opensips to Cgrates

  { "method": "SessionSv1.AuthorizeEventWithDigest", "id": 1764523918, "params": [ { "Category": "call", "Tenant": "sinatzt", "ProcessStatQueues": true, "ProcessThresholds": true, "ReleaseResources": false
  , "AllocateResources": false, "AuthorizeResources": false, "GetMaxUsage": true, "Event": { "Source": "edge-proxy-1", "OriginHost": "10.20.100.2", "RequestType": "*prepaid", "OriginID": "71f09ec9-aee5-123
  9-29ad-42010a146403", "Account": "173fe19d-f449-49fd-a81f-a36c67eb63a6", "SetupTime": "1606874623", "Destination": "55xxxxxxxxxx" } } ] }

  {"id":1764523918,"result":{"AttributesDigest":null,"ResourceAllocation":null,"MaxUsage":0,"SuppliersDigest":null,"Thresholds":"","StatQueues":null},"error":null}.

----------------------------------------------------------------------------------------------------------------------------------------------
Cost simulation

cgr> cost Tenant="sinatzt" Category="call" Subject="173fe19d-f449-49fd-a81f-a36c67eb63a6" AnswerTime="2020-12-02T02:30:54" Destination="55xxxxxxxxx" Usage="5m"
{
 "AccountSummary": null,
 "Accounting": {},
 "CGRID": "",
 "Charges": [
  {
   "CompressFactor": 1,
   "Increments": [
    {
     "AccountingID": "",
     "CompressFactor": 1,
     "Cost": 3,
     "Usage": "0s"
    },
    {
     "AccountingID": "",
     "CompressFactor": 300,
     "Cost": 0.00333,
     "Usage": "1s"
    }
   ],
   "RatingID": "e526a6c"
  }
 ],
 "Cost": 3.999,
 "Rates": {
  "3f86bdd": [
   {
    "GroupIntervalStart": "0s",
    "RateIncrement": "1s",
    "RateUnit": "1m0s",
    "Value": 0.2
   }
  ]
 },
 "Rating": {
  "e526a6c": {
   "ConnectFee": 3,
   "MaxCost": 0,
   "MaxCostStrategy": "",
   "RatesID": "3f86bdd",
   "RatingFiltersID": "4992bee",
   "RoundingDecimals": 4,
   "RoundingMethod": "*up",
   "TimingID": "d212645"
  }
 },
 "RatingFilters": {
  "4992bee": {
   "DestinationID": "BR_55212",
   "DestinationPrefix": "55212",
   "RatingPlanID": "RP_SINAT_FLEX_TNYX",
   "Subject": "*out:sinatzt:call:173fe19d-f449-49fd-a81f-a36c67eb63a6"
  }
 },
 "RunID": "",
 "StartTime": "2020-12-02T02:30:54Z",
 "Timings": {
  "d212645": {
   "MonthDays": [],
   "Months": [],
   "StartTime": "00:00:00",
   "WeekDays": [],
   "Years": []
  }
 },
 "Usage": "5m0s"
}

Any input will be greatly appreciated. 

Thanks.
acheraime

Teofil Voivozeanu

unread,
Dec 3, 2020, 9:00:39 AM12/3/20
to CGRateS
Hi Acheraime,

Can you please post the version of CGRateS and the config?
Also please check the syslog for additional information and post the ngrep between SessionS and RALs for the request from opensips vs the one from the console.

Thanks,
TeoV

ache...@gmail.com

unread,
Dec 3, 2020, 4:18:46 PM12/3/20
to CGRateS
Hi Teofil,

Thank you for your answer. I'm running CGRate v0.10.1 the log file is empty. Ngrep capture from Opensips to Cgrates is above but I'm adding one more time below
 
Ngrep from Opensips to Cgrates

  { "method": "SessionSv1.AuthorizeEventWithDigest", "id": 1764523918, "params": [ { "Category": "call", "Tenant": "sinatzt", "ProcessStatQueues": true, "ProcessThresholds": true, "ReleaseResources": false
  , "AllocateResources": false, "AuthorizeResources": false, "GetMaxUsage": true, "Event": { "Source": "edge-proxy-1", "OriginHost": "10.20.100.2", "RequestType": "*prepaid", "OriginID": "71f09ec9-aee5-123
  9-29ad-42010a146403", "Account": "173fe19d-f449-49fd-a81f-a36c67eb63a6", "SetupTime": "1606874623", "Destination": "55xxxxxxxxxx" } } ] }

  {"id":1764523918,"result":{"AttributesDigest":null,"ResourceAllocation":null,"MaxUsage":0,"SuppliersDigest":null,"Thresholds":"","StatQueues":null},"error":null}.


Best,

Acheraime

Teofil Voivozeanu

unread,
Dec 4, 2020, 2:07:22 AM12/4/20
to CGRateS
Hi Acheraime,

I already saw the capture from the first post but we cannot obtain much information from it, that's why I wanted the request from SessionS subsystem to RALs subsystem ( e.g. put the connection from "sessions" to "rals" to *localhost https://github.com/cgrates/cgrates/blob/master/config/config_defaults.go#L429 and capture the traffic ).
Also, I said that we need to see the config that you are using and capture the traffic in both cases ( one case captures the traffic and pastes it here when you send the request from opensips and the second case is to capture the traffic when you send the command from console).

Thanks,
TeoV

ache...@gmail.com

unread,
Dec 7, 2020, 9:46:03 PM12/7/20
to CGRateS
Hi Teofil,

Sorry for my delayed reply. I had a very busy weekend. Please see below the requested information. For the call from Opensips to Cgrates nothing is captured
on localhost:2012


==================================== RALS  cgr-console =========================================
  {"method":"APIerSv1.GetCost","params":[{"Tenant":"sinatzt","Category":"call","Subject":"173fe19d-f449-49fd-a81f-a36c67eb63a6","AnswerTime":"2020-12-02T02:03:43","Destination":"552122401058","Usage":"5m",
  "APIKey":null,"RouteID":null}],"id":0}.

  {"id":0,"result":{"CGRID":"","RunID":"","StartTime":"2020-12-02T02:03:43Z","Usage":300000000000,"Cost":3.999,"Charges":[{"RatingID":"96e43a7","Increments":[{"Usage":0,"Cost":3,"AccountingID":"","Compress
  Factor":1},{"Usage":1000000000,"Cost":0.00333,"AccountingID":"","CompressFactor":300}],"CompressFactor":1}],"AccountSummary":null,"Rating":{"96e43a7":{"ConnectFee":3,"RoundingMethod":"*up","RoundingDecim
  als":4,"MaxCost":0,"MaxCostStrategy":"","TimingID":"82dfd87","RatesID":"40f1d7d","RatingFiltersID":"e53be7b"}},"Accounting":{},"RatingFilters":{"e53be7b":{"DestinationID":"BR_55212","DestinationPrefix":"
  55212","RatingPlanID":"RP_SINAT_FLEX_TNYX","Subject":"*out:sinatzt:call:173fe19d-f449-49fd-a81f-a36c67eb63a6"}},"Rates":{"40f1d7d":[{"GroupIntervalStart":0,"Value":0.2,"RateIncrement":1000000000,"RateUnit":60000000000}]},"Timings":{"82dfd87":{"Years":[],"Months":[],"MonthDays":[],"WeekDays":[],"StartTime":"00:00:00"}}},"error":null}.
=============================================================================================

================================= Opensips to RALS =============================================
Nothing is captured
=============================================================================================

================================== Opensips Config =============================================
"rpc_conns": {
        "*localhost": {
                "conns": [{"address": "127.0.0.1:2012", "transport":"*json"}],
        },
 },

"rals": {
        "enabled": true,                        // enable Rating/Accounting service: <true|false>
        "thresholds_conns": ["*internal"],      // connections to ThresholdS for account/balance updates, empty to disable thresholds functionality: <""|*internal|x.y.z.y:1234>
        "stats_conns": ["*internal"],           // connections to StatS for account/balance updates, empty to disable stats functionality: <""|*internal|x.y.z.y:1234>
        "caches_conns":["*internal"],           // connections to CacheS for account/balance updates
        "rp_subject_prefix_matching": false,    // enables prefix matching for the rating profile subject
        "remove_expired":true,                                  // enables automatic removal of expired balances
        "max_computed_usage": {                                 // do not compute usage higher than this, prevents memory overload
                "*any": "189h",
                "*voice": "72h",
                "*data": "107374182400",
                "*sms": "10000"
        },
        "max_increments": 1000000,
        "balance_rating_subject":{                              // default rating subject in case that balance rating subject is empty
                "*any": "*zero1ns",
                "*voice": "*zero1s",
                "*data": "*zero1ns",
                "*sms": "*zero1ns",
                "*monetary":"*zero1ns",
                "*generic":"*zero1ns",
        },
 },

 "sessions": {
        "enabled": true,                                                // starts the session service: <true|false>
        "listen_bijson": ":2014",               // address where to listen for bidirectional JSON-RPC requests
        "chargers_conns": ["*internal"],                                        // connections to ChargerS for session forking <*internal|x.y.z.y:1234>
        "rals_conns": ["*internal"],                                            // connections to RALs for rating/accounting <""|*internal|127.0.0.1:2013>
        "cdrs_conns": ["*internal"],                                            // connections to CDRs for CDR posting <*internal|x.y.z.y:1234>
        "resources_conns": ["*internal"],                                       // connections to ResourceS for resources monitoring <""|*internal|127.0.0.1:2013>
        "thresholds_conns": ["*internal"],                                      // connections to ThresholdS for reporting session events <""|*internal|127.0.0.1:2013>
        "stats_conns": ["*internal"],                                           // connections to StatS for reporting session events <""|*internal|127.0.0.1:2013>
        "suppliers_conns": ["*internal"],                                       // connections to SupplierS for querying suppliers for event <""|*internal|127.0.0.1:2013>
        "attributes_conns": ["*internal"],                                      // connections to AttributeS for altering event fields <""|*internal|127.0.0.1:2013>
        "replication_conns": [],                                // replicate sessions towards these session services
        "debit_interval": "0s",                                 // interval to perform debits on.
        "store_session_costs": true,                    // enable storing of the session costs within CDRs
        "min_call_duration": "0s",                              // only authorize calls with allowed duration higher than this
        "max_call_duration": "3h",                              // maximum call duration a prepaid call can last
        "session_ttl": "0s",                                    // time after a session with no updates is terminated, not defined by default
        //"session_ttl_max_delay": "",                  // activates session_ttl randomization and limits the maximum possible delay
        //"session_ttl_last_used": "",                  // tweak LastUsed for sessions timing-out, not defined by default
        //"session_ttl_usage": "",                              // tweak Usage for sessions timing-out, not defined by default
        "session_indexes": [],                                  // index sessions based on these fields for GetActiveSessions API
        "client_protocol": 1.0,                                 // version of protocol to use when acting as JSON-PRC client <"0","1.0">
        "channel_sync_interval": "0",                   // sync channels to detect stale sessions (0 to disable)
        "terminate_attempts": 5,                                // attempts to get the session before terminating it
        "alterable_fields": [],                                 // the session fields that can be updated
 },

Teofil Voivozeanu

unread,
Dec 9, 2020, 4:59:40 AM12/9/20
to CGRateS
Hi Acheraime,

Please review the message from above and post the missing information.

Thanks,
TeoV

ache...@gmail.com

unread,
Dec 9, 2020, 10:53:30 PM12/9/20
to CGRateS
Hi Teov,

Thank you for your patience. Please see the missing information below and the complete configuration file in attachment.


===================================== Opensips to cgrates  ==============================

  { "method": "SessionSv1.AuthorizeEventWithDigest", "id": 1106719771, "params": [ { "Category": "call", "Tenant": "sinatzt", "ProcessStatQueues": true, "ProcessThresholds": true, "ReleaseResources": false
  , "AllocateResources": false, "AuthorizeResources": false, "GetMaxUsage": true, "Event": { "Source": "edge-proxy-1", "OriginHost": "10.20.100.2", "RequestType": "*prepaid", "OriginID": "ea0a2144-b534-123
  9-29ad-42010a146403", "Account": "370df420-4e7d-4559-a390-b31ef26f4e10", "SetupTime": "1607568461", "Destination": "55xxxxxxxxxx" } } ] }

  {"id":1106719771,"result":{"AttributesDigest":null,"ResourceAllocation":null,"MaxUsage":0,"SuppliersDigest":null,"Thresholds":"","StatQueues":null},"error":null}.


============ localhost capture ==================
  {"method":"Responder.GetMaxSessionTime","params":[{"Category":"call","Tenant":"sinatzt","Subject":"370df420-4e7d-4559-a390-b31ef26f4e10","Account":"370df420-4e7d-4559-a390-b31ef26f4e10","Destination":"55xxxxxxxxxxxxxxxx","TimeStart":"2020-12-10T02:47:41Z","TimeEnd":"2020-12-10T05:47:41Z","LoopIndex":0,"DurationIndex":0,"FallbackSubject":"","RatingInfos":null,"Increments":null,"ToR":"","ExtraFields":{},"MaxRate":0,"MaxRateUnit":0,"MaxCostSoFar":0,"CgrID":"c520d9985f0c77092d818034f2466418a762d8cd","RunID":"*default","ForceDuration":false,"PerformRounding":false,"DryRun":false,"DenyNegativeAccount":false}],"id" :8}.

  {"id":8,"result":0,"error":null}.


================================= Cgr-console ==========================================

  {"method":"APIerSv1.GetCost","params":[{"Tenant":"sinatzt","Category":"call","Subject":"370df420-4e7d-4559-a390-b31ef26f4e10","AnswerTime":"2020-12-10T04:03:43","Destination":"55xxxxxxxxxxx","Usage":"5m",
  "APIKey":null,"RouteID":null}],"id":10}.

  {"id":10,"result":{"CGRID":"","RunID":"","StartTime":"2020-12-10T04:03:43Z","Usage":300000000000,"Cost":19.149,"Charges":[{"RatingID":"48700db","Increments":[{"Usage":0,"Cost":3,"AccountingID":"","Compre
  ssFactor":1},{"Usage":1000000000,"Cost":0.05383,"AccountingID":"","CompressFactor":300}],"CompressFactor":1}],"AccountSummary":null,"Rating":{"48700db":{"ConnectFee":3,"RoundingMethod":"*up","RoundingDec
  imals":4,"MaxCost":0,"MaxCostStrategy":"","TimingID":"35b7669","RatesID":"130243f","RatingFiltersID":"ed8b2c5"}},"Accounting":{},"RatingFilters":{"ed8b2c5":{"DestinationID":"BR_55112","DestinationPrefix"
  :"55112","RatingPlanID":"RP_SINAT_FLEX_TNYX","Subject":"*out:sinatzt:call:370df420-4e7d-4559-a390-b31ef26f4e10"}},"Rates":{"130243f":[{"GroupIntervalStart":0,"Value":3.23,"RateIncrement":1000000000,"Rate
  Unit":60000000000}]},"Timings":{"35b7669":{"Years":[],"Months":[],"MonthDays":[],"WeekDays":[],"StartTime":"00:00:00"}}},"error":null}.

=====================================================================================

Please note that this account has a *voice balance that should be used for this destination (see balance map below). If I add some *monetary 
balance to this account, the call will be successfully authorized.

[
 {
  "ActionTriggers": null,
  "AllowNegative": false,
  "BalanceMap": {
   "*voice": [
    {
     "Blocker": false,
     "Categories": {
      "call": true
     },
     "DestinationIDs": {
      "DR_BR": true
     },
     "Disabled": false,
     "ExpirationDate": "2021-01-10T02:43:11Z",
     "Factor": null,
     "ID": "PKG-RP_SINATOUT_3000_bo1qv07budgt6chb900g",
     "RatingSubject": "370df420-4e7d-4559-a390-b31ef26f4e10",
     "SharedGroups": {},
     "TimingIDs": {
      "*asap": true
     },
     "Timings": null,
     "Uuid": "6e6d7b4b-c2ed-47d2-bb3e-97e37b10fc6b",
     "Value": 3000,
     "Weight": 0
    }
   ]
  },
  "Disabled": false,
  "ID": "sinatzt:370df420-4e7d-4559-a390-b31ef26f4e10",
  "UnitCounters": null,
  "UpdateTime": "2020-12-10T02:43:11.133827902Z"
 }
]

===========================================================================

Cost simulation from cgr-console returns below information 

{
 "AccountSummary": null,
 "Accounting": {},
 "CGRID": "",
 "Charges": [
  {
   "CompressFactor": 1,
   "Increments": [
    {
     "AccountingID": "",
     "CompressFactor": 1,
     "Cost": 3,
     "Usage": "0s"
    },
    {
     "AccountingID": "",
     "CompressFactor": 300,
     "Cost": 0.05383,
     "Usage": "1s"
    }
   ],
   "RatingID": "cce8482"
  }
 ],
 "Cost": 19.149,
 "Rates": {
  "86e223d": [
   {
    "GroupIntervalStart": "0s",
    "RateIncrement": "1s",
    "RateUnit": "1m0s",
    "Value": 3.23
   }
  ]
 },
 "Rating": {
  "cce8482": {
   "ConnectFee": 3,
   "MaxCost": 0,
   "MaxCostStrategy": "",
   "RatesID": "86e223d",
   "RatingFiltersID": "7917131",
   "RoundingDecimals": 4,
   "RoundingMethod": "*up",
   "TimingID": "f4ba593"
  }
 },
 "RatingFilters": {
  "7917131": {
   "DestinationID": "BR_55112",
   "DestinationPrefix": "55112",
   "RatingPlanID": "RP_SINAT_FLEX_TNYX",
   "Subject": "*out:sinatzt:call:370df420-4e7d-4559-a390-b31ef26f4e10"
  }
 },
 "RunID": "",
 "StartTime": "2020-12-10T04:03:43Z",
 "Timings": {
  "f4ba593": {
   "MonthDays": [],
   "Months": [],
   "StartTime": "00:00:00",
   "WeekDays": [],
   "Years": []
  }
 },
 "Usage": "5m0s"
}
cgrates.json

Teofil Voivozeanu

unread,
Dec 10, 2020, 4:40:36 AM12/10/20
to CGRateS
Hi Acheraime,

The request is ok and this behaviour is normal.
You configured in your balance "RatingSubject": "370df420-4e7d-4559-a390-b31ef26f4e10", which means it will deduct from a monetary balance also. If you don't have a monetary balance available the call isn't allowed.
Also, the authorization mechanism uses accounts and the cost simulation use rates.

Thanks,
TeoV

ache...@gmail.com

unread,
Dec 10, 2020, 12:52:49 PM12/10/20
to CGRateS
Hi Teo,

Thank you for your answer. Does that mean if I want for a call to use unit from the *voice balance I should not specify a RatingSubject in the balance definition?
What if the account has both *voice and *monetary balances which one will take precedence?

thank you.
Acheraime

Teofil Voivozeanu

unread,
Dec 11, 2020, 10:24:13 AM12/11/20
to CGRateS

Hi Acheraime,

RatingSubject is to apply an additional cost for that balance. ( in your case you have voice balance but it has a price attached ).
As you configure the balance it will deduct from both voice and monetary. If you want to consume only from voice simply remove RatingSubject from the balance.

Thanks,
TeoV

ache...@gmail.com

unread,
Dec 11, 2020, 11:21:41 AM12/11/20
to CGRateS
Perfect!

Thanks Teo.

Acheraime

ache...@gmail.com

unread,
Dec 11, 2020, 1:17:43 PM12/11/20
to CGRateS
Hi Teo,

I've remove the RatingSubject from the balance and ensured that the account has only the *voice balance but the call is still not authorized.
Any idea?

[
 {
  "ActionTriggers": null,
  "AllowNegative": false,
  "BalanceMap": {
   "*monetary": [],
   "*voice": [
    {
     "Blocker": false,
     "Categories": {
      "call": true
     },
     "DestinationIDs": {
      "DR_FR": true
     },
     "Disabled": false,
     "ExpirationDate": "2021-01-11T17:50:02Z",
     "Factor": null,
     "ID": "PKG-RP_SINATOUT_3500_boc03ne3am5rkeqjo4i0",
     "RatingSubject": "",
     "SharedGroups": {},
     "TimingIDs": {
      "*asap": true
     },
     "Timings": null,
     "Uuid": "2cbbc2bc-bd8c-47f7-8ec8-1f0019014556",
     "Value": 3500,
     "Weight": 0
    }
   ]
  },
  "Disabled": false,
  "ID": "sinatzt:a56ca153-a4df-4bc7-b19d-e6b69ed2366e",
  "UnitCounters": null,
  "UpdateTime": "2020-12-11T18:03:01.018876122Z"
 }
]

Teofil Voivozeanu

unread,
Dec 14, 2020, 2:27:36 AM12/14/20
to CGRateS
Hi Acheraime,

Please make sure you have enough balance for the call to be authorized. In *voice balance, a unit represents a nanosecond. (e.g. 3500 units in voice balance means 0.0000035 Seconds ).

Thanks,
TeoV

ache...@gmail.com

unread,
Dec 18, 2020, 9:40:56 PM12/18/20
to CGRateS
Hi Teo,

Thank you for being so patient. Unfortunately I've update my code so that the balance is set but still calls are being rejected. 
Here's another look at the balance map and ngrep captures.

Your help is greatly appreciated.

Acheraime

[
 {
  "ActionTriggers": null,
  "AllowNegative": false,
  "BalanceMap": {
   "*monetary": [],
   "*voice": [
    {
     "Blocker": false,
     "Categories": {
      "call": true
     },
     "DestinationIDs": {
      "DR_BR": true
     },
     "Disabled": false,
     "ExpirationDate": "2021-01-15T03:05:32Z",
     "Factor": null,
     "ID": "PKG-RP_SINATOUT_3000_bo1qv07budgt6chb900g",
     "RatingSubject": "",
     "SharedGroups": {},
     "TimingIDs": {
      "*asap": true
     },
     "Timings": null,
     "Uuid": "7c6e2f6e-013d-448d-8f39-10a3603aa3f4",
     "Value": 1.8e+14,
     "Weight": 0
    }
   ]
  },
  "Disabled": false,
  "ID": "sinatzt:173fe19d-f449-49fd-a81f-a36c67eb63a6",
  "UnitCounters": null,
  "UpdateTime": "2020-12-15T03:05:32.820293556Z"
 }
]

=========================== ngrep capture =================================

  {"method":"ChargerSv1.ProcessEvent","params":[{"Tenant":"sinatzt","ID":"b768142","Time":null,"Event":{"Account":"173fe19d-f449-49fd-a81f-a36c67eb63a6","CGRID":"e6261df81885a3208862c97d38d8c5612a74bb8f","
  Destination":"551129763556","OriginHost":"10.20.100.2","OriginID":"7381dca3-bc45-1239-29ad-42010a146403","RequestType":"*prepaid","SetupTime":"1608345222","Source":"edge-proxy-1","Usage":10800000000000}}
  ],"id":9}.

  {"id":9,"result":[{"ChargerSProfile":"DEFAULT","AttributeSProfiles":null,"AlteredFields":["*req.RunID"],"CGREvent":{"Tenant":"sinatzt","ID":"b768142","Time":null,"Event":{"Account":"173fe19d-f449-49fd-a8
  1f-a36c67eb63a6","CGRID":"e6261df81885a3208862c97d38d8c5612a74bb8f","Destination":"551129763556","OriginHost":"10.20.100.2","OriginID":"7381dca3-bc45-1239-29ad-42010a146403","RequestType":"*prepaid","Run
  ID":"*default","SetupTime":"1608345222","Source":"edge-proxy-1","Usage":10800000000000}}}],"error":null}.

  {"method":"Responder.GetMaxSessionTime","params":[{"Category":"call","Tenant":"sinatzt","Subject":"173fe19d-f449-49fd-a81f-a36c67eb63a6","Account":"173fe19d-f449-49fd-a81f-a36c67eb63a6","Destination":"55XXXXXXXXXXXX","TimeStart":"2020-12-19T02:33:42Z","TimeEnd":"2020-12-19T05:33:42Z","LoopIndex":0,"DurationIndex":0,"FallbackSubject":"","RatingInfos":null,"Increments":null,"ToR":"","ExtraFields":{},"MaxRat
  e":0,"MaxRateUnit":0,"MaxCostSoFar":0,"CgrID":"e6261df81885a3208862c97d38d8c5612a74bb8f","RunID":"*default","ForceDuration":false,"PerformRounding":false,"DryRun":false,"DenyNegativeAccount":false}],"id" :10}.

  {"id":10,"result":0,"error":null}.

  {"method":"ThresholdSv1.ProcessEvent","params":[{"ThresholdIDs":null,"Tenant":"sinatzt","ID":"4b3a0403-9b2f-40e6-bef3-19b7278c8fe9","Time":null,"Event":{"Account":"173fe19d-f449-49fd-a81f-a36c67eb63a6","
  CGRID":"e6261df81885a3208862c97d38d8c5612a74bb8f","Destination":"55XXXXXXXXXX","OriginHost":"10.20.100.2","OriginID":"7381dca3-bc45-1239-29ad-42010a146403","RequestType":"*prepaid","SetupTime":"160834522
  2","Source":"edge-proxy-1","Usage":10800000000000}}],"id":11}.

  {"id":11,"result":null,"error":"NOT_FOUND"}.

=====================================================================================================

=========================== Opensips to Cgrates ========================================================

  { "method": "SessionSv1.AuthorizeEventWithDigest", "id": 895893441, "params": [ { "Category": "call", "Tenant": "sinatzt", "ProcessStatQueues": true, "ProcessThresholds": true, "ReleaseResources": false,
   "AllocateResources": false, "AuthorizeResources": false, "GetMaxUsage": true, "Event": { "Source": "edge-proxy-1", "OriginHost": "10.20.100.2", "RequestType": "*prepaid", "OriginID": "268b411e-bc46-1239
  -29ad-42010a146403", "Account": "173fe19d-f449-49fd-a81f-a36c67eb63a6", "SetupTime": "1608345522", "Destination": "55XXXXXXXXX" } } ] }

  {"id":895893441,"result":{"AttributesDigest":null,"ResourceAllocation":null,"MaxUsage":0,"SuppliersDigest":null,"Thresholds":"","StatQueues":null},"error":null}.

Teofil Voivozeanu

unread,
Dec 21, 2020, 6:50:39 AM12/21/20
to CGRateS
Hi Acheraime,

According to your ngrep, the problem is that your balance doesn't match your request. Our guess is that the destination that is in the event not match the destination that you put in balance. 
To confirm this please capture and post here the result of the following commands in the console: maxusage, destinations ( to verify the prefix ) and post the syslog.

Thanks,
TeoV

ache...@gmail.com

unread,
Dec 21, 2020, 9:32:21 AM12/21/20
to CGRateS
Hi Teo,

You are right. The problem is in my balance definition DestinationIDs is set to "DR_BR" which does not exists. I want this balance to authorize calls to Brazil which I have a DestinationID for each prefix.
Please see below for the command outputs.

cgr> maxusage ToR="*voice" Tenant="sinatzt" Category="call" Account="173fe19d-f449-49fd-a81f-a36c67eb63a6" Destination="55XXXXXXXXX" SetupTime="1608557092"
0

cgr> destinations DestinationIDs=["DR_BR"]
Error executing command: NOT_FOUND

cgr> destinations 
[
{
  "Id": "BR_55918212",
  "Prefixes": [
   "55918212"
  ]
 },
{
  "Id": "BR_55518223",
  "Prefixes": [
   "55518223"
  ]
 },
{
  "Id": "BR_559698194",
  "Prefixes": [
   "559698194"
  ]
 },
{
  "Id": "BR_55719383",
  "Prefixes": [
   "55719383"
  ]
 },
 {
  "Id": "BR_5549981",
  "Prefixes": [
   "5549981"
  ]
 },
 ....
]

Reply all
Reply to author
Forward
0 new messages