Hello team CGRateS,
Hope you are all doing well.
I've been playing with the ConfigSv1 methods to get/set/reload my runtime CGRateS configuration, and I'm not sure if I'm doing something wrong here, but below is what I've experienced and some of my questions about it, if you can please answer.
1/ I used the method "ConfigSv1.GetConfig" to get the current contents of the "cdrs" config object.
"ConfigSv1.GetConfig" method HTTP JSON-RPC request
{
"method": "ConfigSv1.GetConfig",
"params": [
{
"Tenant": null,
"Section":"cdrs",
"APIOpts": {}
}
]
}
Response back
{
"id": null,
"result": {
"cdrs": {
"attributes_conns": [
"*localhost"
],
"chargers_conns": [
"*localhost"
],
"compress_stored_cost": true,
"ees_conns": [
"*localhost"
],
"enabled": true,
"extra_fields": [
"~*req.variable_accountcode",
"~*req.variable_call_direction"
],
"online_cdr_exports": [
"http_billing_event",
],
"rals_conns": [
"*internal"
],
"scheduler_conns": [],
"session_cost_retries": 5,
"stats_conns": [],
"store_cdrs": true,
"thresholds_conns": []
}
},
"error": null
}
Returned result shows that "online_cdr_exports" is set with the value "http_billing_event".
And now if I wanted to remove this value "http_billing_event", I'd use method "ConfigSv1.SetConfig" to set "online_cdr_exports" to an empty list like below:
{
"method": "ConfigSv1.SetConfig",
"params": [
{
"DryRun": false,
"Config": {
"cdrs": {
"online_cdr_exports": []
}
}
}
]
}
I get a success response back saying:
{
"id": null,
"result": "OK",
"error": null
}
But "online_cdr_exports" is still set to "http_billing_event" in the "cdrs" config object if I query it using the "ConfigSv1.GetConfig" again. This same approach works just fine if I try to remove/empty out any other list type values of any other key attributes (like "attributes_conns", "chargers_conns", "ees_conns", "extra_fields", "rals_conns") in the "cdrs" config object, just not when I try it with "online_cdr_exports".
2/ If I use method "ConfigSv1.SetConfig" to set "online_cdr_exports" with a value that is not a valid exporter ID in my system, it complains about it but somehow still set those invalid values for "online_cdr_exports".
{
"method": "ConfigSv1.SetConfig",
"params": [
{
"Tenant": null,
"DryRun": false,
"Config": {
"cdrs": {
"online_cdr_exports": ["test", "fake_ees_id", ""]
}
}
}
]
}
{
"id": null,
"result": null,
"error": "<CDRs> cannot find exporter with ID: <test>"
}
Retrieving "cdrs" config after setting "online_cdr_exports" with invalid values above shows that despite complaining about the invalid ID it still ended up setting those IDs, even an empty string. And at this point I don't even have a way to remove these invalid ID's without restarting my CGRateS service.
{
"method": "ConfigSv1.GetConfig",
"params": [
{
"Tenant": null,
"Section":"cdrs",
"APIOpts": {}
}
]
}
Response back:
{
"id": null,
"result": {
"cdrs": {
"attributes_conns": [
"*localhost"
],
"chargers_conns": [
"*localhost"
],
"compress_stored_cost": false,
"ees_conns": [
"*localhost"
],
"enabled": true,
"extra_fields": [
"~*req.variable_accountcode",
"~*req.variable_call_direction"
],
"online_cdr_exports": [
"http_billing_event",
"test",
"fake_ees_id",
""
],
"rals_conns": [
"*internal"
],
"scheduler_conns": [],
"session_cost_retries": 5,
"stats_conns": [],
"store_cdrs": true,
"thresholds_conns": []
}
},
"error": null
}
3/ All ConfigSv1 methods (ConfigSv1.GetConfig, ConfigSv1.SetConfig, ConfigSv1.ReloadConfig, ConfigSv1.GetConfigAsJSON, ConfigSv1.SetConfigFromJSON) use 'Tenant' and 'APIOpts' as key attributes in their request payloads. Is there a use case for these key attributes as well somewhere?
4/ If I update and reload the runtime CGRateS config using methods 'ConfigSv1.SetConfig' and 'ConfigSv1.ReloadConfig', these changes get overridden when I restart my CGRateS service next. Is there a way to persist these changes during service restart?
Thanks,
Sal