From 295ddec792b2e4e2a919cecddba7f71b22ff2b49 Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Fri, 24 Oct 2025 17:41:53 +0300 Subject: [PATCH] cfg: move failed_posts to ees, add static_ttl --- apier/v1/apier.go | 2 +- apier/v1/config_it_test.go | 5 + config/config.go | 6 +- config/config_defaults.go | 7 +- config/config_it_test.go | 4 +- config/config_json_test.go | 11 +- config/config_test.go | 32 +++-- config/eescfg.go | 133 ++++++++++++------ config/eescfg_test.go | 38 ++++- config/generalcfg.go | 40 ++---- config/generalcfg_test.go | 22 +-- config/libconfig_json.go | 17 ++- config/multifiles_it_test.go | 6 +- .../samples/actions_internal/cgradmin.json | 8 +- .../actions_internal_gob/cgradmin.json | 4 +- data/conf/samples/actions_mongo/cgradmin.json | 4 +- .../samples/actions_mongo_gob/cgradmin.json | 6 +- data/conf/samples/actions_mysql/cgradmin.json | 6 +- .../samples/actions_mysql_gob/cgradmin.json | 4 +- .../samples/cdrsexport_internal/cgrates.json | 6 +- .../samples/cdrsexport_mongo/cgrates.json | 6 +- .../samples/cdrsexport_mysql/cgrates.json | 4 +- .../cdrsreplicationmaster.json | 8 +- .../cdrsreplicationmaster.json | 8 +- .../samples/cdrsv1processevent/cgrates.json | 8 +- .../cdrsv1processeventmongo/cgrates.json | 8 +- .../cdrsv1processeventmysql/cgrates.json | 4 +- .../cdrsv_failover_internal/cgrates.json | 9 +- .../samples/cdrsv_failover_mongo/cgrates.json | 7 +- .../samples/cdrsv_failover_mysql/cgrates.json | 7 +- data/conf/samples/ees_cloud/cgrates.json | 8 +- data/conf/samples/multifiles/b/b.json | 2 +- data/conf/samples/multifiles/d.json | 3 +- ees/libactions.go | 10 +- ees/libcdre.go | 4 +- ees/libcdre_it_test.go | 2 +- ees/libcdre_test.go | 4 +- ees/poster_it_test.go | 4 +- general_tests/cdrs_onlexp_it_test.go | 16 +-- general_tests/cdrs_post_failover_it_test.go | 12 +- general_tests/cdrs_processevent_it_test.go | 12 +- general_tests/ees_it_test.go | 4 +- general_tests/poster_it_test.go | 12 +- services/globalvars.go | 2 +- utils/consts.go | 7 +- 45 files changed, 324 insertions(+), 208 deletions(-) diff --git a/apier/v1/apier.go b/apier/v1/apier.go index 1e24c650f..8129209f4 100644 --- a/apier/v1/apier.go +++ b/apier/v1/apier.go @@ -1357,7 +1357,7 @@ func (apierSv1 *APIerSv1) ReplayFailedPosts(ctx *context.Context, args ReplayFai // Set default directories if not provided. if args.SourcePath == "" { - args.SourcePath = apierSv1.Config.GeneralCfg().FailedPostsDir + args.SourcePath = apierSv1.Config.EEsCfg().FailedPosts.Dir } if args.FailedPath == "" { args.FailedPath = args.SourcePath diff --git a/apier/v1/config_it_test.go b/apier/v1/config_it_test.go index 13937782d..36db0c2cf 100644 --- a/apier/v1/config_it_test.go +++ b/apier/v1/config_it_test.go @@ -400,6 +400,11 @@ func testConfigSSetConfigEEs(t *testing.T) { exp := map[string]any{ "enabled": true, "attributes_conns": []any{}, + utils.FailedPostsCfg: map[string]any{ + utils.DirCfg: "/var/spool/cgrates/failed_posts", + utils.TTLCfg: "5s", + utils.StaticTTLCfg: true, + }, "cache": map[string]any{ "*file_csv": map[string]any{"limit": -1., "ttl": "5s", "precache": false, "replicate": false, "static_ttl": false, "remote": false}, "*amqp_json_map": map[string]any{"limit": -1., "precache": false, "replicate": false, "static_ttl": false, "remote": false}, diff --git a/config/config.go b/config/config.go index ec9779bb4..708fae296 100644 --- a/config/config.go +++ b/config/config.go @@ -174,8 +174,10 @@ func newCGRConfig(config []byte) (cfg *CGRConfig, err error) { cfg.loaderCfg = make(LoaderSCfgs, 0) cfg.apier = new(ApierCfg) cfg.ersCfg = new(ERsCfg) - cfg.eesCfg = new(EEsCfg) - cfg.eesCfg.Cache = make(map[string]*CacheParamCfg) + cfg.eesCfg = &EEsCfg{ + Cache: make(map[string]*CacheParamCfg), + FailedPosts: &FailedPostsCfg{}, + } cfg.sipAgentCfg = new(SIPAgentCfg) cfg.janusAgentCfg = new(JanusAgentCfg) cfg.configSCfg = new(ConfigSCfg) diff --git a/config/config_defaults.go b/config/config_defaults.go index c92461a96..e07c3cac5 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -35,8 +35,6 @@ const CGRATES_CFG_JSON = ` "dbdata_encoding": "*msgpack", // encoding used to store object data in strings: <*msgpack|*json> "tpexport_dir": "/var/spool/cgrates/tpe", // path towards export folder for offline TariffPlans "poster_attempts": 3, // number of attempts before considering post request failed (eg: *http_post, CDR exports) - "failed_posts_dir": "/var/spool/cgrates/failed_posts", // directory path where we store failed requests - "failed_posts_ttl": "5s", // time to wait before writing the failed posts in a single file "default_request_type": "*rated", // default request type to consider when missing from requests: <""|*prepaid|*postpaid|*pseudoprepaid|*rated> "default_category": "call", // default category to consider when missing from requests "default_tenant": "cgrates.org", // default tenant to consider when missing from requests @@ -538,6 +536,11 @@ const CGRATES_CFG_JSON = ` "*sql": {"limit": -1, "ttl": "", "static_ttl": false}, "*els": {"limit": -1, "ttl": "", "static_ttl": false}, }, + "failed_posts": { + "dir": "/var/spool/cgrates/failed_posts", // directory where failed export requests are stored + "ttl": "5s", // cache ttl for batching failed posts before writing to disk + "static_ttl": true, // if false, ttl resets on every cache access + }, "exporters": [ { "id": "*default", // identifier of the EventReader profile diff --git a/config/config_it_test.go b/config/config_it_test.go index 15a0734f6..455983e59 100644 --- a/config/config_it_test.go +++ b/config/config_it_test.go @@ -111,8 +111,8 @@ func testNewCgrJsonCfgFromHttp(t *testing.T) { func testNewCGRConfigFromPath(t *testing.T) { for key, val := range map[string]string{"LOGGER": "*syslog", "LOG_LEVEL": "6", "ROUND_DEC": "5", - "DB_ENCODING": "*msgpack", "TP_EXPORT_DIR": "/var/spool/cgrates/tpe", "FAILED_POSTS_DIR": "/var/spool/cgrates/failed_posts", - "DF_TENANT": "cgrates.org", "TIMEZONE": "Local"} { + "DB_ENCODING": "*msgpack", "TP_EXPORT_DIR": "/var/spool/cgrates/tpe", "DF_TENANT": "cgrates.org", + "TIMEZONE": "Local"} { os.Setenv(key, val) } addr := "https://raw.githubusercontent.com/cgrates/cgrates/master/data/conf/samples/multifiles/a.json;https://raw.githubusercontent.com/cgrates/cgrates/master/data/conf/samples/multifiles/b/b.json;https://raw.githubusercontent.com/cgrates/cgrates/master/data/conf/samples/multifiles/c.json;https://raw.githubusercontent.com/cgrates/cgrates/master/data/conf/samples/multifiles/d.json" diff --git a/config/config_json_test.go b/config/config_json_test.go index 37cfc5411..d740929d4 100644 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -36,8 +36,6 @@ func TestDfGeneralJsonCfg(t *testing.T) { Dbdata_encoding: utils.StringPointer("*msgpack"), Tpexport_dir: utils.StringPointer("/var/spool/cgrates/tpe"), Poster_attempts: utils.IntPointer(3), - Failed_posts_dir: utils.StringPointer("/var/spool/cgrates/failed_posts"), - Failed_posts_ttl: utils.StringPointer("5s"), Default_request_type: utils.StringPointer(utils.MetaRated), Default_category: utils.StringPointer("call"), Default_tenant: utils.StringPointer("cgrates.org"), @@ -2269,8 +2267,8 @@ func TestDfEventReaderCfg(t *testing.T) { func TestDfEventExporterCfg(t *testing.T) { eCfg := &EEsJsonCfg{ - Enabled: utils.BoolPointer(false), - Attributes_conns: &[]string{}, + Enabled: utils.BoolPointer(false), + AttributeSConns: &[]string{}, Cache: &map[string]*CacheParamJsonCfg{ utils.MetaFileCSV: { Limit: utils.IntPointer(-1), @@ -2318,6 +2316,11 @@ func TestDfEventExporterCfg(t *testing.T) { Static_ttl: utils.BoolPointer(false), }, }, + FailedPosts: &FailedPostsJsonCfg{ + Dir: utils.StringPointer("/var/spool/cgrates/failed_posts"), + TTL: utils.StringPointer("5s"), + StaticTTL: utils.BoolPointer(true), + }, Exporters: &[]*EventExporterJsonCfg{ { Id: utils.StringPointer(utils.MetaDefault), diff --git a/config/config_test.go b/config/config_test.go index 54dec2685..48f13c8f1 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -258,9 +258,6 @@ func TestCgrCfgJSONDefaultsGeneral(t *testing.T) { if cgrCfg.GeneralCfg().PosterAttempts != 3 { t.Errorf("Expected: 3, received: %+v", cgrCfg.GeneralCfg().PosterAttempts) } - if expected := "/var/spool/cgrates/failed_posts"; cgrCfg.GeneralCfg().FailedPostsDir != expected { - t.Errorf("Expected: %+v, received: %+v", expected, cgrCfg.GeneralCfg().FailedPostsDir) - } if cgrCfg.GeneralCfg().DefaultReqType != "*rated" { t.Errorf("Expected: *rated, received: %+v", cgrCfg.GeneralCfg().DefaultReqType) } @@ -1053,7 +1050,6 @@ func TestLoadGeneralCfgError(t *testing.T) { "general": { "node_id": [], "locking_timeout": "0", - "failed_posts_ttl": "0s", "connect_timeout": "0s", "reply_timeout": "0s", } @@ -1639,7 +1635,7 @@ func TestLoadEesCfgError(t *testing.T) { "attributes_conns": "*conn1", } }` - expected := "json: cannot unmarshal string into Go struct field EEsJsonCfg.Attributes_conns of type []string" + expected := "json: cannot unmarshal string into Go struct field EEsJsonCfg.attributes_conns of type []string" cgrConfig := NewDefaultCGRConfig() if cgrCfgJSON, err := NewCgrJsonCfgFromBytes([]byte(cfgJSONStr)); err != nil { t.Error(err) @@ -2307,6 +2303,11 @@ func TestEEsNoLksConfig(t *testing.T) { StaticTTL: false, }, }, + FailedPosts: &FailedPostsCfg{ + Dir: "/var/spool/cgrates/failed_posts", + TTL: 5 * time.Second, + StaticTTL: true, + }, Exporters: []*EventExporterCfg{ { ID: utils.MetaDefault, @@ -3509,7 +3510,6 @@ func TestV1GetConfigGeneral(t *testing.T) { "general": { "node_id": "ENGINE1", "locking_timeout": "0", - "failed_posts_ttl": "0s", "connect_timeout": "0s", "reply_timeout": "0s", } @@ -3522,8 +3522,6 @@ func TestV1GetConfigGeneral(t *testing.T) { utils.DBDataEncodingCfg: "*msgpack", utils.TpExportPathCfg: "/var/spool/cgrates/tpe", utils.PosterAttemptsCfg: 3, - utils.FailedPostsDirCfg: "/var/spool/cgrates/failed_posts", - utils.FailedPostsTTLCfg: "0", utils.DefaultReqTypeCfg: "*rated", utils.DefaultCategoryCfg: "call", utils.DefaultTenantCfg: "cgrates.org", @@ -4487,6 +4485,11 @@ func TestV1GetConfigSectionEES(t *testing.T) { utils.StaticTTLCfg: false, }, }, + utils.FailedPostsCfg: map[string]any{ + utils.DirCfg: "/var/spool/cgrates/failed_posts", + utils.TTLCfg: "5s", + utils.StaticTTLCfg: true, + }, utils.ExportersCfg: []map[string]any{ { utils.IDCfg: utils.MetaDefault, @@ -4871,7 +4874,7 @@ func TestV1GetConfigAsJSONGeneral(t *testing.T) { "node_id": "ENGINE1", } }` - expected := `{"general":{"caching_delay":"0","connect_attempts":5,"connect_timeout":"1s","dbdata_encoding":"*msgpack","default_caching":"*reload","default_category":"call","default_request_type":"*rated","default_tenant":"cgrates.org","default_timezone":"Local","digest_equal":":","digest_separator":",","failed_posts_dir":"/var/spool/cgrates/failed_posts","failed_posts_ttl":"5s","locking_timeout":"0","log_level":6,"logger":"*syslog","max_parallel_conns":100,"max_reconnect_interval":"0","node_id":"ENGINE1","poster_attempts":3,"reconnects":-1,"reply_timeout":"2s","rounding_decimals":5,"rsr_separator":";","tpexport_dir":"/var/spool/cgrates/tpe"}}` + expected := `{"general":{"caching_delay":"0","connect_attempts":5,"connect_timeout":"1s","dbdata_encoding":"*msgpack","default_caching":"*reload","default_category":"call","default_request_type":"*rated","default_tenant":"cgrates.org","default_timezone":"Local","digest_equal":":","digest_separator":",","locking_timeout":"0","log_level":6,"logger":"*syslog","max_parallel_conns":100,"max_reconnect_interval":"0","node_id":"ENGINE1","poster_attempts":3,"reconnects":-1,"reply_timeout":"2s","rounding_decimals":5,"rsr_separator":";","tpexport_dir":"/var/spool/cgrates/tpe"}}` if cfgCgr, err := NewCGRConfigFromJSONStringWithDefaults(strJSON); err != nil { t.Error(err) } else if err := cfgCgr.V1GetConfigAsJSON(context.Background(), &SectionWithAPIOpts{Section: GENERAL_JSN}, &reply); err != nil { @@ -5215,7 +5218,7 @@ func TestV1GetConfigAsJSONApierS(t *testing.T) { func TestV1GetConfigAsJSONCfgEES(t *testing.T) { var reply string - expected := `{"ees":{"attributes_conns":[],"cache":{"*amqp_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*amqpv1_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*els":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*file_csv":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*kafka_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*nats_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*s3_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*sql":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*sqs_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false}},"enabled":false,"exporters":[{"attempts":1,"attribute_context":"","attribute_ids":[],"concurrent_requests":0,"export_path":"/var/spool/cgrates/ees","failed_posts_dir":"/var/spool/cgrates/failed_posts","fields":[],"filters":[],"flags":[],"id":"*default","metrics_reset_schedule":"","opts":{},"synchronous":false,"timezone":"","type":"*none"}]}}` + expected := `{"ees":{"attributes_conns":[],"cache":{"*amqp_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*amqpv1_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*els":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*file_csv":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*kafka_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*nats_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*s3_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*sql":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*sqs_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false}},"enabled":false,"exporters":[{"attempts":1,"attribute_context":"","attribute_ids":[],"concurrent_requests":0,"export_path":"/var/spool/cgrates/ees","failed_posts_dir":"/var/spool/cgrates/failed_posts","fields":[],"filters":[],"flags":[],"id":"*default","metrics_reset_schedule":"","opts":{},"synchronous":false,"timezone":"","type":"*none"}],"failed_posts":{"dir":"/var/spool/cgrates/failed_posts","static_ttl":true,"ttl":"5s"}}}` cgrCfg := NewDefaultCGRConfig() if err := cgrCfg.V1GetConfigAsJSON(context.Background(), &SectionWithAPIOpts{Section: EEsJson}, &reply); err != nil { t.Error(err) @@ -5406,7 +5409,7 @@ func TestV1GetConfigAsJSONAllConfig(t *testing.T) { }` var reply string cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSON) - expected := `{"analyzers":{"cleanup_interval":"1h0m0s","db_path":"/var/spool/cgrates/analyzers","enabled":false,"index_type":"*scorch","ttl":"24h0m0s"},"apiban":{"keys":[]},"apiers":{"attributes_conns":[],"caches_conns":["*internal"],"ees_conns":[],"enabled":false,"scheduler_conns":[]},"asterisk_agent":{"asterisk_conns":[{"address":"127.0.0.1:8088","alias":"","connect_attempts":3,"max_reconnect_interval":"0s","password":"CGRateS.org","reconnects":5,"user":"cgrates"}],"create_cdr":false,"enabled":false,"route_profile":false,"sessions_conns":["*birpc_internal"]},"attributes":{"any_context":true,"apiers_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"opts":{"*processRuns":1,"*profileIDs":[],"*profileIgnoreFilters":false,"*profileRuns":0},"prefix_indexed_fields":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"caches":{"partitions":{"*account_action_plans":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_plans":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_triggers":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*actions":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*apiban":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2m0s"},"*attribute_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*caps_events":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*cdr_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10m0s"},"*charger_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*closed_sessions":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*destinations":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*diameter_messages":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*dispatcher_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_hosts":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_loads":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_routes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatchers":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*event_charges":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*event_ips":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*event_resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ip_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ip_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ips":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*radius_packets":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*ranking_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rating_plans":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rating_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*replication_hosts":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*reverse_destinations":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_connections":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_responses":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2s"},"*sentrypeer":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":true,"ttl":"24h0m0s"},"*shared_groups":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*stat_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*stir":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*threshold_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*timings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*trend_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*uch":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"}},"remote_conns":[],"replication_conns":[]},"cdrs":{"attributes_conns":[],"chargers_conns":[],"compress_stored_cost":false,"ees_conns":[],"enabled":false,"extra_fields":[],"online_cdr_exports":[],"rals_conns":[],"scheduler_conns":[],"session_cost_retries":5,"stats_conns":[],"store_cdrs":true,"thresholds_conns":[]},"chargers":{"attributes_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"suffix_indexed_fields":[]},"configs":{"enabled":false,"root_dir":"/var/spool/cgrates/configs","url":"/configs/"},"cores":{"caps":0,"caps_stats_interval":"0","caps_strategy":"*busy","shutdown_timeout":"1s"},"data_db":{"db_host":"127.0.0.1","db_name":"10","db_password":"","db_port":6379,"db_type":"*redis","db_user":"cgrates","items":{"*account_action_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_triggers":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*destinations":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_hosts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ip_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ip_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ips":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ranking_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rating_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rating_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*reverse_destinations":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*sessions_backup":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*shared_groups":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*stat_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*timings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*trend_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*versions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"internalDBBackupPath":"/var/lib/cgrates/internal_db/backup/datadb","internalDBDumpInterval":"0s","internalDBDumpPath":"/var/lib/cgrates/internal_db/datadb","internalDBFileSizeLimit":1073741824,"internalDBRewriteInterval":"0s","internalDBStartTimeout":"5m0s","mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisPoolPipelineLimit":0,"redisPoolPipelineWindow":"150µs","redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_failed_dir":"","replication_filtered":false,"replication_interval":"0s"},"diameter_agent":{"asr_template":"","conn_health_check_interval":"0s","conn_status_stat_queue_ids":[],"conn_status_threshold_ids":[],"dictionaries_path":"/usr/share/cgrates/diameter/dict/","enabled":false,"forced_disconnect":"*none","listen":"127.0.0.1:3868","listen_net":"tcp","origin_host":"CGR-DA","origin_realm":"cgrates.org","product_name":"CGRateS","rar_template":"","request_processors":[],"sessions_conns":["*birpc_internal"],"stats_conns":[],"synced_conn_requests":false,"thresholds_conns":[],"vendor_id":0},"dispatchers":{"any_subsystem":true,"attributes_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"prevent_loop":false,"suffix_indexed_fields":[]},"dns_agent":{"enabled":false,"listeners":[{"address":"127.0.0.1:53","network":"udp"}],"request_processors":[],"sessions_conns":["*internal"],"stats_conns":[],"thresholds_conns":[],"timezone":""},"ees":{"attributes_conns":[],"cache":{"*amqp_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*amqpv1_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*els":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*file_csv":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*kafka_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*nats_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*s3_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*sql":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*sqs_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false}},"enabled":false,"exporters":[{"attempts":1,"attribute_context":"","attribute_ids":[],"concurrent_requests":0,"export_path":"/var/spool/cgrates/ees","failed_posts_dir":"/var/spool/cgrates/failed_posts","fields":[],"filters":[],"flags":[],"id":"*default","metrics_reset_schedule":"","opts":{},"synchronous":false,"timezone":"","type":"*none"}]},"ers":{"concurrent_events":1,"ees_conns":[],"enabled":false,"partial_cache_ttl":"1s","readers":[{"cache_dump_fields":[],"concurrent_requests":1024,"fields":[{"mandatory":true,"path":"*cgreq.ToR","tag":"ToR","type":"*variable","value":"~*req.2"},{"mandatory":true,"path":"*cgreq.OriginID","tag":"OriginID","type":"*variable","value":"~*req.3"},{"mandatory":true,"path":"*cgreq.RequestType","tag":"RequestType","type":"*variable","value":"~*req.4"},{"mandatory":true,"path":"*cgreq.Tenant","tag":"Tenant","type":"*variable","value":"~*req.6"},{"mandatory":true,"path":"*cgreq.Category","tag":"Category","type":"*variable","value":"~*req.7"},{"mandatory":true,"path":"*cgreq.Account","tag":"Account","type":"*variable","value":"~*req.8"},{"mandatory":true,"path":"*cgreq.Subject","tag":"Subject","type":"*variable","value":"~*req.9"},{"mandatory":true,"path":"*cgreq.Destination","tag":"Destination","type":"*variable","value":"~*req.10"},{"mandatory":true,"path":"*cgreq.SetupTime","tag":"SetupTime","type":"*variable","value":"~*req.11"},{"mandatory":true,"path":"*cgreq.AnswerTime","tag":"AnswerTime","type":"*variable","value":"~*req.12"},{"mandatory":true,"path":"*cgreq.Usage","tag":"Usage","type":"*variable","value":"~*req.13"}],"filters":[],"flags":[],"id":"*default","max_reconnect_interval":"5m0s","opts":{"csvFieldSeparator":",","csvHeaderDefineChar":":","csvRowLength":0,"natsSubject":"cgrates_cdrs","partialCacheAction":"*none","partialOrderField":"~*req.AnswerTime"},"partial_commit_fields":[],"processed_path":"/var/spool/cgrates/ers/out","reconnects":-1,"run_delay":"0","source_path":"/var/spool/cgrates/ers/in","start_delay":"0","tenant":"","timezone":"","type":"*none"}],"sessions_conns":["*internal"],"stats_conns":[],"thresholds_conns":[]},"filters":{"apiers_conns":[],"rankings_conns":[],"resources_conns":[],"stats_conns":[],"trends_conns":[]},"freeswitch_agent":{"active_session_delimiter":",","create_cdr":false,"empty_balance_ann_file":"","empty_balance_context":"","enabled":false,"event_socket_conns":[{"address":"127.0.0.1:8021","alias":"127.0.0.1:8021","max_reconnect_interval":"0s","password":"ClueCon","reconnects":5,"reply_timeout":"1m0s"}],"extra_fields":"","low_balance_ann_file":"","max_wait_connection":"2s","route_profile":false,"sched_transfer_extension":"CGRateS","sessions_conns":["*birpc_internal"],"subscribe_park":true},"general":{"caching_delay":"0","connect_attempts":5,"connect_timeout":"1s","dbdata_encoding":"*msgpack","default_caching":"*reload","default_category":"call","default_request_type":"*rated","default_tenant":"cgrates.org","default_timezone":"Local","digest_equal":":","digest_separator":",","failed_posts_dir":"/var/spool/cgrates/failed_posts","failed_posts_ttl":"5s","locking_timeout":"0","log_level":6,"logger":"*syslog","max_parallel_conns":100,"max_reconnect_interval":"0","node_id":"ENGINE1","poster_attempts":3,"reconnects":-1,"reply_timeout":"2s","rounding_decimals":5,"rsr_separator":";","tpexport_dir":"/var/spool/cgrates/tpe"},"http":{"auth_users":{},"client_opts":{"dialFallbackDelay":"300ms","dialKeepAlive":"30s","dialTimeout":"30s","disableCompression":false,"disableKeepAlives":false,"expectContinueTimeout":"0s","forceAttemptHttp2":true,"idleConnTimeout":"1m30s","maxConnsPerHost":0,"maxIdleConns":100,"maxIdleConnsPerHost":2,"responseHeaderTimeout":"0s","skipTlsVerify":false,"tlsHandshakeTimeout":"10s"},"freeswitch_cdrs_url":"/freeswitch_json","http_cdrs":"/cdr_http","json_rpc_url":"/jsonrpc","pprof_path":"/debug/pprof/","registrars_url":"/registrar","use_basic_auth":false,"ws_url":"/ws"},"http_agent":[],"ips":{"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"opts":{"*units":1,"*usageID":""},"prefix_indexed_fields":[],"store_interval":"0s","string_indexed_fields":null,"suffix_indexed_fields":[]},"kamailio_agent":{"create_cdr":false,"enabled":false,"evapi_conns":[{"address":"127.0.0.1:8448","alias":"","max_reconnect_interval":"0s","reconnects":5}],"route_profile":false,"sessions_conns":["*birpc_internal"],"timezone":""},"listen":{"http":"127.0.0.1:2080","http_tls":"127.0.0.1:2280","rpc_gob":"127.0.0.1:2013","rpc_gob_tls":"127.0.0.1:2023","rpc_json":"127.0.0.1:2012","rpc_json_tls":"127.0.0.1:2022"},"loader":{"caches_conns":["*localhost"],"data_path":"./","disable_reverse":false,"field_separator":",","gapi_credentials":".gapi/credentials.json","gapi_token":".gapi/token.json","scheduler_conns":["*localhost"],"tpid":""},"loaders":[{"caches_conns":["*internal"],"data":[{"fields":[{"mandatory":true,"path":"Tenant","tag":"TenantID","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ProfileID","type":"*variable","value":"~*req.1"},{"path":"Contexts","tag":"Contexts","type":"*variable","value":"~*req.2"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.3"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.4"},{"path":"AttributeFilterIDs","tag":"AttributeFilterIDs","type":"*variable","value":"~*req.5"},{"path":"Path","tag":"Path","type":"*variable","value":"~*req.6"},{"path":"Type","tag":"Type","type":"*variable","value":"~*req.7"},{"path":"Value","tag":"Value","type":"*variable","value":"~*req.8"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.9"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.10"}],"file_name":"Attributes.csv","flags":null,"type":"*attributes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Type","tag":"Type","type":"*variable","value":"~*req.2"},{"path":"Element","tag":"Element","type":"*variable","value":"~*req.3"},{"path":"Values","tag":"Values","type":"*variable","value":"~*req.4"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.5"}],"file_name":"Filters.csv","flags":null,"type":"*filters"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"UsageTTL","tag":"TTL","type":"*variable","value":"~*req.4"},{"path":"Limit","tag":"Limit","type":"*variable","value":"~*req.5"},{"path":"AllocationMessage","tag":"AllocationMessage","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.9"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.10"}],"file_name":"Resources.csv","flags":null,"type":"*resources"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.4"},{"path":"Type","tag":"Type","type":"*variable","value":"~*req.5"},{"path":"AddressPool","tag":"AddressPool","type":"*variable","value":"~*req.6"},{"path":"Allocation","tag":"Allocation","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.9"}],"file_name":"IPs.csv","flags":null,"type":"*ips"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"QueueLength","tag":"QueueLength","type":"*variable","value":"~*req.4"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.5"},{"path":"MinItems","tag":"MinItems","type":"*variable","value":"~*req.6"},{"path":"MetricIDs","tag":"MetricIDs","type":"*variable","value":"~*req.7"},{"path":"MetricFilterIDs","tag":"MetricFilterIDs","type":"*variable","value":"~*req.8"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.9"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.10"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.11"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.12"}],"file_name":"Stats.csv","flags":null,"type":"*stats"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"MaxHits","tag":"MaxHits","type":"*variable","value":"~*req.4"},{"path":"MinHits","tag":"MinHits","type":"*variable","value":"~*req.5"},{"path":"MinSleep","tag":"MinSleep","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.8"},{"path":"ActionIDs","tag":"ActionIDs","type":"*variable","value":"~*req.9"},{"path":"Async","tag":"Async","type":"*variable","value":"~*req.10"}],"file_name":"Thresholds.csv","flags":null,"type":"*thresholds"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.4"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.5"},{"path":"RouteID","tag":"RouteID","type":"*variable","value":"~*req.6"},{"path":"RouteFilterIDs","tag":"RouteFilterIDs","type":"*variable","value":"~*req.7"},{"path":"RouteAccountIDs","tag":"RouteAccountIDs","type":"*variable","value":"~*req.8"},{"path":"RouteRatingPlanIDs","tag":"RouteRatingPlanIDs","type":"*variable","value":"~*req.9"},{"path":"RouteResourceIDs","tag":"RouteResourceIDs","type":"*variable","value":"~*req.10"},{"path":"RouteStatIDs","tag":"RouteStatIDs","type":"*variable","value":"~*req.11"},{"path":"RouteWeight","tag":"RouteWeight","type":"*variable","value":"~*req.12"},{"path":"RouteBlocker","tag":"RouteBlocker","type":"*variable","value":"~*req.13"},{"path":"RouteParameters","tag":"RouteParameters","type":"*variable","value":"~*req.14"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.15"}],"file_name":"Routes.csv","flags":null,"type":"*routes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"RunID","tag":"RunID","type":"*variable","value":"~*req.4"},{"path":"AttributeIDs","tag":"AttributeIDs","type":"*variable","value":"~*req.5"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.6"}],"file_name":"Chargers.csv","flags":null,"type":"*chargers"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Contexts","tag":"Contexts","type":"*variable","value":"~*req.2"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.3"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.4"},{"path":"Strategy","tag":"Strategy","type":"*variable","value":"~*req.5"},{"path":"StrategyParameters","tag":"StrategyParameters","type":"*variable","value":"~*req.6"},{"path":"ConnID","tag":"ConnID","type":"*variable","value":"~*req.7"},{"path":"ConnFilterIDs","tag":"ConnFilterIDs","type":"*variable","value":"~*req.8"},{"path":"ConnWeight","tag":"ConnWeight","type":"*variable","value":"~*req.9"},{"path":"ConnBlocker","tag":"ConnBlocker","type":"*variable","value":"~*req.10"},{"path":"ConnParameters","tag":"ConnParameters","type":"*variable","value":"~*req.11"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.12"}],"file_name":"DispatcherProfiles.csv","flags":null,"type":"*dispatchers"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Address","tag":"Address","type":"*variable","value":"~*req.2"},{"path":"Transport","tag":"Transport","type":"*variable","value":"~*req.3"},{"path":"ConnectAttempts","tag":"ConnectAttempts","type":"*variable","value":"~*req.4"},{"path":"Reconnects","tag":"Reconnects","type":"*variable","value":"~*req.5"},{"path":"MaxReconnectInterval","tag":"MaxReconnectInterval","type":"*variable","value":"~*req.6"},{"path":"ConnectTimeout","tag":"ConnectTimeout","type":"*variable","value":"~*req.7"},{"path":"ReplyTimeout","tag":"ReplyTimeout","type":"*variable","value":"~*req.8"},{"path":"TLS","tag":"TLS","type":"*variable","value":"~*req.9"},{"path":"ClientKey","tag":"ClientKey","type":"*variable","value":"~*req.10"},{"path":"ClientCertificate","tag":"ClientCertificate","type":"*variable","value":"~*req.11"},{"path":"CaCertificate","tag":"CaCertificate","type":"*variable","value":"~*req.12"}],"file_name":"DispatcherHosts.csv","flags":null,"type":"*dispatcher_hosts"}],"dry_run":false,"enabled":false,"field_separator":",","id":"*default","lockfile_path":".cgr.lck","run_delay":"0","tenant":"","tp_in_dir":"/var/spool/cgrates/loader/in","tp_out_dir":"/var/spool/cgrates/loader/out"}],"mailer":{"auth_password":"CGRateS.org","auth_user":"cgrates","from_address":"cgr-mailer@localhost.localdomain","server":"localhost"},"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"mongoConnScheme":"mongodb","mongoQueryTimeout":"0s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisPoolPipelineLimit":0,"redisPoolPipelineWindow":"150µs","redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"out_datadb_password":"","out_datadb_port":"6379","out_datadb_type":"*redis","out_datadb_user":"cgrates","out_stordb_host":"127.0.0.1","out_stordb_name":"cgrates","out_stordb_opts":{"mongoConnScheme":"mongodb","mongoQueryTimeout":"0s","mysqlDSNParams":null,"mysqlLocation":"","pgSSLMode":"","sqlConnMaxLifetime":"0s","sqlMaxIdleConns":0,"sqlMaxOpenConns":0},"out_stordb_password":"","out_stordb_port":"3306","out_stordb_type":"*mysql","out_stordb_user":"cgrates","users_filters":null},"prometheus_agent":{"apiers_conns":[],"cache_ids":[],"caches_conns":[],"collect_go_metrics":false,"collect_process_metrics":false,"cores_conns":[],"enabled":false,"path":"/prometheus","stat_queue_ids":[],"stats_conns":[]},"radius_agent":{"client_dictionaries":{"*default":["/usr/share/cgrates/radius/dict/"]},"client_secrets":{"*default":"CGRateS.org"},"coa_template":"*coa","dmr_template":"*dmr","enabled":false,"listeners":[{"acct_address":"127.0.0.1:1813","auth_address":"127.0.0.1:1812","network":"udp"}],"request_processors":[],"requests_cache_key":"","sessions_conns":["*internal"],"stats_conns":[],"thresholds_conns":[]},"rals":{"balance_rating_subject":{"*any":"*zero1ns","*voice":"*zero1s"},"enabled":false,"fallback_depth":3,"max_computed_usage":{"*any":"189h0m0s","*data":"107374182400","*mms":"10000","*sms":"10000","*voice":"72h0m0s"},"max_increments":1000000,"remove_expired":true,"rp_subject_prefix_matching":false,"sessions_conns":[],"stats_conns":[],"thresholds_conns":[]},"rankings":{"ees_conns":[],"ees_exporter_ids":[],"enabled":false,"scheduled_ids":{},"stats_conns":[],"store_interval":"","thresholds_conns":[]},"registrarc":{"dispatchers":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]},"rpc":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]}},"resources":{"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"opts":{"*units":1,"*usageID":""},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[],"thresholds_conns":[]},"routes":{"attributes_conns":[],"default_ratio":1,"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"opts":{"*context":"*routes","*ignoreErrors":false,"*maxCost":""},"prefix_indexed_fields":[],"rals_conns":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"rpc_conns":{"*bijson_localhost":{"conns":[{"address":"127.0.0.1:2014","transport":"*birpc_json"}],"poolSize":0,"strategy":"*first"},"*birpc_internal":{"conns":[{"address":"*birpc_internal","transport":""}],"poolSize":0,"strategy":"*first"},"*internal":{"conns":[{"address":"*internal","transport":""}],"poolSize":0,"strategy":"*first"},"*localhost":{"conns":[{"address":"127.0.0.1:2012","transport":"*json"}],"poolSize":0,"strategy":"*first"}},"schedulers":{"cdrs_conns":[],"dynaprepaid_actionplans":[],"enabled":false,"filters":[],"stats_conns":[],"thresholds_conns":[]},"sentrypeer":{"Audience":"https://sentrypeer.com/api","ClientID":"","ClientSecret":"","GrantType":"client_credentials","IpUrl":"https://sentrypeer.com/api/ip-addresses","NumberUrl":"https://sentrypeer.com/api/phone-numbers","TokenURL":"https://authz.sentrypeer.com/oauth/token"},"sessions":{"alterable_fields":[],"attributes_conns":[],"backup_interval":"0","cdrs_conns":[],"channel_sync_interval":"0","chargers_conns":[],"client_protocol":2,"debit_interval":"0","default_usage":{"*any":"3h0m0s","*data":"1048576","*sms":"1","*voice":"3h0m0s"},"enabled":false,"listen_bigob":"","listen_bijson":"127.0.0.1:2014","min_dur_low_balance":"0","rals_conns":[],"replication_conns":[],"resources_conns":[],"routes_conns":[],"scheduler_conns":[],"session_indexes":[],"session_ttl":"0","stale_chan_max_extra_usage":"0","stats_conns":[],"stir":{"allowed_attest":["*any"],"default_attest":"A","payload_maxduration":"-1","privatekey_path":"","publickey_path":""},"store_session_costs":false,"terminate_attempts":5,"thresholds_conns":[]},"sip_agent":{"enabled":false,"listen":"127.0.0.1:5060","listen_net":"udp","request_processors":[],"retransmission_timer":1000000000,"sessions_conns":["*internal"],"stats_conns":[],"thresholds_conns":[],"timezone":""},"stats":{"ees_conns":[],"ees_exporter_ids":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"opts":{"*profileIDs":[],"*profileIgnoreFilters":false},"prefix_indexed_fields":[],"store_interval":"","store_uncompressed_limit":0,"suffix_indexed_fields":[],"thresholds_conns":[]},"stor_db":{"db_host":"127.0.0.1","db_name":"cgrates","db_password":"CGRateS.org","db_port":3306,"db_type":"*mysql","db_user":"cgrates","items":{"*cdrs":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*session_costs":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_account_actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_action_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_action_triggers":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_attributes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_chargers":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_destination_rates":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_destinations":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_dispatcher_hosts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_dispatcher_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_filters":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_ips":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_rankings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_rates":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_rating_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_rating_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_resources":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_routes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_shared_groups":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_stats":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_thresholds":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_timings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_trends":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*versions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"internalDBBackupPath":"/var/lib/cgrates/internal_db/backup/stordb","internalDBDumpInterval":"0s","internalDBDumpPath":"/var/lib/cgrates/internal_db/stordb","internalDBFileSizeLimit":1073741824,"internalDBRewriteInterval":"0s","internalDBStartTimeout":"5m0s","mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","mysqlDSNParams":{},"mysqlLocation":"Local","pgSSLMode":"disable","pgSchema":"","sqlConnMaxLifetime":"0s","sqlLogLevel":3,"sqlMaxIdleConns":10,"sqlMaxOpenConns":100},"prefix_indexed_fields":[],"remote_conns":null,"replication_conns":null,"string_indexed_fields":[]},"suretax":{"bill_to_number":"","business_unit":"","client_number":"","client_tracking":"~*req.CGRID","customer_number":"~*req.Subject","include_local_cost":false,"orig_number":"~*req.Subject","p2pplus4":"","p2pzipcode":"","plus4":"","regulatory_code":"03","response_group":"03","response_type":"D4","return_file_code":"0","sales_type_code":"R","tax_exemption_code_list":"","tax_included":"0","tax_situs_rule":"04","term_number":"~*req.Destination","timezone":"UTC","trans_type_code":"010101","unit_type":"00","units":"1","url":"","validation_key":"","zipcode":""},"templates":{"*asr":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"}],"*cca":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"path":"*rep.Result-Code","tag":"ResultCode","type":"*constant","value":"2001"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"},{"mandatory":true,"path":"*rep.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"mandatory":true,"path":"*rep.CC-Request-Type","tag":"CCRequestType","type":"*variable","value":"~*req.CC-Request-Type"},{"mandatory":true,"path":"*rep.CC-Request-Number","tag":"CCRequestNumber","type":"*variable","value":"~*req.CC-Request-Number"}],"*cdrLog":[{"mandatory":true,"path":"*cdr.ToR","tag":"ToR","type":"*variable","value":"~*req.BalanceType"},{"mandatory":true,"path":"*cdr.OriginHost","tag":"OriginHost","type":"*constant","value":"127.0.0.1"},{"mandatory":true,"path":"*cdr.RequestType","tag":"RequestType","type":"*constant","value":"*none"},{"mandatory":true,"path":"*cdr.Tenant","tag":"Tenant","type":"*variable","value":"~*req.Tenant"},{"mandatory":true,"path":"*cdr.Account","tag":"Account","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Subject","tag":"Subject","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Cost","tag":"Cost","type":"*variable","value":"~*req.Cost"},{"mandatory":true,"path":"*cdr.Source","tag":"Source","type":"*constant","value":"*cdrLog"},{"mandatory":true,"path":"*cdr.Usage","tag":"Usage","type":"*constant","value":"1"},{"mandatory":true,"path":"*cdr.RunID","tag":"RunID","type":"*variable","value":"~*req.ActionType"},{"mandatory":true,"path":"*cdr.SetupTime","tag":"SetupTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.AnswerTime","tag":"AnswerTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.PreRated","tag":"PreRated","type":"*constant","value":"true"}],"*coa":[{"path":"*radDAReq.User-Name","tag":"User-Name","type":"*variable","value":"~*oreq.User-Name"},{"path":"*radDAReq.NAS-IP-Address","tag":"NAS-IP-Address","type":"*variable","value":"~*oreq.NAS-IP-Address"},{"path":"*radDAReq.Acct-Session-Id","tag":"Acct-Session-Id","type":"*variable","value":"~*oreq.Acct-Session-Id"},{"path":"*radDAReq.Filter-Id","tag":"Filter-Id","type":"*variable","value":"~*req.CustomFilter"}],"*dmr":[{"path":"*radDAReq.User-Name","tag":"User-Name","type":"*variable","value":"~*oreq.User-Name"},{"path":"*radDAReq.NAS-IP-Address","tag":"NAS-IP-Address","type":"*variable","value":"~*oreq.NAS-IP-Address"},{"path":"*radDAReq.Acct-Session-Id","tag":"Acct-Session-Id","type":"*variable","value":"~*oreq.Acct-Session-Id"},{"path":"*radDAReq.Reply-Message","tag":"Reply-Message","type":"*variable","value":"~*req.DisconnectCause"}],"*err":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"}],"*errSip":[{"mandatory":true,"path":"*rep.Request","tag":"Request","type":"*constant","value":"SIP/2.0 500 Internal Server Error"}],"*rar":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"path":"*diamreq.Re-Auth-Request-Type","tag":"ReAuthRequestType","type":"*constant","value":"0"}]},"thresholds":{"ees_conns":[],"ees_exporter_ids":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"opts":{"*profileIDs":[],"*profileIgnoreFilters":false},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[]},"tls":{"ca_certificate":"","client_certificate":"","client_key":"","server_certificate":"","server_key":"","server_name":"","server_policy":4},"trends":{"ees_conns":[],"ees_exporter_ids":[],"enabled":false,"scheduled_ids":{},"stats_conns":[],"store_interval":"","store_uncompressed_limit":0,"thresholds_conns":[]}}` + expected := `{"analyzers":{"cleanup_interval":"1h0m0s","db_path":"/var/spool/cgrates/analyzers","enabled":false,"index_type":"*scorch","ttl":"24h0m0s"},"apiban":{"keys":[]},"apiers":{"attributes_conns":[],"caches_conns":["*internal"],"ees_conns":[],"enabled":false,"scheduler_conns":[]},"asterisk_agent":{"asterisk_conns":[{"address":"127.0.0.1:8088","alias":"","connect_attempts":3,"max_reconnect_interval":"0s","password":"CGRateS.org","reconnects":5,"user":"cgrates"}],"create_cdr":false,"enabled":false,"route_profile":false,"sessions_conns":["*birpc_internal"]},"attributes":{"any_context":true,"apiers_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"opts":{"*processRuns":1,"*profileIDs":[],"*profileIgnoreFilters":false,"*profileRuns":0},"prefix_indexed_fields":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"caches":{"partitions":{"*account_action_plans":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_plans":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_triggers":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*actions":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*apiban":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2m0s"},"*attribute_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*caps_events":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*cdr_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10m0s"},"*charger_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*closed_sessions":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*destinations":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*diameter_messages":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*dispatcher_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_hosts":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_loads":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_routes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatchers":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*event_charges":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*event_ips":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*event_resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ip_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ip_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ips":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*radius_packets":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*ranking_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rating_plans":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rating_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*replication_hosts":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*reverse_destinations":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_connections":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_responses":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2s"},"*sentrypeer":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":true,"ttl":"24h0m0s"},"*shared_groups":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*stat_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*stir":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*threshold_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*timings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*trend_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*uch":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"}},"remote_conns":[],"replication_conns":[]},"cdrs":{"attributes_conns":[],"chargers_conns":[],"compress_stored_cost":false,"ees_conns":[],"enabled":false,"extra_fields":[],"online_cdr_exports":[],"rals_conns":[],"scheduler_conns":[],"session_cost_retries":5,"stats_conns":[],"store_cdrs":true,"thresholds_conns":[]},"chargers":{"attributes_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"suffix_indexed_fields":[]},"configs":{"enabled":false,"root_dir":"/var/spool/cgrates/configs","url":"/configs/"},"cores":{"caps":0,"caps_stats_interval":"0","caps_strategy":"*busy","shutdown_timeout":"1s"},"data_db":{"db_host":"127.0.0.1","db_name":"10","db_password":"","db_port":6379,"db_type":"*redis","db_user":"cgrates","items":{"*account_action_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_triggers":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*destinations":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_hosts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ip_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ip_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ips":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ranking_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rating_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rating_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*reverse_destinations":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*sessions_backup":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*shared_groups":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*stat_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*timings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*trend_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*versions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"internalDBBackupPath":"/var/lib/cgrates/internal_db/backup/datadb","internalDBDumpInterval":"0s","internalDBDumpPath":"/var/lib/cgrates/internal_db/datadb","internalDBFileSizeLimit":1073741824,"internalDBRewriteInterval":"0s","internalDBStartTimeout":"5m0s","mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisPoolPipelineLimit":0,"redisPoolPipelineWindow":"150µs","redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_failed_dir":"","replication_filtered":false,"replication_interval":"0s"},"diameter_agent":{"asr_template":"","conn_health_check_interval":"0s","conn_status_stat_queue_ids":[],"conn_status_threshold_ids":[],"dictionaries_path":"/usr/share/cgrates/diameter/dict/","enabled":false,"forced_disconnect":"*none","listen":"127.0.0.1:3868","listen_net":"tcp","origin_host":"CGR-DA","origin_realm":"cgrates.org","product_name":"CGRateS","rar_template":"","request_processors":[],"sessions_conns":["*birpc_internal"],"stats_conns":[],"synced_conn_requests":false,"thresholds_conns":[],"vendor_id":0},"dispatchers":{"any_subsystem":true,"attributes_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"prevent_loop":false,"suffix_indexed_fields":[]},"dns_agent":{"enabled":false,"listeners":[{"address":"127.0.0.1:53","network":"udp"}],"request_processors":[],"sessions_conns":["*internal"],"stats_conns":[],"thresholds_conns":[],"timezone":""},"ees":{"attributes_conns":[],"cache":{"*amqp_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*amqpv1_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*els":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*file_csv":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*kafka_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*nats_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*s3_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*sql":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*sqs_json_map":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false}},"enabled":false,"exporters":[{"attempts":1,"attribute_context":"","attribute_ids":[],"concurrent_requests":0,"export_path":"/var/spool/cgrates/ees","failed_posts_dir":"/var/spool/cgrates/failed_posts","fields":[],"filters":[],"flags":[],"id":"*default","metrics_reset_schedule":"","opts":{},"synchronous":false,"timezone":"","type":"*none"}],"failed_posts":{"dir":"/var/spool/cgrates/failed_posts","static_ttl":true,"ttl":"5s"}},"ers":{"concurrent_events":1,"ees_conns":[],"enabled":false,"partial_cache_ttl":"1s","readers":[{"cache_dump_fields":[],"concurrent_requests":1024,"fields":[{"mandatory":true,"path":"*cgreq.ToR","tag":"ToR","type":"*variable","value":"~*req.2"},{"mandatory":true,"path":"*cgreq.OriginID","tag":"OriginID","type":"*variable","value":"~*req.3"},{"mandatory":true,"path":"*cgreq.RequestType","tag":"RequestType","type":"*variable","value":"~*req.4"},{"mandatory":true,"path":"*cgreq.Tenant","tag":"Tenant","type":"*variable","value":"~*req.6"},{"mandatory":true,"path":"*cgreq.Category","tag":"Category","type":"*variable","value":"~*req.7"},{"mandatory":true,"path":"*cgreq.Account","tag":"Account","type":"*variable","value":"~*req.8"},{"mandatory":true,"path":"*cgreq.Subject","tag":"Subject","type":"*variable","value":"~*req.9"},{"mandatory":true,"path":"*cgreq.Destination","tag":"Destination","type":"*variable","value":"~*req.10"},{"mandatory":true,"path":"*cgreq.SetupTime","tag":"SetupTime","type":"*variable","value":"~*req.11"},{"mandatory":true,"path":"*cgreq.AnswerTime","tag":"AnswerTime","type":"*variable","value":"~*req.12"},{"mandatory":true,"path":"*cgreq.Usage","tag":"Usage","type":"*variable","value":"~*req.13"}],"filters":[],"flags":[],"id":"*default","max_reconnect_interval":"5m0s","opts":{"csvFieldSeparator":",","csvHeaderDefineChar":":","csvRowLength":0,"natsSubject":"cgrates_cdrs","partialCacheAction":"*none","partialOrderField":"~*req.AnswerTime"},"partial_commit_fields":[],"processed_path":"/var/spool/cgrates/ers/out","reconnects":-1,"run_delay":"0","source_path":"/var/spool/cgrates/ers/in","start_delay":"0","tenant":"","timezone":"","type":"*none"}],"sessions_conns":["*internal"],"stats_conns":[],"thresholds_conns":[]},"filters":{"apiers_conns":[],"rankings_conns":[],"resources_conns":[],"stats_conns":[],"trends_conns":[]},"freeswitch_agent":{"active_session_delimiter":",","create_cdr":false,"empty_balance_ann_file":"","empty_balance_context":"","enabled":false,"event_socket_conns":[{"address":"127.0.0.1:8021","alias":"127.0.0.1:8021","max_reconnect_interval":"0s","password":"ClueCon","reconnects":5,"reply_timeout":"1m0s"}],"extra_fields":"","low_balance_ann_file":"","max_wait_connection":"2s","route_profile":false,"sched_transfer_extension":"CGRateS","sessions_conns":["*birpc_internal"],"subscribe_park":true},"general":{"caching_delay":"0","connect_attempts":5,"connect_timeout":"1s","dbdata_encoding":"*msgpack","default_caching":"*reload","default_category":"call","default_request_type":"*rated","default_tenant":"cgrates.org","default_timezone":"Local","digest_equal":":","digest_separator":",","locking_timeout":"0","log_level":6,"logger":"*syslog","max_parallel_conns":100,"max_reconnect_interval":"0","node_id":"ENGINE1","poster_attempts":3,"reconnects":-1,"reply_timeout":"2s","rounding_decimals":5,"rsr_separator":";","tpexport_dir":"/var/spool/cgrates/tpe"},"http":{"auth_users":{},"client_opts":{"dialFallbackDelay":"300ms","dialKeepAlive":"30s","dialTimeout":"30s","disableCompression":false,"disableKeepAlives":false,"expectContinueTimeout":"0s","forceAttemptHttp2":true,"idleConnTimeout":"1m30s","maxConnsPerHost":0,"maxIdleConns":100,"maxIdleConnsPerHost":2,"responseHeaderTimeout":"0s","skipTlsVerify":false,"tlsHandshakeTimeout":"10s"},"freeswitch_cdrs_url":"/freeswitch_json","http_cdrs":"/cdr_http","json_rpc_url":"/jsonrpc","pprof_path":"/debug/pprof/","registrars_url":"/registrar","use_basic_auth":false,"ws_url":"/ws"},"http_agent":[],"ips":{"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"opts":{"*units":1,"*usageID":""},"prefix_indexed_fields":[],"store_interval":"0s","string_indexed_fields":null,"suffix_indexed_fields":[]},"kamailio_agent":{"create_cdr":false,"enabled":false,"evapi_conns":[{"address":"127.0.0.1:8448","alias":"","max_reconnect_interval":"0s","reconnects":5}],"route_profile":false,"sessions_conns":["*birpc_internal"],"timezone":""},"listen":{"http":"127.0.0.1:2080","http_tls":"127.0.0.1:2280","rpc_gob":"127.0.0.1:2013","rpc_gob_tls":"127.0.0.1:2023","rpc_json":"127.0.0.1:2012","rpc_json_tls":"127.0.0.1:2022"},"loader":{"caches_conns":["*localhost"],"data_path":"./","disable_reverse":false,"field_separator":",","gapi_credentials":".gapi/credentials.json","gapi_token":".gapi/token.json","scheduler_conns":["*localhost"],"tpid":""},"loaders":[{"caches_conns":["*internal"],"data":[{"fields":[{"mandatory":true,"path":"Tenant","tag":"TenantID","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ProfileID","type":"*variable","value":"~*req.1"},{"path":"Contexts","tag":"Contexts","type":"*variable","value":"~*req.2"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.3"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.4"},{"path":"AttributeFilterIDs","tag":"AttributeFilterIDs","type":"*variable","value":"~*req.5"},{"path":"Path","tag":"Path","type":"*variable","value":"~*req.6"},{"path":"Type","tag":"Type","type":"*variable","value":"~*req.7"},{"path":"Value","tag":"Value","type":"*variable","value":"~*req.8"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.9"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.10"}],"file_name":"Attributes.csv","flags":null,"type":"*attributes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Type","tag":"Type","type":"*variable","value":"~*req.2"},{"path":"Element","tag":"Element","type":"*variable","value":"~*req.3"},{"path":"Values","tag":"Values","type":"*variable","value":"~*req.4"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.5"}],"file_name":"Filters.csv","flags":null,"type":"*filters"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"UsageTTL","tag":"TTL","type":"*variable","value":"~*req.4"},{"path":"Limit","tag":"Limit","type":"*variable","value":"~*req.5"},{"path":"AllocationMessage","tag":"AllocationMessage","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.9"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.10"}],"file_name":"Resources.csv","flags":null,"type":"*resources"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.4"},{"path":"Type","tag":"Type","type":"*variable","value":"~*req.5"},{"path":"AddressPool","tag":"AddressPool","type":"*variable","value":"~*req.6"},{"path":"Allocation","tag":"Allocation","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.9"}],"file_name":"IPs.csv","flags":null,"type":"*ips"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"QueueLength","tag":"QueueLength","type":"*variable","value":"~*req.4"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.5"},{"path":"MinItems","tag":"MinItems","type":"*variable","value":"~*req.6"},{"path":"MetricIDs","tag":"MetricIDs","type":"*variable","value":"~*req.7"},{"path":"MetricFilterIDs","tag":"MetricFilterIDs","type":"*variable","value":"~*req.8"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.9"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.10"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.11"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.12"}],"file_name":"Stats.csv","flags":null,"type":"*stats"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"MaxHits","tag":"MaxHits","type":"*variable","value":"~*req.4"},{"path":"MinHits","tag":"MinHits","type":"*variable","value":"~*req.5"},{"path":"MinSleep","tag":"MinSleep","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.8"},{"path":"ActionIDs","tag":"ActionIDs","type":"*variable","value":"~*req.9"},{"path":"Async","tag":"Async","type":"*variable","value":"~*req.10"}],"file_name":"Thresholds.csv","flags":null,"type":"*thresholds"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.4"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.5"},{"path":"RouteID","tag":"RouteID","type":"*variable","value":"~*req.6"},{"path":"RouteFilterIDs","tag":"RouteFilterIDs","type":"*variable","value":"~*req.7"},{"path":"RouteAccountIDs","tag":"RouteAccountIDs","type":"*variable","value":"~*req.8"},{"path":"RouteRatingPlanIDs","tag":"RouteRatingPlanIDs","type":"*variable","value":"~*req.9"},{"path":"RouteResourceIDs","tag":"RouteResourceIDs","type":"*variable","value":"~*req.10"},{"path":"RouteStatIDs","tag":"RouteStatIDs","type":"*variable","value":"~*req.11"},{"path":"RouteWeight","tag":"RouteWeight","type":"*variable","value":"~*req.12"},{"path":"RouteBlocker","tag":"RouteBlocker","type":"*variable","value":"~*req.13"},{"path":"RouteParameters","tag":"RouteParameters","type":"*variable","value":"~*req.14"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.15"}],"file_name":"Routes.csv","flags":null,"type":"*routes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"RunID","tag":"RunID","type":"*variable","value":"~*req.4"},{"path":"AttributeIDs","tag":"AttributeIDs","type":"*variable","value":"~*req.5"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.6"}],"file_name":"Chargers.csv","flags":null,"type":"*chargers"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Contexts","tag":"Contexts","type":"*variable","value":"~*req.2"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.3"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.4"},{"path":"Strategy","tag":"Strategy","type":"*variable","value":"~*req.5"},{"path":"StrategyParameters","tag":"StrategyParameters","type":"*variable","value":"~*req.6"},{"path":"ConnID","tag":"ConnID","type":"*variable","value":"~*req.7"},{"path":"ConnFilterIDs","tag":"ConnFilterIDs","type":"*variable","value":"~*req.8"},{"path":"ConnWeight","tag":"ConnWeight","type":"*variable","value":"~*req.9"},{"path":"ConnBlocker","tag":"ConnBlocker","type":"*variable","value":"~*req.10"},{"path":"ConnParameters","tag":"ConnParameters","type":"*variable","value":"~*req.11"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.12"}],"file_name":"DispatcherProfiles.csv","flags":null,"type":"*dispatchers"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Address","tag":"Address","type":"*variable","value":"~*req.2"},{"path":"Transport","tag":"Transport","type":"*variable","value":"~*req.3"},{"path":"ConnectAttempts","tag":"ConnectAttempts","type":"*variable","value":"~*req.4"},{"path":"Reconnects","tag":"Reconnects","type":"*variable","value":"~*req.5"},{"path":"MaxReconnectInterval","tag":"MaxReconnectInterval","type":"*variable","value":"~*req.6"},{"path":"ConnectTimeout","tag":"ConnectTimeout","type":"*variable","value":"~*req.7"},{"path":"ReplyTimeout","tag":"ReplyTimeout","type":"*variable","value":"~*req.8"},{"path":"TLS","tag":"TLS","type":"*variable","value":"~*req.9"},{"path":"ClientKey","tag":"ClientKey","type":"*variable","value":"~*req.10"},{"path":"ClientCertificate","tag":"ClientCertificate","type":"*variable","value":"~*req.11"},{"path":"CaCertificate","tag":"CaCertificate","type":"*variable","value":"~*req.12"}],"file_name":"DispatcherHosts.csv","flags":null,"type":"*dispatcher_hosts"}],"dry_run":false,"enabled":false,"field_separator":",","id":"*default","lockfile_path":".cgr.lck","run_delay":"0","tenant":"","tp_in_dir":"/var/spool/cgrates/loader/in","tp_out_dir":"/var/spool/cgrates/loader/out"}],"mailer":{"auth_password":"CGRateS.org","auth_user":"cgrates","from_address":"cgr-mailer@localhost.localdomain","server":"localhost"},"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"mongoConnScheme":"mongodb","mongoQueryTimeout":"0s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisPoolPipelineLimit":0,"redisPoolPipelineWindow":"150µs","redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"out_datadb_password":"","out_datadb_port":"6379","out_datadb_type":"*redis","out_datadb_user":"cgrates","out_stordb_host":"127.0.0.1","out_stordb_name":"cgrates","out_stordb_opts":{"mongoConnScheme":"mongodb","mongoQueryTimeout":"0s","mysqlDSNParams":null,"mysqlLocation":"","pgSSLMode":"","sqlConnMaxLifetime":"0s","sqlMaxIdleConns":0,"sqlMaxOpenConns":0},"out_stordb_password":"","out_stordb_port":"3306","out_stordb_type":"*mysql","out_stordb_user":"cgrates","users_filters":null},"prometheus_agent":{"apiers_conns":[],"cache_ids":[],"caches_conns":[],"collect_go_metrics":false,"collect_process_metrics":false,"cores_conns":[],"enabled":false,"path":"/prometheus","stat_queue_ids":[],"stats_conns":[]},"radius_agent":{"client_dictionaries":{"*default":["/usr/share/cgrates/radius/dict/"]},"client_secrets":{"*default":"CGRateS.org"},"coa_template":"*coa","dmr_template":"*dmr","enabled":false,"listeners":[{"acct_address":"127.0.0.1:1813","auth_address":"127.0.0.1:1812","network":"udp"}],"request_processors":[],"requests_cache_key":"","sessions_conns":["*internal"],"stats_conns":[],"thresholds_conns":[]},"rals":{"balance_rating_subject":{"*any":"*zero1ns","*voice":"*zero1s"},"enabled":false,"fallback_depth":3,"max_computed_usage":{"*any":"189h0m0s","*data":"107374182400","*mms":"10000","*sms":"10000","*voice":"72h0m0s"},"max_increments":1000000,"remove_expired":true,"rp_subject_prefix_matching":false,"sessions_conns":[],"stats_conns":[],"thresholds_conns":[]},"rankings":{"ees_conns":[],"ees_exporter_ids":[],"enabled":false,"scheduled_ids":{},"stats_conns":[],"store_interval":"","thresholds_conns":[]},"registrarc":{"dispatchers":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]},"rpc":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]}},"resources":{"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"opts":{"*units":1,"*usageID":""},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[],"thresholds_conns":[]},"routes":{"attributes_conns":[],"default_ratio":1,"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"opts":{"*context":"*routes","*ignoreErrors":false,"*maxCost":""},"prefix_indexed_fields":[],"rals_conns":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"rpc_conns":{"*bijson_localhost":{"conns":[{"address":"127.0.0.1:2014","transport":"*birpc_json"}],"poolSize":0,"strategy":"*first"},"*birpc_internal":{"conns":[{"address":"*birpc_internal","transport":""}],"poolSize":0,"strategy":"*first"},"*internal":{"conns":[{"address":"*internal","transport":""}],"poolSize":0,"strategy":"*first"},"*localhost":{"conns":[{"address":"127.0.0.1:2012","transport":"*json"}],"poolSize":0,"strategy":"*first"}},"schedulers":{"cdrs_conns":[],"dynaprepaid_actionplans":[],"enabled":false,"filters":[],"stats_conns":[],"thresholds_conns":[]},"sentrypeer":{"Audience":"https://sentrypeer.com/api","ClientID":"","ClientSecret":"","GrantType":"client_credentials","IpUrl":"https://sentrypeer.com/api/ip-addresses","NumberUrl":"https://sentrypeer.com/api/phone-numbers","TokenURL":"https://authz.sentrypeer.com/oauth/token"},"sessions":{"alterable_fields":[],"attributes_conns":[],"backup_interval":"0","cdrs_conns":[],"channel_sync_interval":"0","chargers_conns":[],"client_protocol":2,"debit_interval":"0","default_usage":{"*any":"3h0m0s","*data":"1048576","*sms":"1","*voice":"3h0m0s"},"enabled":false,"listen_bigob":"","listen_bijson":"127.0.0.1:2014","min_dur_low_balance":"0","rals_conns":[],"replication_conns":[],"resources_conns":[],"routes_conns":[],"scheduler_conns":[],"session_indexes":[],"session_ttl":"0","stale_chan_max_extra_usage":"0","stats_conns":[],"stir":{"allowed_attest":["*any"],"default_attest":"A","payload_maxduration":"-1","privatekey_path":"","publickey_path":""},"store_session_costs":false,"terminate_attempts":5,"thresholds_conns":[]},"sip_agent":{"enabled":false,"listen":"127.0.0.1:5060","listen_net":"udp","request_processors":[],"retransmission_timer":1000000000,"sessions_conns":["*internal"],"stats_conns":[],"thresholds_conns":[],"timezone":""},"stats":{"ees_conns":[],"ees_exporter_ids":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"opts":{"*profileIDs":[],"*profileIgnoreFilters":false},"prefix_indexed_fields":[],"store_interval":"","store_uncompressed_limit":0,"suffix_indexed_fields":[],"thresholds_conns":[]},"stor_db":{"db_host":"127.0.0.1","db_name":"cgrates","db_password":"CGRateS.org","db_port":3306,"db_type":"*mysql","db_user":"cgrates","items":{"*cdrs":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*session_costs":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_account_actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_action_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_action_triggers":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_attributes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_chargers":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_destination_rates":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_destinations":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_dispatcher_hosts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_dispatcher_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_filters":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_ips":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_rankings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_rates":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_rating_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_rating_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_resources":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_routes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_shared_groups":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_stats":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_thresholds":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_timings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_trends":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*versions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"internalDBBackupPath":"/var/lib/cgrates/internal_db/backup/stordb","internalDBDumpInterval":"0s","internalDBDumpPath":"/var/lib/cgrates/internal_db/stordb","internalDBFileSizeLimit":1073741824,"internalDBRewriteInterval":"0s","internalDBStartTimeout":"5m0s","mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","mysqlDSNParams":{},"mysqlLocation":"Local","pgSSLMode":"disable","pgSchema":"","sqlConnMaxLifetime":"0s","sqlLogLevel":3,"sqlMaxIdleConns":10,"sqlMaxOpenConns":100},"prefix_indexed_fields":[],"remote_conns":null,"replication_conns":null,"string_indexed_fields":[]},"suretax":{"bill_to_number":"","business_unit":"","client_number":"","client_tracking":"~*req.CGRID","customer_number":"~*req.Subject","include_local_cost":false,"orig_number":"~*req.Subject","p2pplus4":"","p2pzipcode":"","plus4":"","regulatory_code":"03","response_group":"03","response_type":"D4","return_file_code":"0","sales_type_code":"R","tax_exemption_code_list":"","tax_included":"0","tax_situs_rule":"04","term_number":"~*req.Destination","timezone":"UTC","trans_type_code":"010101","unit_type":"00","units":"1","url":"","validation_key":"","zipcode":""},"templates":{"*asr":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"}],"*cca":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"path":"*rep.Result-Code","tag":"ResultCode","type":"*constant","value":"2001"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"},{"mandatory":true,"path":"*rep.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"mandatory":true,"path":"*rep.CC-Request-Type","tag":"CCRequestType","type":"*variable","value":"~*req.CC-Request-Type"},{"mandatory":true,"path":"*rep.CC-Request-Number","tag":"CCRequestNumber","type":"*variable","value":"~*req.CC-Request-Number"}],"*cdrLog":[{"mandatory":true,"path":"*cdr.ToR","tag":"ToR","type":"*variable","value":"~*req.BalanceType"},{"mandatory":true,"path":"*cdr.OriginHost","tag":"OriginHost","type":"*constant","value":"127.0.0.1"},{"mandatory":true,"path":"*cdr.RequestType","tag":"RequestType","type":"*constant","value":"*none"},{"mandatory":true,"path":"*cdr.Tenant","tag":"Tenant","type":"*variable","value":"~*req.Tenant"},{"mandatory":true,"path":"*cdr.Account","tag":"Account","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Subject","tag":"Subject","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Cost","tag":"Cost","type":"*variable","value":"~*req.Cost"},{"mandatory":true,"path":"*cdr.Source","tag":"Source","type":"*constant","value":"*cdrLog"},{"mandatory":true,"path":"*cdr.Usage","tag":"Usage","type":"*constant","value":"1"},{"mandatory":true,"path":"*cdr.RunID","tag":"RunID","type":"*variable","value":"~*req.ActionType"},{"mandatory":true,"path":"*cdr.SetupTime","tag":"SetupTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.AnswerTime","tag":"AnswerTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.PreRated","tag":"PreRated","type":"*constant","value":"true"}],"*coa":[{"path":"*radDAReq.User-Name","tag":"User-Name","type":"*variable","value":"~*oreq.User-Name"},{"path":"*radDAReq.NAS-IP-Address","tag":"NAS-IP-Address","type":"*variable","value":"~*oreq.NAS-IP-Address"},{"path":"*radDAReq.Acct-Session-Id","tag":"Acct-Session-Id","type":"*variable","value":"~*oreq.Acct-Session-Id"},{"path":"*radDAReq.Filter-Id","tag":"Filter-Id","type":"*variable","value":"~*req.CustomFilter"}],"*dmr":[{"path":"*radDAReq.User-Name","tag":"User-Name","type":"*variable","value":"~*oreq.User-Name"},{"path":"*radDAReq.NAS-IP-Address","tag":"NAS-IP-Address","type":"*variable","value":"~*oreq.NAS-IP-Address"},{"path":"*radDAReq.Acct-Session-Id","tag":"Acct-Session-Id","type":"*variable","value":"~*oreq.Acct-Session-Id"},{"path":"*radDAReq.Reply-Message","tag":"Reply-Message","type":"*variable","value":"~*req.DisconnectCause"}],"*err":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"}],"*errSip":[{"mandatory":true,"path":"*rep.Request","tag":"Request","type":"*constant","value":"SIP/2.0 500 Internal Server Error"}],"*rar":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"path":"*diamreq.Re-Auth-Request-Type","tag":"ReAuthRequestType","type":"*constant","value":"0"}]},"thresholds":{"ees_conns":[],"ees_exporter_ids":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"opts":{"*profileIDs":[],"*profileIgnoreFilters":false},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[]},"tls":{"ca_certificate":"","client_certificate":"","client_key":"","server_certificate":"","server_key":"","server_name":"","server_policy":4},"trends":{"ees_conns":[],"ees_exporter_ids":[],"enabled":false,"scheduled_ids":{},"stats_conns":[],"store_interval":"","store_uncompressed_limit":0,"thresholds_conns":[]}}` if err != nil { t.Fatal(err) } @@ -5572,6 +5575,11 @@ func TestCgrCdfEventExporter(t *testing.T) { StaticTTL: false, }, }, + FailedPosts: &FailedPostsCfg{ + Dir: "/var/spool/cgrates/failed_posts", + TTL: 5 * time.Second, + StaticTTL: true, + }, Exporters: []*EventExporterCfg{ { ID: utils.MetaDefault, @@ -6021,7 +6029,7 @@ func TestCGRConfigGetDP(t *testing.T) { exp := utils.MapStorage(cfg.AsMapInterface(cfg.generalCfg.RSRSep)) dp := cfg.GetDataProvider() if !reflect.DeepEqual(dp, exp) { - t.Errorf("Expected %+v, received %+v", exp, dp) + t.Errorf("Expected %s, received %s", utils.ToJSON(exp), utils.ToJSON(dp)) } } diff --git a/config/eescfg.go b/config/eescfg.go index 6d7359c0b..f69d87aa9 100644 --- a/config/eescfg.go +++ b/config/eescfg.go @@ -29,14 +29,15 @@ type EEsCfg struct { Enabled bool AttributeSConns []string Cache map[string]*CacheParamCfg + FailedPosts *FailedPostsCfg Exporters []*EventExporterCfg } // ExporterCfg iterates over the Exporters slice and returns the exporter // configuration associated with the specified "id". If none were found, the // method will return nil. -func (eeS *EEsCfg) ExporterCfg(id string) *EventExporterCfg { - for _, eeCfg := range eeS.Exporters { +func (c *EEsCfg) ExporterCfg(id string) *EventExporterCfg { + for _, eeCfg := range c.Exporters { if eeCfg.ID == id { return eeCfg } @@ -44,43 +45,46 @@ func (eeS *EEsCfg) ExporterCfg(id string) *EventExporterCfg { return nil } -func (eeS *EEsCfg) loadFromJSONCfg(jsnCfg *EEsJsonCfg, msgTemplates map[string][]*FCTemplate, sep string, dfltExpCfg *EventExporterCfg) (err error) { - if jsnCfg == nil { - return +func (c *EEsCfg) loadFromJSONCfg(jc *EEsJsonCfg, msgTemplates map[string][]*FCTemplate, sep string, dfltExpCfg *EventExporterCfg) error { + if jc == nil { + return nil } - if jsnCfg.Enabled != nil { - eeS.Enabled = *jsnCfg.Enabled + if jc.Enabled != nil { + c.Enabled = *jc.Enabled } - if jsnCfg.Cache != nil { - for kJsn, vJsn := range *jsnCfg.Cache { + if jc.Cache != nil { + for kJsn, vJsn := range *jc.Cache { val := new(CacheParamCfg) if err := val.loadFromJSONCfg(vJsn); err != nil { return err } - eeS.Cache[kJsn] = val + c.Cache[kJsn] = val } } - if jsnCfg.Attributes_conns != nil { - eeS.AttributeSConns = make([]string, len(*jsnCfg.Attributes_conns)) - for i, fID := range *jsnCfg.Attributes_conns { + if jc.AttributeSConns != nil { + c.AttributeSConns = make([]string, len(*jc.AttributeSConns)) + for i, fID := range *jc.AttributeSConns { // if we have the connection internal we change the name so we can have internal rpc for each subsystem - eeS.AttributeSConns[i] = fID + c.AttributeSConns[i] = fID if fID == utils.MetaInternal { - eeS.AttributeSConns[i] = utils.ConcatenatedKey(utils.MetaInternal, utils.MetaAttributes) + c.AttributeSConns[i] = utils.ConcatenatedKey(utils.MetaInternal, utils.MetaAttributes) } } } - return eeS.appendEEsExporters(jsnCfg.Exporters, msgTemplates, sep, dfltExpCfg) + if err := c.FailedPosts.loadFromJSONCfg(jc.FailedPosts); err != nil { + return err + } + return c.appendEEsExporters(jc.Exporters, msgTemplates, sep, dfltExpCfg) } -func (eeS *EEsCfg) appendEEsExporters(exporters *[]*EventExporterJsonCfg, msgTemplates map[string][]*FCTemplate, separator string, dfltExpCfg *EventExporterCfg) (err error) { +func (c *EEsCfg) appendEEsExporters(exporters *[]*EventExporterJsonCfg, msgTemplates map[string][]*FCTemplate, separator string, dfltExpCfg *EventExporterCfg) (err error) { if exporters == nil { return } for _, jsnExp := range *exporters { var exp *EventExporterCfg if jsnExp.Id != nil { - for _, exporter := range eeS.Exporters { + for _, exporter := range c.Exporters { if exporter.ID == *jsnExp.Id { exp = exporter break @@ -94,7 +98,7 @@ func (eeS *EEsCfg) appendEEsExporters(exporters *[]*EventExporterJsonCfg, msgTem exp = new(EventExporterCfg) exp.Opts = &EventExporterOpts{} } - eeS.Exporters = append(eeS.Exporters, exp) + c.Exporters = append(c.Exporters, exp) } if err = exp.loadFromJSONCfg(jsnExp, msgTemplates, separator); err != nil { return @@ -104,32 +108,34 @@ func (eeS *EEsCfg) appendEEsExporters(exporters *[]*EventExporterJsonCfg, msgTem } // Clone returns a deep copy of EEsCfg -func (eeS *EEsCfg) Clone() (cln *EEsCfg) { +func (c *EEsCfg) Clone() (cln *EEsCfg) { cln = &EEsCfg{ - Enabled: eeS.Enabled, - AttributeSConns: make([]string, len(eeS.AttributeSConns)), + Enabled: c.Enabled, + AttributeSConns: make([]string, len(c.AttributeSConns)), Cache: make(map[string]*CacheParamCfg), - Exporters: make([]*EventExporterCfg, len(eeS.Exporters)), + FailedPosts: c.FailedPosts.Clone(), + Exporters: make([]*EventExporterCfg, len(c.Exporters)), } - copy(cln.AttributeSConns, eeS.AttributeSConns) - for key, value := range eeS.Cache { + copy(cln.AttributeSConns, c.AttributeSConns) + for key, value := range c.Cache { cln.Cache[key] = value.Clone() } - for idx, exp := range eeS.Exporters { + for idx, exp := range c.Exporters { cln.Exporters[idx] = exp.Clone() } return } // AsMapInterface returns the config as a map[string]any -func (eeS *EEsCfg) AsMapInterface(separator string) (initialMP map[string]any) { +func (c *EEsCfg) AsMapInterface(separator string) (initialMP map[string]any) { initialMP = map[string]any{ - utils.EnabledCfg: eeS.Enabled, + utils.EnabledCfg: c.Enabled, + utils.FailedPostsCfg: c.FailedPosts.AsMapInterface(), } - if eeS.AttributeSConns != nil { - attributeSConns := make([]string, len(eeS.AttributeSConns)) - for i, item := range eeS.AttributeSConns { + if c.AttributeSConns != nil { + attributeSConns := make([]string, len(c.AttributeSConns)) + for i, item := range c.AttributeSConns { attributeSConns[i] = item if item == utils.ConcatenatedKey(utils.MetaInternal, utils.MetaAttributes) { attributeSConns[i] = utils.MetaInternal @@ -137,16 +143,19 @@ func (eeS *EEsCfg) AsMapInterface(separator string) (initialMP map[string]any) { } initialMP[utils.AttributeSConnsCfg] = attributeSConns } - if eeS.Cache != nil { - cache := make(map[string]any, len(eeS.Cache)) - for key, value := range eeS.Cache { + if c.Cache != nil { + cache := make(map[string]any, len(c.Cache)) + for key, value := range c.Cache { cache[key] = value.AsMapInterface() } initialMP[utils.CacheCfg] = cache } - if eeS.Exporters != nil { - exporters := make([]map[string]any, len(eeS.Exporters)) - for i, item := range eeS.Exporters { + if c.FailedPosts != nil { + + } + if c.Exporters != nil { + exporters := make([]map[string]any, len(c.Exporters)) + for i, item := range c.Exporters { exporters[i] = item.AsMapInterface(separator) } initialMP[utils.ExportersCfg] = exporters @@ -154,9 +163,9 @@ func (eeS *EEsCfg) AsMapInterface(separator string) (initialMP map[string]any) { return } -func (eeS *EEsCfg) exporterIDs() []string { - ids := make([]string, 0, len(eeS.Exporters)) - for _, exporter := range eeS.Exporters { +func (c *EEsCfg) exporterIDs() []string { + ids := make([]string, 0, len(c.Exporters)) + for _, exporter := range c.Exporters { ids = append(ids, exporter.ID) } return ids @@ -1320,3 +1329,47 @@ func (eeC *EventExporterCfg) AsMapInterface(separator string) (initialMP map[str } return } + +type FailedPostsCfg struct { + Dir string + TTL time.Duration + StaticTTL bool +} + +func (c *FailedPostsCfg) loadFromJSONCfg(jc *FailedPostsJsonCfg) error { + if jc == nil { + return nil + } + if jc.Dir != nil { + c.Dir = *jc.Dir + } + if jc.TTL != nil { + var err error + if c.TTL, err = utils.ParseDurationWithNanosecs(*jc.TTL); err != nil { + return err + } + } + if jc.StaticTTL != nil { + c.StaticTTL = *jc.StaticTTL + } + return nil +} + +func (c *FailedPostsCfg) Clone() *FailedPostsCfg { + if c == nil { + return nil + } + return &FailedPostsCfg{ + Dir: c.Dir, + TTL: c.TTL, + StaticTTL: c.StaticTTL, + } +} + +func (c *FailedPostsCfg) AsMapInterface() map[string]any { + return map[string]any{ + utils.DirCfg: c.Dir, + utils.TTLCfg: c.TTL.String(), + utils.StaticTTLCfg: c.StaticTTL, + } +} diff --git a/config/eescfg_test.go b/config/eescfg_test.go index dae40b698..13b107c13 100644 --- a/config/eescfg_test.go +++ b/config/eescfg_test.go @@ -179,6 +179,11 @@ func TestEESClone(t *testing.T) { Replicate: false, }, }, + FailedPosts: &FailedPostsCfg{ + Dir: "/var/spool/cgrates/failed_posts", + TTL: 5 * time.Second, + StaticTTL: true, + }, Exporters: []*EventExporterCfg{ { ID: utils.MetaDefault, @@ -589,6 +594,11 @@ func TestEventExporterSameID(t *testing.T) { StaticTTL: false, }, }, + FailedPosts: &FailedPostsCfg{ + Dir: "/tmp/test", + TTL: 3 * time.Second, + StaticTTL: false, + }, Exporters: []*EventExporterCfg{ { ID: utils.MetaDefault, @@ -658,6 +668,11 @@ func TestEventExporterSameID(t *testing.T) { "ees": { "enabled": true, "attributes_conns":["conn1"], + "failed_posts": { + "dir": "/tmp/test", + "ttl": "3s", + "static_ttl": false + }, "exporters": [ { "id": "file_exporter1", @@ -685,8 +700,8 @@ func TestEventExporterSameID(t *testing.T) { func TestEEsCfgloadFromJsonCfgCase1(t *testing.T) { jsonCfg := &EEsJsonCfg{ - Enabled: utils.BoolPointer(true), - Attributes_conns: &[]string{"*conn1", "*conn2"}, + Enabled: utils.BoolPointer(true), + AttributeSConns: &[]string{"*conn1", "*conn2"}, Cache: &map[string]*CacheParamJsonCfg{ utils.MetaFileCSV: { Limit: utils.IntPointer(-2), @@ -759,6 +774,11 @@ func TestEEsCfgloadFromJsonCfgCase1(t *testing.T) { StaticTTL: false, }, }, + FailedPosts: &FailedPostsCfg{ + Dir: "/var/spool/cgrates/failed_posts", + TTL: 5 * time.Second, + StaticTTL: true, + }, Exporters: []*EventExporterCfg{ { ID: utils.MetaDefault, @@ -841,8 +861,8 @@ func TestEEsCfgloadFromJsonCfgCase1(t *testing.T) { func TestEEsCfgloadFromJsonCfgCase2(t *testing.T) { jsonCfg := &EEsJsonCfg{ - Enabled: utils.BoolPointer(true), - Attributes_conns: &[]string{"*conn1", "*conn2"}, + Enabled: utils.BoolPointer(true), + AttributeSConns: &[]string{"*conn1", "*conn2"}, Cache: &map[string]*CacheParamJsonCfg{ utils.MetaFileCSV: { Limit: utils.IntPointer(-2), @@ -920,6 +940,11 @@ func TestEEsCfgloadFromJsonCfgCase2(t *testing.T) { StaticTTL: false, }, }, + FailedPosts: &FailedPostsCfg{ + Dir: "/var/spool/cgrates/failed_posts", + TTL: 5 * time.Second, + StaticTTL: true, + }, Exporters: []*EventExporterCfg{ { ID: utils.MetaDefault, @@ -1196,6 +1221,11 @@ func TestEEsCfgAsMapInterface(t *testing.T) { utils.StaticTTLCfg: false, }, }, + utils.FailedPostsCfg: map[string]any{ + utils.DirCfg: "/var/spool/cgrates/failed_posts", + utils.TTLCfg: "5s", + utils.StaticTTLCfg: true, + }, utils.ExportersCfg: []map[string]any{ { utils.IDCfg: "CSVExporter", diff --git a/config/generalcfg.go b/config/generalcfg.go index e6ae2eb54..481bb80b9 100644 --- a/config/generalcfg.go +++ b/config/generalcfg.go @@ -27,19 +27,17 @@ import ( // GeneralCfg is the general config section type GeneralCfg struct { - NodeID string // Identifier for this engine instance - Logger string // dictates the way logs are displayed/stored - LogLevel int // system wide log level, nothing higher than this will be logged - RoundingDecimals int // Number of decimals to round end prices at - DBDataEncoding string // The encoding used to store object data in strings: - TpExportPath string // Path towards export folder for offline Tariff Plans - PosterAttempts int // Time to wait before writing the failed posts in a single file - FailedPostsDir string // Directory path where we store failed http requests - FailedPostsTTL time.Duration // Directory path where we store failed http requests - DefaultReqType string // Use this request type if not defined on top - DefaultCategory string // set default type of record - DefaultTenant string // set default tenant - DefaultTimezone string // default timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB> + NodeID string // Identifier for this engine instance + Logger string // dictates the way logs are displayed/stored + LogLevel int // system wide log level, nothing higher than this will be logged + RoundingDecimals int // Number of decimals to round end prices at + DBDataEncoding string // The encoding used to store object data in strings: + TpExportPath string // Path towards export folder for offline Tariff Plans + PosterAttempts int // Time to wait before writing the failed posts in a single file + DefaultReqType string // Use this request type if not defined on top + DefaultCategory string // set default type of record + DefaultTenant string // set default tenant + DefaultTimezone string // default timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB> DefaultCaching string CachingDelay time.Duration // use to add delay before cache reload ConnectAttempts int // number of initial connection attempts before giving up @@ -111,14 +109,6 @@ func (gencfg *GeneralCfg) loadFromJSONCfg(jsnGeneralCfg *GeneralJsonCfg) (err er if jsnGeneralCfg.Poster_attempts != nil { gencfg.PosterAttempts = *jsnGeneralCfg.Poster_attempts } - if jsnGeneralCfg.Failed_posts_dir != nil { - gencfg.FailedPostsDir = *jsnGeneralCfg.Failed_posts_dir - } - if jsnGeneralCfg.Failed_posts_ttl != nil { - if gencfg.FailedPostsTTL, err = utils.ParseDurationWithNanosecs(*jsnGeneralCfg.Failed_posts_ttl); err != nil { - return err - } - } if jsnGeneralCfg.Default_timezone != nil { gencfg.DefaultTimezone = *jsnGeneralCfg.Default_timezone } @@ -161,7 +151,6 @@ func (gencfg *GeneralCfg) AsMapInterface() (initialMP map[string]any) { utils.DBDataEncodingCfg: utils.Meta + gencfg.DBDataEncoding, utils.TpExportPathCfg: gencfg.TpExportPath, utils.PosterAttemptsCfg: gencfg.PosterAttempts, - utils.FailedPostsDirCfg: gencfg.FailedPostsDir, utils.DefaultReqTypeCfg: gencfg.DefaultReqType, utils.DefaultCategoryCfg: gencfg.DefaultCategory, utils.DefaultTenantCfg: gencfg.DefaultTenant, @@ -176,7 +165,6 @@ func (gencfg *GeneralCfg) AsMapInterface() (initialMP map[string]any) { utils.RSRSepCfg: gencfg.RSRSep, utils.MaxParallelConnsCfg: gencfg.MaxParallelConns, utils.LockingTimeoutCfg: "0", - utils.FailedPostsTTLCfg: "0", utils.ConnectTimeoutCfg: "0", utils.ReplyTimeoutCfg: "0", } @@ -189,10 +177,6 @@ func (gencfg *GeneralCfg) AsMapInterface() (initialMP map[string]any) { initialMP[utils.LockingTimeoutCfg] = gencfg.LockingTimeout.String() } - if gencfg.FailedPostsTTL != 0 { - initialMP[utils.FailedPostsTTLCfg] = gencfg.FailedPostsTTL.String() - } - if gencfg.ConnectTimeout != 0 { initialMP[utils.ConnectTimeoutCfg] = gencfg.ConnectTimeout.String() } @@ -217,8 +201,6 @@ func (gencfg GeneralCfg) Clone() *GeneralCfg { DBDataEncoding: gencfg.DBDataEncoding, TpExportPath: gencfg.TpExportPath, PosterAttempts: gencfg.PosterAttempts, - FailedPostsDir: gencfg.FailedPostsDir, - FailedPostsTTL: gencfg.FailedPostsTTL, DefaultReqType: gencfg.DefaultReqType, DefaultCategory: gencfg.DefaultCategory, DefaultTenant: gencfg.DefaultTenant, diff --git a/config/generalcfg_test.go b/config/generalcfg_test.go index 35b7b8335..40f3a1b83 100644 --- a/config/generalcfg_test.go +++ b/config/generalcfg_test.go @@ -43,7 +43,6 @@ func TestGeneralCfgloadFromJsonCfg(t *testing.T) { Reply_timeout: utils.StringPointer("2s"), Digest_separator: utils.StringPointer(","), Digest_equal: utils.StringPointer(":"), - Failed_posts_ttl: utils.StringPointer("2"), } expected := &GeneralCfg{ @@ -54,7 +53,6 @@ func TestGeneralCfgloadFromJsonCfg(t *testing.T) { DBDataEncoding: "msgpack", TpExportPath: "/var/spool/cgrates/tpe", PosterAttempts: 3, - FailedPostsDir: "/var/spool/cgrates/failed_posts", DefaultReqType: utils.MetaRated, DefaultCategory: utils.Call, DefaultTenant: "cgrates.org", @@ -68,7 +66,6 @@ func TestGeneralCfgloadFromJsonCfg(t *testing.T) { MaxParallelConns: 100, RSRSep: ";", DefaultCaching: utils.MetaReload, - FailedPostsTTL: 2, } jsnCfg := NewDefaultCGRConfig() if err := jsnCfg.generalCfg.loadFromJSONCfg(cfgJSON); err != nil { @@ -103,18 +100,10 @@ func TestGeneralParseDurationCfgloadFromJsonCfg(t *testing.T) { } cfgJSON2 := &GeneralJsonCfg{ - Failed_posts_ttl: utils.StringPointer("1ss"), - } - jsonCfg = NewDefaultCGRConfig() - if err := jsonCfg.generalCfg.loadFromJSONCfg(cfgJSON2); err == nil || err.Error() != expected { - t.Errorf("Expected %+v, received %v", expected, err) - } - - cfgJSON3 := &GeneralJsonCfg{ Locking_timeout: utils.StringPointer("1ss"), } jsonCfg = NewDefaultCGRConfig() - if err := jsonCfg.generalCfg.loadFromJSONCfg(cfgJSON3); err == nil || err.Error() != expected { + if err := jsonCfg.generalCfg.loadFromJSONCfg(cfgJSON2); err == nil || err.Error() != expected { t.Errorf("Expected %+v, received %v", expected, err) } @@ -130,8 +119,6 @@ func TestGeneralCfgAsMapInterface(t *testing.T) { "dbdata_encoding": "*msgpack", "tpexport_dir": "/var/spool/cgrates/tpe", "poster_attempts": 3, - "failed_posts_dir": "/var/spool/cgrates/failed_posts", - "failed_posts_ttl": "5s", "default_request_type": "*rated", "default_category": "call", "default_tenant": "cgrates.org", @@ -158,8 +145,6 @@ func TestGeneralCfgAsMapInterface(t *testing.T) { utils.DBDataEncodingCfg: "*msgpack", utils.TpExportPathCfg: "/var/spool/cgrates/tpe", utils.PosterAttemptsCfg: 3, - utils.FailedPostsDirCfg: "/var/spool/cgrates/failed_posts", - utils.FailedPostsTTLCfg: "5s", utils.DefaultReqTypeCfg: "*rated", utils.DefaultCategoryCfg: "call", utils.DefaultTenantCfg: "cgrates.org", @@ -189,7 +174,6 @@ func TestGeneralCfgAsMapInterface1(t *testing.T) { "general": { "node_id": "ENGINE1", "locking_timeout": "0", - "failed_posts_ttl": "0s", "connect_timeout": "0s", "reply_timeout": "0s", "max_call_duration": "0" @@ -203,8 +187,6 @@ func TestGeneralCfgAsMapInterface1(t *testing.T) { utils.DBDataEncodingCfg: "*msgpack", utils.TpExportPathCfg: "/var/spool/cgrates/tpe", utils.PosterAttemptsCfg: 3, - utils.FailedPostsDirCfg: "/var/spool/cgrates/failed_posts", - utils.FailedPostsTTLCfg: "0", utils.DefaultReqTypeCfg: "*rated", utils.DefaultCategoryCfg: "call", utils.DefaultTenantCfg: "cgrates.org", @@ -238,7 +220,6 @@ func TestGeneralCfgClone(t *testing.T) { DBDataEncoding: "msgpack", TpExportPath: "/var/spool/cgrates/tpe", PosterAttempts: 3, - FailedPostsDir: "/var/spool/cgrates/failed_posts", DefaultReqType: utils.MetaRated, DefaultCategory: utils.Call, DefaultTenant: "cgrates.org", @@ -252,7 +233,6 @@ func TestGeneralCfgClone(t *testing.T) { MaxParallelConns: 100, RSRSep: ";", DefaultCaching: utils.MetaReload, - FailedPostsTTL: 2, } rcv := ban.Clone() if !reflect.DeepEqual(ban, rcv) { diff --git a/config/libconfig_json.go b/config/libconfig_json.go index cf4683c95..1c71ed6db 100644 --- a/config/libconfig_json.go +++ b/config/libconfig_json.go @@ -34,8 +34,6 @@ type GeneralJsonCfg struct { Dbdata_encoding *string Tpexport_dir *string Poster_attempts *int - Failed_posts_dir *string - Failed_posts_ttl *string Default_request_type *string Default_category *string Default_tenant *string @@ -308,12 +306,19 @@ type EventReaderJsonCfg struct { Cache_dump_fields *[]*FcTemplateJsonCfg } +type FailedPostsJsonCfg struct { + Dir *string `json:"dir"` + TTL *string `json:"ttl"` + StaticTTL *bool `json:"static_ttl"` +} + // EEsJsonCfg contains the configuration of EventExporterService type EEsJsonCfg struct { - Enabled *bool - Attributes_conns *[]string - Cache *map[string]*CacheParamJsonCfg - Exporters *[]*EventExporterJsonCfg + Enabled *bool `json:"enabled"` + AttributeSConns *[]string `json:"attributes_conns"` + Cache *map[string]*CacheParamJsonCfg `json:"cache"` + FailedPosts *FailedPostsJsonCfg `json:"failed_posts"` + Exporters *[]*EventExporterJsonCfg `json:"exporters"` } type EventExporterOptsJson struct { diff --git a/config/multifiles_it_test.go b/config/multifiles_it_test.go index a1cdb26db..96006254e 100644 --- a/config/multifiles_it_test.go +++ b/config/multifiles_it_test.go @@ -33,8 +33,8 @@ var mfCgrCfg *CGRConfig func TestMfInitConfig(t *testing.T) { for key, val := range map[string]string{"LOGGER": "*syslog", "LOG_LEVEL": "6", "ROUND_DEC": "5", - "DB_ENCODING": "*msgpack", "TP_EXPORT_DIR": "/var/spool/cgrates/tpe", "FAILED_POSTS_DIR": "/var/spool/cgrates/failed_posts", - "DF_TENANT": "cgrates.org", "TIMEZONE": "Local"} { + "DB_ENCODING": "*msgpack", "TP_EXPORT_DIR": "/var/spool/cgrates/tpe", "DF_TENANT": "cgrates.org", + "TIMEZONE": "Local"} { os.Setenv(key, val) } var err error @@ -61,7 +61,6 @@ func TestMfEnvReaderITRead(t *testing.T) { DBDataEncoding: "msgpack", TpExportPath: "/var/spool/cgrates/tpe", PosterAttempts: 3, - FailedPostsDir: "/var/spool/cgrates/failed_posts", DefaultReqType: utils.MetaPseudoPrepaid, DefaultCategory: "call", DefaultTenant: "cgrates.org", @@ -76,7 +75,6 @@ func TestMfEnvReaderITRead(t *testing.T) { DigestEqual: ":", RSRSep: ";", MaxParallelConns: 100, - FailedPostsTTL: 5 * time.Second, } if !reflect.DeepEqual(expected, *mfCgrCfg.generalCfg) { t.Errorf("Expected: %+v\n, received: %+v", utils.ToJSON(expected), utils.ToJSON(*mfCgrCfg.generalCfg)) diff --git a/data/conf/samples/actions_internal/cgradmin.json b/data/conf/samples/actions_internal/cgradmin.json index 920c41f54..131d03b9a 100644 --- a/data/conf/samples/actions_internal/cgradmin.json +++ b/data/conf/samples/actions_internal/cgradmin.json @@ -5,9 +5,8 @@ // Starts rater, scheduler "general": { - "log_level": 7, - "poster_attempts": 1, - "failed_posts_ttl": "1", + "log_level": 7, + "poster_attempts": 1 }, "listen": { @@ -59,6 +58,9 @@ "ees": { "enabled": true, + "failed_posts": { + "ttl": "1" + }, "exporters": [ { "id": "sqs_fail", diff --git a/data/conf/samples/actions_internal_gob/cgradmin.json b/data/conf/samples/actions_internal_gob/cgradmin.json index 89d523679..a37c1b79c 100644 --- a/data/conf/samples/actions_internal_gob/cgradmin.json +++ b/data/conf/samples/actions_internal_gob/cgradmin.json @@ -7,7 +7,6 @@ "general": { "log_level": 7, "poster_attempts": 1, - "failed_posts_ttl": "1", }, "rpc_conns": { @@ -68,6 +67,9 @@ "ees": { "enabled": true, + "failed_posts": { + "ttl": "1" + }, "exporters": [ { "id": "sqs_fail", diff --git a/data/conf/samples/actions_mongo/cgradmin.json b/data/conf/samples/actions_mongo/cgradmin.json index 41d67d512..155fd3bc6 100644 --- a/data/conf/samples/actions_mongo/cgradmin.json +++ b/data/conf/samples/actions_mongo/cgradmin.json @@ -7,7 +7,6 @@ "general": { "log_level": 7, "poster_attempts": 1, - "failed_posts_ttl": "1", }, "listen": { @@ -65,6 +64,9 @@ "ees": { "enabled": true, + "failed_posts": { + "ttl": "1" + }, "exporters": [ { "id": "sqs_fail", diff --git a/data/conf/samples/actions_mongo_gob/cgradmin.json b/data/conf/samples/actions_mongo_gob/cgradmin.json index 83a155c02..6e3396a19 100644 --- a/data/conf/samples/actions_mongo_gob/cgradmin.json +++ b/data/conf/samples/actions_mongo_gob/cgradmin.json @@ -6,8 +6,7 @@ "general": { "log_level": 7, - "poster_attempts": 1, - "failed_posts_ttl": "1", + "poster_attempts": 1 }, "rpc_conns": { @@ -66,6 +65,9 @@ "ees": { "enabled": true, + "failed_posts": { + "ttl": "1" + }, "exporters": [ { "id": "sqs_fail", diff --git a/data/conf/samples/actions_mysql/cgradmin.json b/data/conf/samples/actions_mysql/cgradmin.json index 928f5b3f3..c076e6c3e 100644 --- a/data/conf/samples/actions_mysql/cgradmin.json +++ b/data/conf/samples/actions_mysql/cgradmin.json @@ -6,8 +6,7 @@ "general": { "log_level": 7, - "poster_attempts": 1, - "failed_posts_ttl": "1", + "poster_attempts": 1 }, "listen": { @@ -61,6 +60,9 @@ "ees": { "enabled": true, + "failed_posts": { + "ttl": "1" + }, "exporters": [ { "id": "sqs_fail", diff --git a/data/conf/samples/actions_mysql_gob/cgradmin.json b/data/conf/samples/actions_mysql_gob/cgradmin.json index 38a70898f..709375a35 100644 --- a/data/conf/samples/actions_mysql_gob/cgradmin.json +++ b/data/conf/samples/actions_mysql_gob/cgradmin.json @@ -7,7 +7,6 @@ "general": { "log_level": 7, "poster_attempts": 1, - "failed_posts_ttl": "1", }, "rpc_conns": { @@ -67,6 +66,9 @@ "ees": { "enabled": true, + "failed_posts": { + "ttl": "1" + }, "exporters": [ { "id": "sqs_fail", diff --git a/data/conf/samples/cdrsexport_internal/cgrates.json b/data/conf/samples/cdrsexport_internal/cgrates.json index ddbc86bd5..4e685550a 100644 --- a/data/conf/samples/cdrsexport_internal/cgrates.json +++ b/data/conf/samples/cdrsexport_internal/cgrates.json @@ -5,8 +5,7 @@ "general": { "log_level": 7, - "poster_attempts": 2, - "failed_posts_ttl": "1s" + "poster_attempts": 2 }, "data_db": { @@ -47,6 +46,9 @@ "ees": { "enabled": true, + "failed_posts": { + "ttl": "1s" + }, "exporters": [ { "id": "http_localhost", diff --git a/data/conf/samples/cdrsexport_mongo/cgrates.json b/data/conf/samples/cdrsexport_mongo/cgrates.json index e3008a703..6a345c1a2 100644 --- a/data/conf/samples/cdrsexport_mongo/cgrates.json +++ b/data/conf/samples/cdrsexport_mongo/cgrates.json @@ -5,8 +5,7 @@ "general": { "log_level": 7, - "poster_attempts": 2, - "failed_posts_ttl": "1s" + "poster_attempts": 2 }, @@ -53,6 +52,9 @@ "ees": { "enabled": true, + "failed_posts": { + "ttl": "1s" + }, "exporters": [ { "id": "http_localhost", diff --git a/data/conf/samples/cdrsexport_mysql/cgrates.json b/data/conf/samples/cdrsexport_mysql/cgrates.json index 135df19a0..183fa4e5b 100644 --- a/data/conf/samples/cdrsexport_mysql/cgrates.json +++ b/data/conf/samples/cdrsexport_mysql/cgrates.json @@ -6,7 +6,6 @@ "general": { "log_level": 7, "poster_attempts": 1, - "failed_posts_ttl": "1s" }, "data_db": { @@ -49,6 +48,9 @@ "ees": { "enabled": true, + "failed_posts": { + "ttl": "1s" + }, "exporters": [ { "id": "http_localhost", diff --git a/data/conf/samples/cdrsonexpmaster_mongo/cdrsreplicationmaster.json b/data/conf/samples/cdrsonexpmaster_mongo/cdrsreplicationmaster.json index 302ed9275..2201c2cc1 100644 --- a/data/conf/samples/cdrsonexpmaster_mongo/cdrsreplicationmaster.json +++ b/data/conf/samples/cdrsonexpmaster_mongo/cdrsreplicationmaster.json @@ -6,8 +6,7 @@ "general": { "log_level": 7, - "poster_attempts": 1, - "failed_posts_ttl": "1", + "poster_attempts": 1 }, "data_db": { @@ -48,6 +47,9 @@ "ees": { "enabled": true, + "failed_posts": { + "ttl": "1" + }, "exporters": [ { "id": "http_localhost", @@ -147,4 +149,4 @@ }, -} \ No newline at end of file +} diff --git a/data/conf/samples/cdrsonexpmaster_mysql/cdrsreplicationmaster.json b/data/conf/samples/cdrsonexpmaster_mysql/cdrsreplicationmaster.json index 1f6f00f50..6a2c395ef 100644 --- a/data/conf/samples/cdrsonexpmaster_mysql/cdrsreplicationmaster.json +++ b/data/conf/samples/cdrsonexpmaster_mysql/cdrsreplicationmaster.json @@ -6,8 +6,7 @@ "general": { "log_level": 7, - "poster_attempts": 1, - "failed_posts_ttl": "1", + "poster_attempts": 1 }, "data_db": { @@ -45,6 +44,9 @@ "ees": { "enabled": true, + "failed_posts": { + "ttl": "1" + }, "exporters": [ { "id": "http_localhost", @@ -144,4 +146,4 @@ }, -} \ No newline at end of file +} diff --git a/data/conf/samples/cdrsv1processevent/cgrates.json b/data/conf/samples/cdrsv1processevent/cgrates.json index 9994ec40b..5e8ddd3c5 100644 --- a/data/conf/samples/cdrsv1processevent/cgrates.json +++ b/data/conf/samples/cdrsv1processevent/cgrates.json @@ -5,8 +5,7 @@ "general": { "log_level": 7, - "poster_attempts": 1, - "failed_posts_ttl": "1", + "poster_attempts": 1 }, "data_db":{ @@ -31,11 +30,16 @@ "ees": { "enabled": true, "attributes_conns": ["*internal"], + "failed_posts": { + "dir": "/tmp/failed_posts", + "ttl": "1" + }, "exporters": [ { "id": "amqp_test_file", "type": "*amqp_json_map", "export_path": "amqps://guest:guest@localhost:256733/", + "failed_posts_dir": "/tmp/failed_posts", "attempts": 1, "synchronous": true, "fields":[ diff --git a/data/conf/samples/cdrsv1processeventmongo/cgrates.json b/data/conf/samples/cdrsv1processeventmongo/cgrates.json index b098c465c..750ae681a 100644 --- a/data/conf/samples/cdrsv1processeventmongo/cgrates.json +++ b/data/conf/samples/cdrsv1processeventmongo/cgrates.json @@ -4,9 +4,8 @@ // Used in general_tests "general": { - "log_level": 7, + "log_level": 7, "poster_attempts": 1, - "failed_posts_ttl": "1", }, "data_db": { @@ -35,11 +34,16 @@ "ees": { "enabled": true, "attributes_conns": ["*internal"], + "failed_posts": { + "dir": "/tmp/failed_posts", + "ttl": "1" + }, "exporters": [ { "id": "amqp_test_file", "type": "*amqp_json_map", "export_path": "amqps://guest:guest@localhost:256733/", + "failed_posts_dir": "/tmp/failed_posts", "attempts": 1, "synchronous": true, "fields":[ diff --git a/data/conf/samples/cdrsv1processeventmysql/cgrates.json b/data/conf/samples/cdrsv1processeventmysql/cgrates.json index 8da4253ed..f788e463f 100644 --- a/data/conf/samples/cdrsv1processeventmysql/cgrates.json +++ b/data/conf/samples/cdrsv1processeventmysql/cgrates.json @@ -6,7 +6,6 @@ "general": { "log_level": 7, "poster_attempts": 1, - "failed_posts_ttl": "1", }, "data_db": { // database used to store runtime data (eg: accounts, cdr stats) @@ -31,6 +30,9 @@ "ees": { "enabled": true, "attributes_conns": ["*internal"], + "failed_posts": { + "ttl": "1" + }, "exporters": [ { "id": "amqp_test_file", diff --git a/data/conf/samples/cdrsv_failover_internal/cgrates.json b/data/conf/samples/cdrsv_failover_internal/cgrates.json index cd2b534bf..7439d1270 100644 --- a/data/conf/samples/cdrsv_failover_internal/cgrates.json +++ b/data/conf/samples/cdrsv_failover_internal/cgrates.json @@ -7,9 +7,7 @@ "general": { "log_level": 7, "node_id": "TestFailCDRS", - "poster_attempts": 1, // number of attempts before considering post request failed (eg: *http_post, CDR exports) - "failed_posts_ttl": "1s", // time to wait before writing the failed posts in a single file - "failed_posts_dir": "/tmp/failed_posts", + "poster_attempts": 1 // number of attempts before considering post request failed (eg: *http_post, CDR exports) }, "stor_db": { @@ -65,6 +63,11 @@ "ees": { "enabled": true, "attributes_conns": ["*internal"], + "failed_posts": { + "dir": "/tmp/failed_posts", + "ttl": "1s", + "static_ttl": false + }, "exporters": [ { "id": "s3_test_file", diff --git a/data/conf/samples/cdrsv_failover_mongo/cgrates.json b/data/conf/samples/cdrsv_failover_mongo/cgrates.json index eb1bc97c1..96873870b 100644 --- a/data/conf/samples/cdrsv_failover_mongo/cgrates.json +++ b/data/conf/samples/cdrsv_failover_mongo/cgrates.json @@ -7,8 +7,6 @@ "general": { "log_level": 7, "poster_attempts": 1, // number of attempts before considering post request failed (eg: *http_post, CDR exports) - "failed_posts_ttl": "1s", // time to wait before writing the failed posts in a single file - "failed_posts_dir": "/tmp/failed_posts" // directory path where we store failed requests }, "data_db": { @@ -75,6 +73,11 @@ "ees": { "enabled": true, "attributes_conns": ["*internal"], + "failed_posts": { + "dir": "/tmp/failed_posts", + "ttl": "1s", + "static_ttl": false + }, "exporters": [ { "id": "s3_test_file", diff --git a/data/conf/samples/cdrsv_failover_mysql/cgrates.json b/data/conf/samples/cdrsv_failover_mysql/cgrates.json index a174d6c2a..55765551d 100644 --- a/data/conf/samples/cdrsv_failover_mysql/cgrates.json +++ b/data/conf/samples/cdrsv_failover_mysql/cgrates.json @@ -7,8 +7,6 @@ "general": { "log_level": 7, "poster_attempts": 1, // number of attempts before considering post request failed (eg: *http_post, CDR exports) - "failed_posts_ttl": "1s", // time to wait before writing the failed posts in a single file - "failed_posts_dir": "/tmp/failed_posts" // directory path where we store failed requests }, @@ -71,6 +69,11 @@ "ees": { "enabled": true, "attributes_conns": ["*internal"], + "failed_posts": { + "dir": "/tmp/failed_posts", + "ttl": "1s", + "static_ttl": false + }, "exporters": [ { "id": "s3_test_file", diff --git a/data/conf/samples/ees_cloud/cgrates.json b/data/conf/samples/ees_cloud/cgrates.json index 9705778aa..0c498cfd0 100644 --- a/data/conf/samples/ees_cloud/cgrates.json +++ b/data/conf/samples/ees_cloud/cgrates.json @@ -2,8 +2,7 @@ "general": { "log_level": 7, - "poster_attempts": 2, - "failed_posts_ttl": "1s" + "poster_attempts": 2 }, "data_db": { @@ -17,6 +16,9 @@ "ees": { "enabled": true, + "failed_posts": { + "ttl": "1s" + }, "exporters": [ { "id": "sqs_test_file", @@ -91,4 +93,4 @@ ] } -} \ No newline at end of file +} diff --git a/data/conf/samples/multifiles/b/b.json b/data/conf/samples/multifiles/b/b.json index 48d38cc0a..039fbd023 100644 --- a/data/conf/samples/multifiles/b/b.json +++ b/data/conf/samples/multifiles/b/b.json @@ -34,4 +34,4 @@ }, ], -} \ No newline at end of file +} diff --git a/data/conf/samples/multifiles/d.json b/data/conf/samples/multifiles/d.json index 45926e0de..7a998e85d 100644 --- a/data/conf/samples/multifiles/d.json +++ b/data/conf/samples/multifiles/d.json @@ -11,7 +11,6 @@ "dbdata_encoding": "*env:DB_ENCODING", // encoding used to store object data in strings: <*msgpack|*json> "tpexport_dir": "*env:TP_EXPORT_DIR", // path towards export folder for offline Tariff Plans "poster_attempts": 3, // number of attempts before considering post request failed (eg: *http_post, CDR replication) - "failed_posts_dir": "*env:FAILED_POSTS_DIR", // directory path where we store failed requests "default_tenant": "*env:DF_TENANT", // default tenant to consider when missing from requests "default_timezone": "*env:TIMEZONE", // default timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB> "connect_attempts": 3, // initial server connect attempts @@ -23,4 +22,4 @@ "digest_separator": ",", "digest_equal": ":", }, -} \ No newline at end of file +} diff --git a/ees/libactions.go b/ees/libactions.go index 60ae2af8e..75640782a 100644 --- a/ees/libactions.go +++ b/ees/libactions.go @@ -53,14 +53,14 @@ func callURL(ub *engine.Account, a *engine.Action, _ engine.Actions, _ *engine.F if err != nil { return err } - eeCfg := config.NewEventExporterCfg(a.Id, "", a.ExtraParameters, config.CgrConfig().GeneralCfg().FailedPostsDir, + eeCfg := config.NewEventExporterCfg(a.Id, "", a.ExtraParameters, config.CgrConfig().EEsCfg().FailedPosts.Dir, config.CgrConfig().GeneralCfg().PosterAttempts, nil) pstr, err := NewHTTPjsonMapEE(eeCfg, config.CgrConfig(), nil, nil) if err != nil { return err } err = ExportWithAttempts(pstr, &HTTPPosterRequest{Body: body, Header: make(http.Header)}, "") - if config.CgrConfig().GeneralCfg().FailedPostsDir != utils.MetaNone { + if config.CgrConfig().EEsCfg().FailedPosts.Dir != utils.MetaNone { err = nil } return err @@ -73,7 +73,7 @@ func callURLAsync(ub *engine.Account, a *engine.Action, _ engine.Actions, _ *eng if err != nil { return err } - eeCfg := config.NewEventExporterCfg(a.Id, "", a.ExtraParameters, config.CgrConfig().GeneralCfg().FailedPostsDir, + eeCfg := config.NewEventExporterCfg(a.Id, "", a.ExtraParameters, config.CgrConfig().EEsCfg().FailedPosts.Dir, config.CgrConfig().GeneralCfg().PosterAttempts, nil) pstr, err := NewHTTPjsonMapEE(eeCfg, config.CgrConfig(), nil, nil) if err != nil { @@ -89,14 +89,14 @@ func postEvent(_ *engine.Account, a *engine.Action, _ engine.Actions, _ *engine. if err != nil { return err } - eeCfg := config.NewEventExporterCfg(a.Id, "", a.ExtraParameters, config.CgrConfig().GeneralCfg().FailedPostsDir, + eeCfg := config.NewEventExporterCfg(a.Id, "", a.ExtraParameters, config.CgrConfig().EEsCfg().FailedPosts.Dir, config.CgrConfig().GeneralCfg().PosterAttempts, nil) pstr, err := NewHTTPjsonMapEE(eeCfg, config.CgrConfig(), nil, nil) if err != nil { return err } err = ExportWithAttempts(pstr, &HTTPPosterRequest{Body: body, Header: make(http.Header)}, "") - if config.CgrConfig().GeneralCfg().FailedPostsDir != utils.MetaNone { + if config.CgrConfig().EEsCfg().FailedPosts.Dir != utils.MetaNone { err = nil } return err diff --git a/ees/libcdre.go b/ees/libcdre.go index e0c9b43e7..f61a3e9a6 100644 --- a/ees/libcdre.go +++ b/ees/libcdre.go @@ -40,8 +40,8 @@ func init() { } // SetFailedPostCacheTTL recreates the failed cache -func SetFailedPostCacheTTL(ttl time.Duration) { - failedPostCache = ltcache.NewCache(-1, ttl, false, false, []func(itmID string, value any){writeFailedPosts}) +func SetFailedPostCacheTTL(ttl time.Duration, static bool) { + failedPostCache = ltcache.NewCache(-1, ttl, static, false, []func(itmID string, value any){writeFailedPosts}) } func writeFailedPosts(_ string, value any) { diff --git a/ees/libcdre_it_test.go b/ees/libcdre_it_test.go index 07b24b26b..beebd8091 100644 --- a/ees/libcdre_it_test.go +++ b/ees/libcdre_it_test.go @@ -46,7 +46,7 @@ func TestWriteFldPosts(t *testing.T) { if err := os.MkdirAll(dir, 0755); err != nil { t.Fatal("Error creating folder: ", dir, err) } - config.CgrConfig().GeneralCfg().FailedPostsDir = dir + config.CgrConfig().EEsCfg().FailedPosts.Dir = dir writeFailedPosts("itmID", exportEvent) if filename, err := filepath.Glob(filepath.Join(dir, "EEs|*.gob")); err != nil { diff --git a/ees/libcdre_test.go b/ees/libcdre_test.go index edc5a6acf..1d0edfb95 100644 --- a/ees/libcdre_test.go +++ b/ees/libcdre_test.go @@ -30,7 +30,7 @@ import ( func TestSetFldPostCacheTTL(t *testing.T) { var1 := failedPostCache - SetFailedPostCacheTTL(50 * time.Millisecond) + SetFailedPostCacheTTL(50*time.Millisecond, false) var2 := failedPostCache if reflect.DeepEqual(var1, var2) { t.Error("Expecting to be different") @@ -38,7 +38,7 @@ func TestSetFldPostCacheTTL(t *testing.T) { } func TestAddFldPost(t *testing.T) { - SetFailedPostCacheTTL(5 * time.Second) + SetFailedPostCacheTTL(5*time.Second, false) AddFailedPost("", "path1", "format1", "1", &config.EventExporterOpts{ AMQP: &config.AMQPOpts{}, Els: &config.ElsOpts{}, diff --git a/ees/poster_it_test.go b/ees/poster_it_test.go index a66b0bffa..83791b16a 100644 --- a/ees/poster_it_test.go +++ b/ees/poster_it_test.go @@ -66,7 +66,7 @@ type TestContent struct { } func TestHttpJsonPoster(t *testing.T) { - SetFailedPostCacheTTL(time.Millisecond) + SetFailedPostCacheTTL(time.Millisecond, false) content := &TestContent{Var1: "Val1", Var2: "Val2"} jsn, _ := json.Marshal(content) pstr, err := NewHTTPjsonMapEE(&config.EventExporterCfg{ @@ -123,7 +123,7 @@ func TestHttpJsonPoster(t *testing.T) { } func TestHttpBytesPoster(t *testing.T) { - SetFailedPostCacheTTL(time.Millisecond) + SetFailedPostCacheTTL(time.Millisecond, false) content := []byte(`Test Test2 `) diff --git a/general_tests/cdrs_onlexp_it_test.go b/general_tests/cdrs_onlexp_it_test.go index cf954be02..5ec0dec10 100644 --- a/general_tests/cdrs_onlexp_it_test.go +++ b/general_tests/cdrs_onlexp_it_test.go @@ -113,11 +113,11 @@ func testCDRsOnExpInitCdrDb(t *testing.T) { if err := engine.InitStorDb(cdrsSlaveCfg); err != nil { t.Fatal(err) } - if err := os.RemoveAll(cdrsMasterCfg.GeneralCfg().FailedPostsDir); err != nil { - t.Fatal("Error removing folder: ", cdrsMasterCfg.GeneralCfg().FailedPostsDir, err) + if err := os.RemoveAll(cdrsMasterCfg.EEsCfg().FailedPosts.Dir); err != nil { + t.Fatal("Error removing folder: ", cdrsMasterCfg.EEsCfg().FailedPosts.Dir, err) } - if err := os.MkdirAll(cdrsMasterCfg.GeneralCfg().FailedPostsDir, 0700); err != nil { + if err := os.MkdirAll(cdrsMasterCfg.EEsCfg().FailedPosts.Dir, 0700); err != nil { t.Error(err) } @@ -245,9 +245,9 @@ func testCDRsOnExpDisableOnlineExport(t *testing.T) { t.Error("Unexpected reply received: ", reply) } time.Sleep(time.Duration(*utils.WaitRater) * time.Millisecond) - filesInDir, _ := os.ReadDir(cdrsMasterCfg.GeneralCfg().FailedPostsDir) + filesInDir, _ := os.ReadDir(cdrsMasterCfg.EEsCfg().FailedPosts.Dir) if len(filesInDir) != 0 { - t.Fatalf("Should be no files in directory: %s", cdrsMasterCfg.GeneralCfg().FailedPostsDir) + t.Fatalf("Should be no files in directory: %s", cdrsMasterCfg.EEsCfg().FailedPosts.Dir) } } @@ -458,13 +458,13 @@ func testCDRsOnExpFileFailover(t *testing.T) { v2.Set("OriginID", "amqpreconnect") httpContent := []any{&ees.HTTPPosterRequest{Body: v1, Header: http.Header{"Content-Type": []string{"application/x-www-form-urlencoded"}}}, &ees.HTTPPosterRequest{Body: v2, Header: http.Header{"Content-Type": []string{"application/x-www-form-urlencoded"}}}} - filesInDir, _ := os.ReadDir(cdrsMasterCfg.GeneralCfg().FailedPostsDir) + filesInDir, _ := os.ReadDir(cdrsMasterCfg.EEsCfg().FailedPosts.Dir) if len(filesInDir) == 0 { - t.Fatalf("No files in directory: %s", cdrsMasterCfg.GeneralCfg().FailedPostsDir) + t.Fatalf("No files in directory: %s", cdrsMasterCfg.EEsCfg().FailedPosts.Dir) } for _, file := range filesInDir { // First file in directory is the one we need, harder to find it's name out of config fileName := file.Name() - filePath := path.Join(cdrsMasterCfg.GeneralCfg().FailedPostsDir, fileName) + filePath := path.Join(cdrsMasterCfg.EEsCfg().FailedPosts.Dir, fileName) ev, err := ees.NewExportEventsFromFile(filePath) if err != nil { diff --git a/general_tests/cdrs_post_failover_it_test.go b/general_tests/cdrs_post_failover_it_test.go index 75e651fc1..6b408f501 100644 --- a/general_tests/cdrs_post_failover_it_test.go +++ b/general_tests/cdrs_post_failover_it_test.go @@ -81,10 +81,10 @@ func testCDRsPostFailoverInitConfig(t *testing.T) { if cdrsPostFailCfg, err = config.NewCGRConfigFromPath(cdrsPostFailCfgPath); err != nil { t.Fatal("Got config error: ", err.Error()) } - if err = os.RemoveAll(cdrsPostFailCfg.GeneralCfg().FailedPostsDir); err != nil { + if err = os.RemoveAll(cdrsPostFailCfg.EEsCfg().FailedPosts.Dir); err != nil { t.Error(err) } - if err = os.MkdirAll(cdrsPostFailCfg.GeneralCfg().FailedPostsDir, 0755); err != nil { + if err = os.MkdirAll(cdrsPostFailCfg.EEsCfg().FailedPosts.Dir, 0755); err != nil { t.Error(err) } } @@ -184,13 +184,13 @@ func testCDRsPostFailoverProcessCDR(t *testing.T) { func testCDRsPostFailoverToFile(t *testing.T) { time.Sleep(2 * time.Second) - filesInDir, _ := os.ReadDir(cdrsPostFailCfg.GeneralCfg().FailedPostsDir) + filesInDir, _ := os.ReadDir(cdrsPostFailCfg.EEsCfg().FailedPosts.Dir) if len(filesInDir) == 0 { - t.Fatalf("No files in directory: %s", cdrsPostFailCfg.GeneralCfg().FailedPostsDir) + t.Fatalf("No files in directory: %s", cdrsPostFailCfg.EEsCfg().FailedPosts.Dir) } for _, file := range filesInDir { // First file in directory is the one we need, harder to find it's name out of config fileName := file.Name() - filePath := path.Join(cdrsPostFailCfg.GeneralCfg().FailedPostsDir, fileName) + filePath := path.Join(cdrsPostFailCfg.EEsCfg().FailedPosts.Dir, fileName) ev, err := ees.NewExportEventsFromFile(filePath) if err != nil { @@ -210,7 +210,7 @@ func testCDRsPostFailoverToFile(t *testing.T) { } func testCDRsPostFailoverKillEngine(t *testing.T) { - if err := os.RemoveAll(cdrsPostFailCfg.GeneralCfg().FailedPostsDir); err != nil { + if err := os.RemoveAll(cdrsPostFailCfg.EEsCfg().FailedPosts.Dir); err != nil { t.Error(err) } if err := engine.KillEngine(*utils.WaitRater); err != nil { diff --git a/general_tests/cdrs_processevent_it_test.go b/general_tests/cdrs_processevent_it_test.go index 09f7c1ede..f6efa35ba 100644 --- a/general_tests/cdrs_processevent_it_test.go +++ b/general_tests/cdrs_processevent_it_test.go @@ -107,10 +107,10 @@ func testV1CDRsInitCdrDb(t *testing.T) { func testV1CDRsStartEngine(t *testing.T) { // before starting the engine, create the directories needed for failed posts or // clear their contents if they exist already - if err := os.RemoveAll(pecdrsCfg.GeneralCfg().FailedPostsDir); err != nil { - t.Fatal("Error removing folder: ", pecdrsCfg.GeneralCfg().FailedPostsDir, err) + if err := os.RemoveAll(pecdrsCfg.EEsCfg().FailedPosts.Dir); err != nil { + t.Fatal("Error removing folder: ", pecdrsCfg.EEsCfg().FailedPosts.Dir, err) } - if err := os.MkdirAll(pecdrsCfg.GeneralCfg().FailedPostsDir, 0755); err != nil { + if err := os.MkdirAll(pecdrsCfg.EEsCfg().FailedPosts.Dir, 0755); err != nil { t.Fatal(err) } if _, err := engine.StopStartEngine(pecdrsCfgPath, *utils.WaitRater); err != nil { @@ -575,9 +575,9 @@ func testV1CDRsProcessEventExport(t *testing.T) { } func testV1CDRsProcessEventExportCheck(t *testing.T) { failoverContent := []byte(fmt.Sprintf(`{"CGRID":"%s"}`, utils.Sha1("test7_processEvent", "OriginHost7"))) - filesInDir, _ := os.ReadDir(pecdrsCfg.GeneralCfg().FailedPostsDir) + filesInDir, _ := os.ReadDir(pecdrsCfg.EEsCfg().FailedPosts.Dir) if len(filesInDir) == 0 { - t.Fatalf("No files in directory: %s", pecdrsCfg.GeneralCfg().FailedPostsDir) + t.Fatalf("No files in directory: %s", pecdrsCfg.EEsCfg().FailedPosts.Dir) } var foundFile bool var fileName string @@ -585,7 +585,7 @@ func testV1CDRsProcessEventExportCheck(t *testing.T) { fileName = file.Name() if strings.HasPrefix(fileName, "EEs|") { foundFile = true - filePath := path.Join(pecdrsCfg.GeneralCfg().FailedPostsDir, fileName) + filePath := path.Join(pecdrsCfg.EEsCfg().FailedPosts.Dir, fileName) ev, err := ees.NewExportEventsFromFile(filePath) if err != nil { t.Fatal(err) diff --git a/general_tests/ees_it_test.go b/general_tests/ees_it_test.go index e837edb3f..bc6360595 100644 --- a/general_tests/ees_it_test.go +++ b/general_tests/ees_it_test.go @@ -349,7 +349,6 @@ func TestEEsReplayFailedPosts(t *testing.T) { "general": { "log_level": 7, - "failed_posts_ttl": "1ms", "poster_attempts": 1 }, @@ -370,6 +369,9 @@ func TestEEsReplayFailedPosts(t *testing.T) { "cache": { "*nats_json_map": {"limit": 0, "ttl": "", "static_ttl": false} }, + "failed_posts": { + "ttl": "1ms" + }, "exporters": [ { "id": "nats_exporter", diff --git a/general_tests/poster_it_test.go b/general_tests/poster_it_test.go index 9c5af1f0d..af64c5b27 100644 --- a/general_tests/poster_it_test.go +++ b/general_tests/poster_it_test.go @@ -103,10 +103,10 @@ func testPosterITInitCdrDb(t *testing.T) { func testPosterITStartEngine(t *testing.T) { // before starting the engine, create the directories needed for failed posts or // clear their contents if they exist already - if err := os.RemoveAll(pstrCfg.GeneralCfg().FailedPostsDir); err != nil { - t.Fatal("Error removing folder: ", pstrCfg.GeneralCfg().FailedPostsDir, err) + if err := os.RemoveAll(pstrCfg.EEsCfg().FailedPosts.Dir); err != nil { + t.Fatal("Error removing folder: ", pstrCfg.EEsCfg().FailedPosts.Dir, err) } - if err := os.MkdirAll(pstrCfg.GeneralCfg().FailedPostsDir, 0755); err != nil { + if err := os.MkdirAll(pstrCfg.EEsCfg().FailedPosts.Dir, 0755); err != nil { t.Fatal(err) } if _, err := engine.StopStartEngine(pstrCfgPath, *utils.WaitRater); err != nil { @@ -119,14 +119,14 @@ func testPosterITRpcConn(t *testing.T) { } func testPosterReadFolder(format string) (expEv *ees.ExportEvents, err error) { - filesInDir, _ := os.ReadDir(pstrCfg.GeneralCfg().FailedPostsDir) + filesInDir, _ := os.ReadDir(pstrCfg.EEsCfg().FailedPosts.Dir) if len(filesInDir) == 0 { - err = fmt.Errorf("No files in directory: %s", pstrCfg.GeneralCfg().FailedPostsDir) + err = fmt.Errorf("No files in directory: %s", pstrCfg.EEsCfg().FailedPosts.Dir) return } for _, file := range filesInDir { // First file in directory is the one we need, harder to find it's name out of config fileName := file.Name() - filePath := path.Join(pstrCfg.GeneralCfg().FailedPostsDir, fileName) + filePath := path.Join(pstrCfg.EEsCfg().FailedPosts.Dir, fileName) expEv, err = ees.NewExportEventsFromFile(filePath) if err != nil { diff --git a/services/globalvars.go b/services/globalvars.go index 4b64d5ee6..4ce93eaa9 100644 --- a/services/globalvars.go +++ b/services/globalvars.go @@ -47,7 +47,7 @@ type GlobalVarS struct { // Start should handle the sercive start func (gv *GlobalVarS) Start() (err error) { engine.SetRoundingDecimals(gv.cfg.GeneralCfg().RoundingDecimals) - ees.SetFailedPostCacheTTL(gv.cfg.GeneralCfg().FailedPostsTTL) + ees.SetFailedPostCacheTTL(gv.cfg.EEsCfg().FailedPosts.TTL, gv.cfg.EEsCfg().FailedPosts.StaticTTL) engine.SetHTTPPstrTransport(gv.cfg.HTTPCfg().ClientOpts) return nil } diff --git a/utils/consts.go b/utils/consts.go index 7c2bcd6d9..c9a02495f 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -2338,8 +2338,6 @@ const ( DBDataEncodingCfg = "dbdata_encoding" TpExportPathCfg = "tpexport_dir" PosterAttemptsCfg = "poster_attempts" - FailedPostsDirCfg = "failed_posts_dir" - FailedPostsTTLCfg = "failed_posts_ttl" DefaultReqTypeCfg = "default_request_type" DefaultCategoryCfg = "default_category" DefaultTenantCfg = "default_tenant" @@ -2662,7 +2660,9 @@ const ( PrecacheCfg = "precache" // EEsCfg + FailedPostsCfg = "failed_posts" ExportPathCfg = "export_path" + FailedPostsDirCfg = "failed_posts_dir" AttributeSContextCfg = "attributes_context" SynchronousCfg = "synchronous" AttemptsCfg = "attempts" @@ -2671,6 +2671,9 @@ const ( ConcurrentRequestsCfg = "concurrent_requests" MetricsResetScheduleCfg = "metrics_reset_schedule" + // FailedPostsCfg + DirCfg = "dir" + //LoaderSCfg DryRunCfg = "dry_run" LockFilePathCfg = "lockfile_path"