From 11aecbd22fe919daf85f51ddbafe416aa97b2df6 Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Wed, 15 Sep 2021 18:38:27 +0300 Subject: [PATCH] Add opts field in config for thresholds --- apis/config_it_test.go | 3 -- apis/resources_it_test.go | 2 +- apis/stats_it_test.go | 2 +- apis/stats_test.go | 4 +- apis/thresholds_it_test.go | 20 +++++-- apis/thresholds_test.go | 4 +- config/config.go | 1 + config/config_defaults.go | 1 + config/config_it_test.go | 1 + config/config_json_test.go | 1 + config/config_test.go | 9 +++- config/thresholdscfg.go | 52 ++++++++++++++++++ config/thresholdscfg_test.go | 23 ++++++-- engine/resources.go | 24 ++++----- engine/stats.go | 6 +-- engine/stats_test.go | 4 +- engine/thresholds.go | 14 +++-- engine/thresholds_test.go | 100 +++++++++++++++++++++++------------ engine/z_resources_test.go | 8 +-- sessions/sessions.go | 2 +- utils/consts.go | 6 +++ 21 files changed, 204 insertions(+), 83 deletions(-) diff --git a/apis/config_it_test.go b/apis/config_it_test.go index 5e41b373f..66aca9ca8 100644 --- a/apis/config_it_test.go +++ b/apis/config_it_test.go @@ -214,7 +214,6 @@ func testCfgSetGetConfig(t *testing.T) { "prefix_indexed_fields": []string{}, "resources_conns": []string{"*internal"}, "stats_conns": []string{"*internal"}, - "profile_runs": 0., "suffix_indexed_fields": []string{}, utils.OptsCfg: map[string]interface{}{ utils.MetaAttributeIDsCfg: []string(nil), @@ -483,7 +482,6 @@ func testCfgSetGetConfigStore(t *testing.T) { "prefix_indexed_fields": []string{}, "resources_conns": []string{"*internal"}, "stats_conns": []string{"*internal"}, - "profile_runs": 0., "suffix_indexed_fields": []string{}, utils.OptsCfg: map[string]interface{}{ utils.MetaAttributeIDsCfg: []string(nil), @@ -580,7 +578,6 @@ func testCfgGetAfterReloadStore(t *testing.T) { "prefix_indexed_fields": []string{}, "resources_conns": []string{"*internal"}, "stats_conns": []string{"*internal"}, - "profile_runs": 0., "suffix_indexed_fields": []string{}, utils.OptsCfg: map[string]interface{}{ utils.MetaAttributeIDsCfg: []string(nil), diff --git a/apis/resources_it_test.go b/apis/resources_it_test.go index cf3c085d1..34dcd256a 100644 --- a/apis/resources_it_test.go +++ b/apis/resources_it_test.go @@ -625,7 +625,7 @@ func testResourceSCheckThresholdAfterResourceAllocate(t *testing.T) { Units: 1, } - expBody := `{"*opts":{"*eventType":"ResourceUpdate"},"*req":{"EventType":"ResourceUpdate","ResourceID":"RES_1","Usage":0}}` + expBody := `{"*opts":{"*eventType":"ResourceUpdate","*thresholdIDs":["THD_1"]},"*req":{"EventType":"ResourceUpdate","ResourceID":"RES_1","Usage":0}}` if err := rsRPC.Call(context.Background(), utils.ResourceSv1AllocateResources, argsRU, &reply); err != nil { t.Error(err) diff --git a/apis/stats_it_test.go b/apis/stats_it_test.go index 15fc20a60..4d02c2578 100644 --- a/apis/stats_it_test.go +++ b/apis/stats_it_test.go @@ -672,7 +672,7 @@ func testStatsProcessEvent(t *testing.T) { }, } expected := []string{"SQ_3"} - expBody := `{"*opts":{"*eventType":"StatUpdate"},"*req":{"*tcd":30000000000,"EventType":"StatUpdate","StatID":"SQ_3"}}` + expBody := `{"*opts":{"*eventType":"StatUpdate","*thresholdIDs":["THD_ID"]},"*req":{"*tcd":30000000000,"EventType":"StatUpdate","StatID":"SQ_3"}}` var reply []string if err := sqRPC.Call(context.Background(), utils.StatSv1ProcessEvent, args, &reply); err != nil { diff --git a/apis/stats_test.go b/apis/stats_test.go index d2cd0fd90..22db4fffa 100644 --- a/apis/stats_test.go +++ b/apis/stats_test.go @@ -473,7 +473,6 @@ func TestStatsAPIs(t *testing.T) { data := engine.NewInternalDB(nil, nil, true) expThEv := &engine.ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"thdID"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", Event: map[string]interface{}{ @@ -484,7 +483,8 @@ func TestStatsAPIs(t *testing.T) { utils.StatID: "sq2", }, APIOpts: map[string]interface{}{ - utils.MetaEventType: utils.StatUpdate, + utils.MetaEventType: utils.StatUpdate, + utils.OptsThresholdsThresholdIDs: []string{"thdID"}, }, }, } diff --git a/apis/thresholds_it_test.go b/apis/thresholds_it_test.go index c6aa7014b..a40ed265a 100644 --- a/apis/thresholds_it_test.go +++ b/apis/thresholds_it_test.go @@ -338,13 +338,15 @@ func testThresholdsGetThresholdProfileCount(t *testing.T) { func testThresholdsGetThresholdsForEvent(t *testing.T) { args := &engine.ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"THD_1", "THD_2"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "GetThresholdEventTest", Event: map[string]interface{}{ utils.AccountField: "1001", }, + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: []string{"THD_1", "THD_2"}, + }, }, } expThs := engine.Thresholds{ @@ -398,13 +400,15 @@ func testThresholdsRemoveThresholdProfiles(t *testing.T) { func testThresholdsGetThresholdsAfterRemove(t *testing.T) { args := &engine.ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"THD_1", "THD_2"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "RemThresholdEventTest", Event: map[string]interface{}{ utils.AccountField: "1001", }, + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: []string{"THD_1", "THD_2"}, + }, }, } @@ -485,13 +489,15 @@ func testThresholdsSetThresholdProfilesBeforeProcessEv(t *testing.T) { func testThresholdsProcessEvent(t *testing.T) { args := &engine.ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"THD_1", "THD_2"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "ThresholdProcessEv", Event: map[string]interface{}{ utils.AccountField: "1001", }, + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: []string{"THD_1", "THD_2"}, + }, }, } @@ -509,13 +515,15 @@ func testThresholdsProcessEvent(t *testing.T) { func testThresholdsGetThresholdsAfterFirstEvent(t *testing.T) { args := &engine.ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"THD_1", "THD_2"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "ThresholdEventTest", Event: map[string]interface{}{ utils.AccountField: "1001", }, + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: []string{"THD_1", "THD_2"}, + }, }, } expThs := engine.Thresholds{ @@ -548,13 +556,15 @@ func testThresholdsGetThresholdsAfterFirstEvent(t *testing.T) { func testThresholdsGetThresholdsAfterSecondEvent(t *testing.T) { args := &engine.ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"THD_1", "THD_2"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "ThresholdEventTest", Event: map[string]interface{}{ utils.AccountField: "1001", }, + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: []string{"THD_1", "THD_2"}, + }, }, } expThs := engine.Thresholds{ diff --git a/apis/thresholds_test.go b/apis/thresholds_test.go index 70fbd77c3..d9579383d 100644 --- a/apis/thresholds_test.go +++ b/apis/thresholds_test.go @@ -563,8 +563,10 @@ func TestThresholdsAPIs(t *testing.T) { utils.AccountField: "1001", }, ID: "EventTest", + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: []string{"thd1", "thd2"}, + }, }, - ThresholdIDs: []string{"thd1", "thd2"}, } expThresholds := engine.Thresholds{ diff --git a/config/config.go b/config/config.go index 2c494f6a3..42e0bb4f1 100644 --- a/config/config.go +++ b/config/config.go @@ -147,6 +147,7 @@ func newCGRConfig(config []byte) (cfg *CGRConfig, err error) { cfg.resourceSCfg = new(ResourceSConfig) cfg.statsCfg = new(StatSCfg) cfg.thresholdSCfg = new(ThresholdSCfg) + cfg.ThresholdSCfg().Opts = &ThresholdsOpts{} cfg.routeSCfg = new(RouteSCfg) cfg.RouteSCfg().Opts = &RoutesOpts{} cfg.sureTaxCfg = new(SureTaxCfg) diff --git a/config/config_defaults.go b/config/config_defaults.go index ef2c3658e..636bfcaf1 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -719,6 +719,7 @@ const CGRATES_CFG_JSON = ` "suffix_indexed_fields": [], // query indexes based on these fields for faster processing "nested_fields": false, // determines which field is checked when matching indexed filters(true: all; false: only the one on the first level) "actions_conns": [], // connections to ActionS to execute the actions + "opts":{}, // }, diff --git a/config/config_it_test.go b/config/config_it_test.go index da89d3060..d75288d42 100644 --- a/config/config_it_test.go +++ b/config/config_it_test.go @@ -270,6 +270,7 @@ func testCGRConfigReloadThresholdS(t *testing.T) { SuffixIndexedFields: &[]string{}, ActionSConns: []string{}, IndexedSelects: true, + Opts: &ThresholdsOpts{}, } if !reflect.DeepEqual(expAttr, cfg.ThresholdSCfg()) { t.Errorf("Expected %s , received: %s ", utils.ToJSON(expAttr), utils.ToJSON(cfg.ThresholdSCfg())) diff --git a/config/config_json_test.go b/config/config_json_test.go index 659e17c1d..2f4ba9bc2 100644 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -862,6 +862,7 @@ func TestDfThresholdSJsonCfg(t *testing.T) { Suffix_indexed_fields: &[]string{}, Nested_fields: utils.BoolPointer(false), Actions_conns: &[]string{}, + Opts: &ThresholdsOptsJson{}, } dfCgrJSONCfg, err := NewCgrJsonCfgFromBytes([]byte(CGRATES_CFG_JSON)) if err != nil { diff --git a/config/config_test.go b/config/config_test.go index daf9af7e5..0cd9294e5 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -721,6 +721,7 @@ func TestCgrCfgJSONDefaultThresholdSCfg(t *testing.T) { PrefixIndexedFields: &[]string{}, SuffixIndexedFields: &[]string{}, ActionSConns: []string{}, + Opts: &ThresholdsOpts{}, } if !reflect.DeepEqual(eThresholdSCfg, cgrCfg.thresholdSCfg) { t.Errorf("received: %+v, expecting: %+v", eThresholdSCfg, cgrCfg.thresholdSCfg) @@ -1932,6 +1933,7 @@ func TestThresholdSConfig(t *testing.T) { SuffixIndexedFields: &[]string{}, NestedFields: false, ActionSConns: []string{}, + Opts: &ThresholdsOpts{}, } cgrConfig := NewDefaultCGRConfig() if err != nil { @@ -4245,6 +4247,9 @@ func TestV1GetConfigThresholds(t *testing.T) { utils.SuffixIndexedFieldsCfg: []string{}, utils.NestedFieldsCfg: false, utils.ActionSConnsCfg: []string{}, + utils.OptsCfg: map[string]interface{}{ + utils.MetaThresholdIDsCfg: []string(nil), + }, }, } cfgCgr := NewDefaultCGRConfig() @@ -5069,7 +5074,7 @@ func TestV1GetConfigAsJSONStatS(t *testing.T) { func TestV1GetConfigAsJSONThresholdS(t *testing.T) { var reply string - expected := `{"thresholds":{"actions_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[]}}` + expected := `{"thresholds":{"actions_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"opts":{"*thresholdIDs":null},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[]}}` cgrCfg := NewDefaultCGRConfig() if err := cgrCfg.V1GetConfigAsJSON(context.Background(), &SectionWithAPIOpts{Sections: []string{ThresholdSJSON}}, &reply); err != nil { t.Error(err) @@ -5349,7 +5354,7 @@ func TestV1GetConfigAsJSONAllConfig(t *testing.T) { } }` var reply string - expected := `{"accounts":{"attributes_conns":[],"enabled":false,"indexed_selects":true,"max_iterations":1000,"max_usage":"259200000000000","nested_fields":false,"prefix_indexed_fields":[],"rates_conns":[],"suffix_indexed_fields":[],"thresholds_conns":[]},"actions":{"accounts_conns":[],"cdrs_conns":[],"dynaprepaid_actionprofile":[],"ees_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"stats_conns":[],"suffix_indexed_fields":[],"tenants":[],"thresholds_conns":[]},"admins":{"actions_conns":[],"attributes_conns":[],"caches_conns":["*internal"],"ees_conns":[],"enabled":false},"analyzers":{"cleanup_interval":"1h0m0s","db_path":"/var/spool/cgrates/analyzers","enabled":false,"index_type":"*scorch","ttl":"24h0m0s"},"apiban":{"enabled":false,"keys":[]},"asterisk_agent":{"asterisk_conns":[{"address":"127.0.0.1:8088","alias":"","connect_attempts":3,"password":"CGRateS.org","reconnects":5,"user":"cgrates"}],"create_cdr":false,"enabled":false,"sessions_conns":["*birpc_internal"]},"attributes":{"accounts_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"opts":{"*attributeIDs":null,"*processRuns":1,"*profileRuns":0},"prefix_indexed_fields":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"caches":{"partitions":{"*account_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*accounts":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*action_profile_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*action_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*apiban":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"2m0s"},"*attribute_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*attribute_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*caps_events":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*cdr_ids":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"10m0s"},"*cdrs":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*charger_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*charger_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*closed_sessions":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*diameter_messages":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*dispatcher_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatcher_hosts":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatcher_loads":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatcher_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatcher_routes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatchers":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*event_charges":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*event_resources":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*filters":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*load_ids":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rate_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rate_profile_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rate_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*replication_hosts":{"limit":0,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*resource_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*resource_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*resources":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*reverse_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*route_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*route_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rpc_connections":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rpc_responses":{"limit":0,"precache":false,"replicate":false,"static_ttl":false,"ttl":"2s"},"*session_costs":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*stat_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*statqueue_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*statqueues":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*stir":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*threshold_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*threshold_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*thresholds":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_accounts":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_action_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_attributes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_chargers":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_dispatcher_hosts":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_dispatcher_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_filters":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_rate_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_resources":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_routes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_stats":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_thresholds":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*uch":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*versions":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""}},"replication_conns":[]},"cdrs":{"accounts_conns":[],"actions_conns":[],"attributes_conns":[],"chargers_conns":[],"ees_conns":[],"enabled":false,"extra_fields":[],"online_cdr_exports":[],"rates_conns":[],"session_cost_retries":5,"stats_conns":[],"store_cdrs":true,"thresholds_conns":[]},"chargers":{"attributes_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"suffix_indexed_fields":[]},"config_db":{"db_host":"","db_name":"","db_password":"","db_port":0,"db_type":"*internal","db_user":"","items":{},"opts":{"mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0","redisClusterSync":"5s","redisSentinel":"","redisTLS":false},"remote_conn_id":"","remote_conns":null,"replication_cache":"","replication_conns":null,"replication_filtered":false},"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":{"*accounts":{"remote":false,"replicate":false},"*action_profiles":{"remote":false,"replicate":false},"*actions":{"remote":false,"replicate":false},"*attribute_profiles":{"remote":false,"replicate":false},"*charger_profiles":{"remote":false,"replicate":false},"*dispatcher_hosts":{"remote":false,"replicate":false},"*dispatcher_profiles":{"remote":false,"replicate":false},"*filters":{"remote":false,"replicate":false},"*indexes":{"remote":false,"replicate":false},"*load_ids":{"remote":false,"replicate":false},"*rate_profiles":{"remote":false,"replicate":false},"*resource_profiles":{"remote":false,"replicate":false},"*resources":{"remote":false,"replicate":false},"*route_profiles":{"remote":false,"replicate":false},"*statqueue_profiles":{"remote":false,"replicate":false},"*statqueues":{"remote":false,"replicate":false},"*threshold_profiles":{"remote":false,"replicate":false},"*thresholds":{"remote":false,"replicate":false}},"opts":{"mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0","redisClusterSync":"5s","redisSentinel":"","redisTLS":false},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_filtered":false},"diameter_agent":{"asr_template":"","concurrent_requests":-1,"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"],"synced_conn_requests":false,"vendor_id":0},"dispatchers":{"attributes_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"suffix_indexed_fields":[]},"dns_agent":{"enabled":false,"listen":"127.0.0.1:2053","listen_net":"udp","request_processors":[],"sessions_conns":["*internal"],"timezone":""},"ees":{"attributes_conns":[],"cache":{"*fileCSV":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"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","opts":{},"synchronous":false,"timezone":"","type":"*none"}]},"ers":{"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","opts":{"csvFieldSeparator":",","csvHeaderDefineChar":":","csvRowLength":0,"natsSubject":"cgrates_cdrs","partialCacheAction":"*none","partialOrderField":"~*req.AnswerTime","xmlRootPath":""},"partial_commit_fields":[],"processed_path":"/var/spool/cgrates/ers/out","run_delay":"0","source_path":"/var/spool/cgrates/ers/in","tenant":"","timezone":"","type":"*none"}],"sessions_conns":["*internal"]},"filters":{"accounts_conns":[],"resources_conns":[],"stats_conns":[]},"freeswitch_agent":{"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","password":"ClueCon","reconnects":5}],"extra_fields":[],"low_balance_ann_file":"","max_wait_connection":"2s","sessions_conns":["*birpc_internal"],"subscribe_park":true},"general":{"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,"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":"0","forceAttemptHttp2":true,"idleConnTimeout":"90s","maxConnsPerHost":0,"maxIdleConns":100,"maxIdleConnsPerHost":2,"responseHeaderTimeout":"0","skipTlsVerify":false,"tlsHandshakeTimeout":"10s"},"freeswitch_cdrs_url":"/freeswitch_json","http_cdrs":"/cdr_http","json_rpc_url":"/jsonrpc","registrars_url":"/registrar","use_basic_auth":false,"ws_url":"/ws"},"http_agent":[],"kamailio_agent":{"create_cdr":false,"enabled":false,"evapi_conns":[{"address":"127.0.0.1:8448","alias":"","reconnects":5}],"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":{"actions_conns":["*localhost"],"caches_conns":["*localhost"],"data_path":"./","disable_reverse":false,"field_separator":",","gapi_credentials":".gapi/credentials.json","gapi_token":".gapi/token.json","tpid":""},"loaders":[{"caches_conns":["*internal"],"data":[{"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"}],"file_name":"Filters.csv","flags":null,"type":"*filters"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"TenantID","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ProfileID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.3"},{"path":"AttributeFilterIDs","tag":"AttributeFilterIDs","type":"*variable","value":"~*req.4"},{"path":"Path","tag":"Path","type":"*variable","value":"~*req.5"},{"path":"Type","tag":"Type","type":"*variable","value":"~*req.6"},{"path":"Value","tag":"Value","type":"*variable","value":"~*req.7"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.8"}],"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":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weight","tag":"Weight","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":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.9"}],"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":"Weight","tag":"Weight","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":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.11"}],"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":"Weight","tag":"Weight","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":"ActionProfileIDs","tag":"ActionProfileIDs","type":"*variable","value":"~*req.8"},{"path":"Async","tag":"Async","type":"*variable","value":"~*req.9"}],"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":"Weights","tag":"Weights","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":"RouteRateProfileIDs","tag":"RouteRateProfileIDs","type":"*variable","value":"~*req.9"},{"path":"RouteResourceIDs","tag":"RouteResourceIDs","type":"*variable","value":"~*req.10"},{"path":"RouteStatIDs","tag":"RouteStatIDs","type":"*variable","value":"~*req.11"},{"path":"RouteWeights","tag":"RouteWeights","type":"*variable","value":"~*req.12"},{"path":"RouteBlocker","tag":"RouteBlocker","type":"*variable","value":"~*req.13"},{"path":"RouteParameters","tag":"RouteParameters","type":"*variable","value":"~*req.14"}],"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":"Weight","tag":"Weight","type":"*variable","value":"~*req.3"},{"path":"RunID","tag":"RunID","type":"*variable","value":"~*req.4"},{"path":"AttributeIDs","tag":"AttributeIDs","type":"*variable","value":"~*req.5"}],"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":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.3"},{"path":"Strategy","tag":"Strategy","type":"*variable","value":"~*req.4"},{"path":"StrategyParameters","tag":"StrategyParameters","type":"*variable","value":"~*req.5"},{"path":"ConnID","tag":"ConnID","type":"*variable","value":"~*req.6"},{"path":"ConnFilterIDs","tag":"ConnFilterIDs","type":"*variable","value":"~*req.7"},{"path":"ConnWeight","tag":"ConnWeight","type":"*variable","value":"~*req.8"},{"path":"ConnBlocker","tag":"ConnBlocker","type":"*variable","value":"~*req.9"},{"path":"ConnParameters","tag":"ConnParameters","type":"*variable","value":"~*req.10"}],"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":"ConnectTimeout","tag":"ConnectTimeout","type":"*variable","value":"~*req.6"},{"path":"ReplyTimeout","tag":"ReplyTimeout","type":"*variable","value":"~*req.7"},{"path":"TLS","tag":"TLS","type":"*variable","value":"~*req.8"},{"path":"ClientKey","tag":"ClientKey","type":"*variable","value":"~*req.9"},{"path":"ClientCertificate","tag":"ClientCertificate","type":"*variable","value":"~*req.10"},{"path":"CaCertificate","tag":"CaCertificate","type":"*variable","value":"~*req.11"}],"file_name":"DispatcherHosts.csv","flags":null,"type":"*dispatcher_hosts"},{"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":"Weight","tag":"Weight","type":"*variable","value":"~*req.3"},{"path":"MinCost","tag":"MinCost","type":"*variable","value":"~*req.4"},{"path":"MaxCost","tag":"MaxCost","type":"*variable","value":"~*req.5"},{"path":"MaxCostStrategy","tag":"MaxCostStrategy","type":"*variable","value":"~*req.6"},{"path":"RateID","tag":"RateID","type":"*variable","value":"~*req.7"},{"path":"RateFilterIDs","tag":"RateFilterIDs","type":"*variable","value":"~*req.8"},{"path":"RateActivationTimes","tag":"RateActivationTimes","type":"*variable","value":"~*req.9"},{"path":"RateWeight","tag":"RateWeight","type":"*variable","value":"~*req.10"},{"path":"RateBlocker","tag":"RateBlocker","type":"*variable","value":"~*req.11"},{"path":"RateIntervalStart","tag":"RateIntervalStart","type":"*variable","value":"~*req.12"},{"path":"RateFixedFee","tag":"RateFixedFee","type":"*variable","value":"~*req.13"},{"path":"RateRecurrentFee","tag":"RateRecurrentFee","type":"*variable","value":"~*req.14"},{"path":"RateUnit","tag":"RateUnit","type":"*variable","value":"~*req.15"},{"path":"RateIncrement","tag":"RateIncrement","type":"*variable","value":"~*req.16"}],"file_name":"RateProfiles.csv","flags":null,"type":"*rate_profiles"},{"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":"Weight","tag":"Weight","type":"*variable","value":"~*req.3"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.4"},{"path":"TargetType","tag":"TargetType","type":"*variable","value":"~*req.5"},{"path":"TargetIDs","tag":"TargetIDs","type":"*variable","value":"~*req.6"},{"path":"ActionID","tag":"ActionID","type":"*variable","value":"~*req.7"},{"path":"ActionFilterIDs","tag":"ActionFilterIDs","type":"*variable","value":"~*req.8"},{"path":"ActionBlocker","tag":"ActionBlocker","type":"*variable","value":"~*req.9"},{"path":"ActionTTL","tag":"ActionTTL","type":"*variable","value":"~*req.10"},{"path":"ActionType","tag":"ActionType","type":"*variable","value":"~*req.11"},{"path":"ActionOpts","tag":"ActionOpts","type":"*variable","value":"~*req.12"},{"path":"ActionPath","tag":"ActionPath","type":"*variable","value":"~*req.13"},{"path":"ActionValue","tag":"ActionValue","type":"*variable","value":"~*req.14"}],"file_name":"ActionProfiles.csv","flags":null,"type":"*action_profiles"},{"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":"Weight","tag":"Weight","type":"*variable","value":"~*req.3"},{"path":"BalanceID","tag":"BalanceID","type":"*variable","value":"~*req.4"},{"path":"BalanceFilterIDs","tag":"BalanceFilterIDs","type":"*variable","value":"~*req.5"},{"path":"BalanceWeight","tag":"BalanceWeight","type":"*variable","value":"~*req.6"},{"path":"BalanceBlocker","tag":"BalanceBlocker","type":"*variable","value":"~*req.7"},{"path":"BalanceType","tag":"BalanceType","type":"*variable","value":"~*req.8"},{"path":"BalanceOpts","tag":"BalanceOpts","type":"*variable","value":"~*req.9"},{"path":"BalanceCostIncrements","tag":"BalanceCostIncrements","type":"*variable","value":"~*req.10"},{"path":"BalanceAttributeIDs","tag":"BalanceAttributeIDs","type":"*variable","value":"~*req.11"},{"path":"BalanceRateProfileIDs","tag":"BalanceRateProfileIDs","type":"*variable","value":"~*req.12"},{"path":"BalanceUnitFactors","tag":"BalanceUnitFactors","type":"*variable","value":"~*req.13"},{"path":"BalanceUnits","tag":"BalanceUnits","type":"*variable","value":"~*req.14"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.15"}],"file_name":"Accounts.csv","flags":null,"type":"*accounts"}],"dry_run":false,"enabled":false,"field_separator":",","id":"*default","lock_filename":".cgr.lck","run_delay":"0","tenant":"","tp_in_dir":"/var/spool/cgrates/loader/in","tp_out_dir":"/var/spool/cgrates/loader/out"}],"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0","redisClusterSync":"5s","redisSentinel":"","redisTLS":false},"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":{},"out_stordb_password":"","out_stordb_port":"3306","out_stordb_type":"mysql","out_stordb_user":"cgrates","users_filters":[]},"radius_agent":{"client_dictionaries":{"*default":"/usr/share/cgrates/radius/dict/"},"client_secrets":{"*default":"CGRateS.org"},"enabled":false,"listen_acct":"127.0.0.1:1813","listen_auth":"127.0.0.1:1812","listen_net":"udp","request_processors":[],"sessions_conns":["*internal"]},"rates":{"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"rate_indexed_selects":true,"rate_nested_fields":false,"rate_prefix_indexed_fields":[],"rate_suffix_indexed_fields":[],"suffix_indexed_fields":[],"verbosity":1000},"registrarc":{"dispatchers":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]},"rpc":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]}},"resources":{"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[],"thresholds_conns":[]},"routes":{"accounts_conns":[],"attributes_conns":[],"default_ratio":1,"enabled":false,"indexed_selects":true,"nested_fields":false,"opts":{"*context":"*routes","*ignoreErrors":false,"*maxCost":"","*profileCount":1},"prefix_indexed_fields":[],"rates_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"}},"sessions":{"actions_conns":[],"alterable_fields":[],"attributes_conns":[],"cdrs_conns":[],"channel_sync_interval":"0","chargers_conns":[],"client_protocol":1,"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","replication_conns":[],"resources_conns":[],"routes_conns":[],"session_indexes":[],"session_ttl":"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":"1s","sessions_conns":["*internal"],"timezone":""},"stats":{"enabled":false,"indexed_selects":true,"nested_fields":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":"","db_port":3306,"db_type":"*mysql","db_user":"cgrates","items":{"*cdrs":{"remote":false,"replicate":false},"*session_costs":{"remote":false,"replicate":false},"*tp_accounts":{"remote":false,"replicate":false},"*tp_action_profiles":{"remote":false,"replicate":false},"*tp_attributes":{"remote":false,"replicate":false},"*tp_chargers":{"remote":false,"replicate":false},"*tp_dispatcher_hosts":{"remote":false,"replicate":false},"*tp_dispatcher_profiles":{"remote":false,"replicate":false},"*tp_filters":{"remote":false,"replicate":false},"*tp_rate_profiles":{"remote":false,"replicate":false},"*tp_resources":{"remote":false,"replicate":false},"*tp_routes":{"remote":false,"replicate":false},"*tp_stats":{"remote":false,"replicate":false},"*tp_thresholds":{"remote":false,"replicate":false},"*versions":{"remote":false,"replicate":false}},"opts":{"mongoQueryTimeout":"10s","mysqlLocation":"Local","sqlConnMaxLifetime":0,"sqlMaxIdleConns":10,"sqlMaxOpenConns":100,"sslMode":"disable"},"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"}],"*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":{"actions_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":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}}` + expected := `{"accounts":{"attributes_conns":[],"enabled":false,"indexed_selects":true,"max_iterations":1000,"max_usage":"259200000000000","nested_fields":false,"prefix_indexed_fields":[],"rates_conns":[],"suffix_indexed_fields":[],"thresholds_conns":[]},"actions":{"accounts_conns":[],"cdrs_conns":[],"dynaprepaid_actionprofile":[],"ees_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"stats_conns":[],"suffix_indexed_fields":[],"tenants":[],"thresholds_conns":[]},"admins":{"actions_conns":[],"attributes_conns":[],"caches_conns":["*internal"],"ees_conns":[],"enabled":false},"analyzers":{"cleanup_interval":"1h0m0s","db_path":"/var/spool/cgrates/analyzers","enabled":false,"index_type":"*scorch","ttl":"24h0m0s"},"apiban":{"enabled":false,"keys":[]},"asterisk_agent":{"asterisk_conns":[{"address":"127.0.0.1:8088","alias":"","connect_attempts":3,"password":"CGRateS.org","reconnects":5,"user":"cgrates"}],"create_cdr":false,"enabled":false,"sessions_conns":["*birpc_internal"]},"attributes":{"accounts_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"opts":{"*attributeIDs":null,"*processRuns":1,"*profileRuns":0},"prefix_indexed_fields":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"caches":{"partitions":{"*account_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*accounts":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*action_profile_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*action_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*apiban":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"2m0s"},"*attribute_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*attribute_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*caps_events":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*cdr_ids":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"10m0s"},"*cdrs":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*charger_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*charger_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*closed_sessions":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*diameter_messages":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*dispatcher_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatcher_hosts":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatcher_loads":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatcher_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatcher_routes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatchers":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*event_charges":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*event_resources":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*filters":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*load_ids":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rate_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rate_profile_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rate_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*replication_hosts":{"limit":0,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*resource_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*resource_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*resources":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*reverse_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*route_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*route_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rpc_connections":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rpc_responses":{"limit":0,"precache":false,"replicate":false,"static_ttl":false,"ttl":"2s"},"*session_costs":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*stat_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*statqueue_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*statqueues":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*stir":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*threshold_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*threshold_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*thresholds":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_accounts":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_action_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_attributes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_chargers":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_dispatcher_hosts":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_dispatcher_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_filters":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_rate_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_resources":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_routes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_stats":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_thresholds":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*uch":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*versions":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""}},"replication_conns":[]},"cdrs":{"accounts_conns":[],"actions_conns":[],"attributes_conns":[],"chargers_conns":[],"ees_conns":[],"enabled":false,"extra_fields":[],"online_cdr_exports":[],"rates_conns":[],"session_cost_retries":5,"stats_conns":[],"store_cdrs":true,"thresholds_conns":[]},"chargers":{"attributes_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"suffix_indexed_fields":[]},"config_db":{"db_host":"","db_name":"","db_password":"","db_port":0,"db_type":"*internal","db_user":"","items":{},"opts":{"mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0","redisClusterSync":"5s","redisSentinel":"","redisTLS":false},"remote_conn_id":"","remote_conns":null,"replication_cache":"","replication_conns":null,"replication_filtered":false},"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":{"*accounts":{"remote":false,"replicate":false},"*action_profiles":{"remote":false,"replicate":false},"*actions":{"remote":false,"replicate":false},"*attribute_profiles":{"remote":false,"replicate":false},"*charger_profiles":{"remote":false,"replicate":false},"*dispatcher_hosts":{"remote":false,"replicate":false},"*dispatcher_profiles":{"remote":false,"replicate":false},"*filters":{"remote":false,"replicate":false},"*indexes":{"remote":false,"replicate":false},"*load_ids":{"remote":false,"replicate":false},"*rate_profiles":{"remote":false,"replicate":false},"*resource_profiles":{"remote":false,"replicate":false},"*resources":{"remote":false,"replicate":false},"*route_profiles":{"remote":false,"replicate":false},"*statqueue_profiles":{"remote":false,"replicate":false},"*statqueues":{"remote":false,"replicate":false},"*threshold_profiles":{"remote":false,"replicate":false},"*thresholds":{"remote":false,"replicate":false}},"opts":{"mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0","redisClusterSync":"5s","redisSentinel":"","redisTLS":false},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_filtered":false},"diameter_agent":{"asr_template":"","concurrent_requests":-1,"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"],"synced_conn_requests":false,"vendor_id":0},"dispatchers":{"attributes_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"suffix_indexed_fields":[]},"dns_agent":{"enabled":false,"listen":"127.0.0.1:2053","listen_net":"udp","request_processors":[],"sessions_conns":["*internal"],"timezone":""},"ees":{"attributes_conns":[],"cache":{"*fileCSV":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"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","opts":{},"synchronous":false,"timezone":"","type":"*none"}]},"ers":{"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","opts":{"csvFieldSeparator":",","csvHeaderDefineChar":":","csvRowLength":0,"natsSubject":"cgrates_cdrs","partialCacheAction":"*none","partialOrderField":"~*req.AnswerTime","xmlRootPath":""},"partial_commit_fields":[],"processed_path":"/var/spool/cgrates/ers/out","run_delay":"0","source_path":"/var/spool/cgrates/ers/in","tenant":"","timezone":"","type":"*none"}],"sessions_conns":["*internal"]},"filters":{"accounts_conns":[],"resources_conns":[],"stats_conns":[]},"freeswitch_agent":{"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","password":"ClueCon","reconnects":5}],"extra_fields":[],"low_balance_ann_file":"","max_wait_connection":"2s","sessions_conns":["*birpc_internal"],"subscribe_park":true},"general":{"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,"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":"0","forceAttemptHttp2":true,"idleConnTimeout":"90s","maxConnsPerHost":0,"maxIdleConns":100,"maxIdleConnsPerHost":2,"responseHeaderTimeout":"0","skipTlsVerify":false,"tlsHandshakeTimeout":"10s"},"freeswitch_cdrs_url":"/freeswitch_json","http_cdrs":"/cdr_http","json_rpc_url":"/jsonrpc","registrars_url":"/registrar","use_basic_auth":false,"ws_url":"/ws"},"http_agent":[],"kamailio_agent":{"create_cdr":false,"enabled":false,"evapi_conns":[{"address":"127.0.0.1:8448","alias":"","reconnects":5}],"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":{"actions_conns":["*localhost"],"caches_conns":["*localhost"],"data_path":"./","disable_reverse":false,"field_separator":",","gapi_credentials":".gapi/credentials.json","gapi_token":".gapi/token.json","tpid":""},"loaders":[{"caches_conns":["*internal"],"data":[{"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"}],"file_name":"Filters.csv","flags":null,"type":"*filters"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"TenantID","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ProfileID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.3"},{"path":"AttributeFilterIDs","tag":"AttributeFilterIDs","type":"*variable","value":"~*req.4"},{"path":"Path","tag":"Path","type":"*variable","value":"~*req.5"},{"path":"Type","tag":"Type","type":"*variable","value":"~*req.6"},{"path":"Value","tag":"Value","type":"*variable","value":"~*req.7"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.8"}],"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":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weight","tag":"Weight","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":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.9"}],"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":"Weight","tag":"Weight","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":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.11"}],"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":"Weight","tag":"Weight","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":"ActionProfileIDs","tag":"ActionProfileIDs","type":"*variable","value":"~*req.8"},{"path":"Async","tag":"Async","type":"*variable","value":"~*req.9"}],"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":"Weights","tag":"Weights","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":"RouteRateProfileIDs","tag":"RouteRateProfileIDs","type":"*variable","value":"~*req.9"},{"path":"RouteResourceIDs","tag":"RouteResourceIDs","type":"*variable","value":"~*req.10"},{"path":"RouteStatIDs","tag":"RouteStatIDs","type":"*variable","value":"~*req.11"},{"path":"RouteWeights","tag":"RouteWeights","type":"*variable","value":"~*req.12"},{"path":"RouteBlocker","tag":"RouteBlocker","type":"*variable","value":"~*req.13"},{"path":"RouteParameters","tag":"RouteParameters","type":"*variable","value":"~*req.14"}],"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":"Weight","tag":"Weight","type":"*variable","value":"~*req.3"},{"path":"RunID","tag":"RunID","type":"*variable","value":"~*req.4"},{"path":"AttributeIDs","tag":"AttributeIDs","type":"*variable","value":"~*req.5"}],"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":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.3"},{"path":"Strategy","tag":"Strategy","type":"*variable","value":"~*req.4"},{"path":"StrategyParameters","tag":"StrategyParameters","type":"*variable","value":"~*req.5"},{"path":"ConnID","tag":"ConnID","type":"*variable","value":"~*req.6"},{"path":"ConnFilterIDs","tag":"ConnFilterIDs","type":"*variable","value":"~*req.7"},{"path":"ConnWeight","tag":"ConnWeight","type":"*variable","value":"~*req.8"},{"path":"ConnBlocker","tag":"ConnBlocker","type":"*variable","value":"~*req.9"},{"path":"ConnParameters","tag":"ConnParameters","type":"*variable","value":"~*req.10"}],"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":"ConnectTimeout","tag":"ConnectTimeout","type":"*variable","value":"~*req.6"},{"path":"ReplyTimeout","tag":"ReplyTimeout","type":"*variable","value":"~*req.7"},{"path":"TLS","tag":"TLS","type":"*variable","value":"~*req.8"},{"path":"ClientKey","tag":"ClientKey","type":"*variable","value":"~*req.9"},{"path":"ClientCertificate","tag":"ClientCertificate","type":"*variable","value":"~*req.10"},{"path":"CaCertificate","tag":"CaCertificate","type":"*variable","value":"~*req.11"}],"file_name":"DispatcherHosts.csv","flags":null,"type":"*dispatcher_hosts"},{"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":"Weight","tag":"Weight","type":"*variable","value":"~*req.3"},{"path":"MinCost","tag":"MinCost","type":"*variable","value":"~*req.4"},{"path":"MaxCost","tag":"MaxCost","type":"*variable","value":"~*req.5"},{"path":"MaxCostStrategy","tag":"MaxCostStrategy","type":"*variable","value":"~*req.6"},{"path":"RateID","tag":"RateID","type":"*variable","value":"~*req.7"},{"path":"RateFilterIDs","tag":"RateFilterIDs","type":"*variable","value":"~*req.8"},{"path":"RateActivationTimes","tag":"RateActivationTimes","type":"*variable","value":"~*req.9"},{"path":"RateWeight","tag":"RateWeight","type":"*variable","value":"~*req.10"},{"path":"RateBlocker","tag":"RateBlocker","type":"*variable","value":"~*req.11"},{"path":"RateIntervalStart","tag":"RateIntervalStart","type":"*variable","value":"~*req.12"},{"path":"RateFixedFee","tag":"RateFixedFee","type":"*variable","value":"~*req.13"},{"path":"RateRecurrentFee","tag":"RateRecurrentFee","type":"*variable","value":"~*req.14"},{"path":"RateUnit","tag":"RateUnit","type":"*variable","value":"~*req.15"},{"path":"RateIncrement","tag":"RateIncrement","type":"*variable","value":"~*req.16"}],"file_name":"RateProfiles.csv","flags":null,"type":"*rate_profiles"},{"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":"Weight","tag":"Weight","type":"*variable","value":"~*req.3"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.4"},{"path":"TargetType","tag":"TargetType","type":"*variable","value":"~*req.5"},{"path":"TargetIDs","tag":"TargetIDs","type":"*variable","value":"~*req.6"},{"path":"ActionID","tag":"ActionID","type":"*variable","value":"~*req.7"},{"path":"ActionFilterIDs","tag":"ActionFilterIDs","type":"*variable","value":"~*req.8"},{"path":"ActionBlocker","tag":"ActionBlocker","type":"*variable","value":"~*req.9"},{"path":"ActionTTL","tag":"ActionTTL","type":"*variable","value":"~*req.10"},{"path":"ActionType","tag":"ActionType","type":"*variable","value":"~*req.11"},{"path":"ActionOpts","tag":"ActionOpts","type":"*variable","value":"~*req.12"},{"path":"ActionPath","tag":"ActionPath","type":"*variable","value":"~*req.13"},{"path":"ActionValue","tag":"ActionValue","type":"*variable","value":"~*req.14"}],"file_name":"ActionProfiles.csv","flags":null,"type":"*action_profiles"},{"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":"Weight","tag":"Weight","type":"*variable","value":"~*req.3"},{"path":"BalanceID","tag":"BalanceID","type":"*variable","value":"~*req.4"},{"path":"BalanceFilterIDs","tag":"BalanceFilterIDs","type":"*variable","value":"~*req.5"},{"path":"BalanceWeight","tag":"BalanceWeight","type":"*variable","value":"~*req.6"},{"path":"BalanceBlocker","tag":"BalanceBlocker","type":"*variable","value":"~*req.7"},{"path":"BalanceType","tag":"BalanceType","type":"*variable","value":"~*req.8"},{"path":"BalanceOpts","tag":"BalanceOpts","type":"*variable","value":"~*req.9"},{"path":"BalanceCostIncrements","tag":"BalanceCostIncrements","type":"*variable","value":"~*req.10"},{"path":"BalanceAttributeIDs","tag":"BalanceAttributeIDs","type":"*variable","value":"~*req.11"},{"path":"BalanceRateProfileIDs","tag":"BalanceRateProfileIDs","type":"*variable","value":"~*req.12"},{"path":"BalanceUnitFactors","tag":"BalanceUnitFactors","type":"*variable","value":"~*req.13"},{"path":"BalanceUnits","tag":"BalanceUnits","type":"*variable","value":"~*req.14"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.15"}],"file_name":"Accounts.csv","flags":null,"type":"*accounts"}],"dry_run":false,"enabled":false,"field_separator":",","id":"*default","lock_filename":".cgr.lck","run_delay":"0","tenant":"","tp_in_dir":"/var/spool/cgrates/loader/in","tp_out_dir":"/var/spool/cgrates/loader/out"}],"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0","redisClusterSync":"5s","redisSentinel":"","redisTLS":false},"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":{},"out_stordb_password":"","out_stordb_port":"3306","out_stordb_type":"mysql","out_stordb_user":"cgrates","users_filters":[]},"radius_agent":{"client_dictionaries":{"*default":"/usr/share/cgrates/radius/dict/"},"client_secrets":{"*default":"CGRateS.org"},"enabled":false,"listen_acct":"127.0.0.1:1813","listen_auth":"127.0.0.1:1812","listen_net":"udp","request_processors":[],"sessions_conns":["*internal"]},"rates":{"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"rate_indexed_selects":true,"rate_nested_fields":false,"rate_prefix_indexed_fields":[],"rate_suffix_indexed_fields":[],"suffix_indexed_fields":[],"verbosity":1000},"registrarc":{"dispatchers":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]},"rpc":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]}},"resources":{"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[],"thresholds_conns":[]},"routes":{"accounts_conns":[],"attributes_conns":[],"default_ratio":1,"enabled":false,"indexed_selects":true,"nested_fields":false,"opts":{"*context":"*routes","*ignoreErrors":false,"*maxCost":"","*profileCount":1},"prefix_indexed_fields":[],"rates_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"}},"sessions":{"actions_conns":[],"alterable_fields":[],"attributes_conns":[],"cdrs_conns":[],"channel_sync_interval":"0","chargers_conns":[],"client_protocol":1,"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","replication_conns":[],"resources_conns":[],"routes_conns":[],"session_indexes":[],"session_ttl":"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":"1s","sessions_conns":["*internal"],"timezone":""},"stats":{"enabled":false,"indexed_selects":true,"nested_fields":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":"","db_port":3306,"db_type":"*mysql","db_user":"cgrates","items":{"*cdrs":{"remote":false,"replicate":false},"*session_costs":{"remote":false,"replicate":false},"*tp_accounts":{"remote":false,"replicate":false},"*tp_action_profiles":{"remote":false,"replicate":false},"*tp_attributes":{"remote":false,"replicate":false},"*tp_chargers":{"remote":false,"replicate":false},"*tp_dispatcher_hosts":{"remote":false,"replicate":false},"*tp_dispatcher_profiles":{"remote":false,"replicate":false},"*tp_filters":{"remote":false,"replicate":false},"*tp_rate_profiles":{"remote":false,"replicate":false},"*tp_resources":{"remote":false,"replicate":false},"*tp_routes":{"remote":false,"replicate":false},"*tp_stats":{"remote":false,"replicate":false},"*tp_thresholds":{"remote":false,"replicate":false},"*versions":{"remote":false,"replicate":false}},"opts":{"mongoQueryTimeout":"10s","mysqlLocation":"Local","sqlConnMaxLifetime":0,"sqlMaxIdleConns":10,"sqlMaxOpenConns":100,"sslMode":"disable"},"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"}],"*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":{"actions_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"opts":{"*thresholdIDs":null},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[]},"tls":{"ca_certificate":"","client_certificate":"","client_key":"","server_certificate":"","server_key":"","server_name":"","server_policy":4}}` cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSON) if err != nil { t.Fatal(err) diff --git a/config/thresholdscfg.go b/config/thresholdscfg.go index 5d8e592cc..9f291012c 100644 --- a/config/thresholdscfg.go +++ b/config/thresholdscfg.go @@ -24,6 +24,10 @@ import ( "github.com/cgrates/cgrates/utils" ) +type ThresholdsOpts struct { + ThresholdIDs []string +} + // ThresholdSCfg the threshold config section type ThresholdSCfg struct { Enabled bool @@ -34,6 +38,18 @@ type ThresholdSCfg struct { SuffixIndexedFields *[]string NestedFields bool ActionSConns []string // connections towards ActionS + Opts *ThresholdsOpts +} + +func (thdOpts *ThresholdsOpts) loadFromJSONCfg(jsnCfg *ThresholdsOptsJson) (err error) { + if jsnCfg == nil { + return nil + } + if jsnCfg.ThresholdIDs != nil { + thdOpts.ThresholdIDs = *jsnCfg.ThresholdIDs + } + + return nil } func (t *ThresholdSCfg) loadFromJSONCfg(jsnCfg *ThresholdSJsonCfg) (err error) { @@ -66,16 +82,23 @@ func (t *ThresholdSCfg) loadFromJSONCfg(jsnCfg *ThresholdSJsonCfg) (err error) { if jsnCfg.Actions_conns != nil { t.ActionSConns = updateInternalConns(*jsnCfg.Actions_conns, utils.MetaActions) } + if jsnCfg.Opts != nil { + t.Opts.loadFromJSONCfg(jsnCfg.Opts) + } return nil } // AsMapInterface returns the config as a map[string]interface{} func (t *ThresholdSCfg) AsMapInterface() (initialMP map[string]interface{}) { + opts := map[string]interface{}{ + utils.MetaThresholdIDsCfg: t.Opts.ThresholdIDs, + } initialMP = map[string]interface{}{ utils.EnabledCfg: t.Enabled, utils.IndexedSelectsCfg: t.IndexedSelects, utils.NestedFieldsCfg: t.NestedFields, utils.StoreIntervalCfg: utils.EmptyString, + utils.OptsCfg: opts, } if t.StoreInterval != 0 { initialMP[utils.StoreIntervalCfg] = t.StoreInterval.String() @@ -96,6 +119,16 @@ func (t *ThresholdSCfg) AsMapInterface() (initialMP map[string]interface{}) { return } +func (thdOpts *ThresholdsOpts) Clone() *ThresholdsOpts { + var thdIDs []string + if thdOpts.ThresholdIDs != nil { + thdIDs = utils.CloneStringSlice(thdOpts.ThresholdIDs) + } + return &ThresholdsOpts{ + ThresholdIDs: thdIDs, + } +} + // Clone returns a deep copy of ThresholdSCfg func (t ThresholdSCfg) Clone() (cln *ThresholdSCfg) { cln = &ThresholdSCfg{ @@ -105,6 +138,9 @@ func (t ThresholdSCfg) Clone() (cln *ThresholdSCfg) { NestedFields: t.NestedFields, } + if t.Opts != nil { + cln.Opts = t.Opts.Clone() + } if t.StringIndexedFields != nil { cln.StringIndexedFields = utils.SliceStringPointer(utils.CloneStringSlice(*t.StringIndexedFields)) } @@ -120,6 +156,10 @@ func (t ThresholdSCfg) Clone() (cln *ThresholdSCfg) { return } +type ThresholdsOptsJson struct { + ThresholdIDs *[]string `json:"*thresholdIDs"` +} + // Threshold service config section type ThresholdSJsonCfg struct { Enabled *bool @@ -130,6 +170,17 @@ type ThresholdSJsonCfg struct { Suffix_indexed_fields *[]string Nested_fields *bool // applies when indexed fields is not defined Actions_conns *[]string + Opts *ThresholdsOptsJson +} + +func diffThresholdsOptsJsonCfg(d *ThresholdsOptsJson, v1, v2 *ThresholdsOpts) *ThresholdsOptsJson { + if d == nil { + d = new(ThresholdsOptsJson) + } + if !utils.SliceStringEqual(v1.ThresholdIDs, v2.ThresholdIDs) { + d.ThresholdIDs = utils.SliceStringPointer(v2.ThresholdIDs) + } + return d } func diffThresholdSJsonCfg(d *ThresholdSJsonCfg, v1, v2 *ThresholdSCfg) *ThresholdSJsonCfg { @@ -154,5 +205,6 @@ func diffThresholdSJsonCfg(d *ThresholdSJsonCfg, v1, v2 *ThresholdSCfg) *Thresho if !utils.SliceStringEqual(v1.ActionSConns, v2.ActionSConns) { d.Actions_conns = utils.SliceStringPointer(getInternalJSONConns(v2.ActionSConns)) } + d.Opts = diffThresholdsOptsJsonCfg(d.Opts, v1.Opts, v2.Opts) return d } diff --git a/config/thresholdscfg_test.go b/config/thresholdscfg_test.go index 914f52b74..e153b5045 100644 --- a/config/thresholdscfg_test.go +++ b/config/thresholdscfg_test.go @@ -35,6 +35,7 @@ func TestThresholdSCfgloadFromJsonCfgCase1(t *testing.T) { Suffix_indexed_fields: &[]string{"*req.index1"}, Nested_fields: utils.BoolPointer(true), Actions_conns: &[]string{utils.MetaInternal}, + Opts: &ThresholdsOptsJson{}, } expected := &ThresholdSCfg{ Enabled: true, @@ -45,6 +46,7 @@ func TestThresholdSCfgloadFromJsonCfgCase1(t *testing.T) { SuffixIndexedFields: &[]string{"*req.index1"}, NestedFields: true, ActionSConns: []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaActions)}, + Opts: &ThresholdsOpts{}, } jsonCfg := NewDefaultCGRConfig() if err = jsonCfg.thresholdSCfg.loadFromJSONCfg(cfgJSON); err != nil { @@ -77,11 +79,14 @@ func TestThresholdSCfgAsMapInterfaceCase1(t *testing.T) { utils.SuffixIndexedFieldsCfg: []string{}, utils.NestedFieldsCfg: false, utils.ActionSConnsCfg: []string{}, + utils.OptsCfg: map[string]interface{}{ + utils.MetaThresholdIDsCfg: []string(nil), + }, } if cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSONStr); err != nil { t.Error(err) } else if rcv := cgrCfg.thresholdSCfg.AsMapInterface(); !reflect.DeepEqual(rcv, eMap) { - t.Errorf("Expextec %+v \n, recevied %+v", utils.ToJSON(eMap), utils.ToJSON(rcv)) + t.Errorf("Expected %+v \n, recevied %+v", utils.ToJSON(eMap), utils.ToJSON(rcv)) } } @@ -107,11 +112,14 @@ func TestThresholdSCfgAsMapInterfaceCase2(t *testing.T) { utils.SuffixIndexedFieldsCfg: []string{"*req.suffix_indexed_fields1", "*req.suffix_indexed_fields2"}, utils.NestedFieldsCfg: true, utils.ActionSConnsCfg: []string{utils.MetaInternal}, + utils.OptsCfg: map[string]interface{}{ + utils.MetaThresholdIDsCfg: []string(nil), + }, } if cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSONStr); err != nil { t.Error(err) } else if rcv := cgrCfg.thresholdSCfg.AsMapInterface(); !reflect.DeepEqual(rcv, eMap) { - t.Errorf("Expexted %+v \n, recevied %+v", utils.ToJSON(eMap), utils.ToJSON(rcv)) + t.Errorf("Expected %+v \n, recevied %+v", utils.ToJSON(eMap), utils.ToJSON(rcv)) } } func TestThresholdSCfgClone(t *testing.T) { @@ -151,6 +159,7 @@ func TestDiffThresholdSJsonCfg(t *testing.T) { SuffixIndexedFields: &[]string{"req.index3"}, ActionSConns: []string{}, NestedFields: false, + Opts: &ThresholdsOpts{}, } v2 := &ThresholdSCfg{ @@ -162,6 +171,7 @@ func TestDiffThresholdSJsonCfg(t *testing.T) { SuffixIndexedFields: &[]string{"req.index33"}, ActionSConns: []string{"*internal"}, NestedFields: true, + Opts: &ThresholdsOpts{}, } expected := &ThresholdSJsonCfg{ @@ -173,6 +183,9 @@ func TestDiffThresholdSJsonCfg(t *testing.T) { Suffix_indexed_fields: &[]string{"req.index33"}, Actions_conns: &[]string{"*internal"}, Nested_fields: utils.BoolPointer(true), + Opts: &ThresholdsOptsJson{ + ThresholdIDs: nil, + }, } rcv := diffThresholdSJsonCfg(d, v1, v2) @@ -181,7 +194,11 @@ func TestDiffThresholdSJsonCfg(t *testing.T) { } v1 = v2 - expected = &ThresholdSJsonCfg{} + expected = &ThresholdSJsonCfg{ + Opts: &ThresholdsOptsJson{ + ThresholdIDs: nil, + }, + } rcv = diffThresholdSJsonCfg(d, v1, v2) if !reflect.DeepEqual(rcv, expected) { t.Errorf("Expected %v \n but received \n %v", utils.ToJSON(expected), utils.ToJSON(rcv)) diff --git a/engine/resources.go b/engine/resources.go index 4af79872f..424d07867 100644 --- a/engine/resources.go +++ b/engine/resources.go @@ -522,31 +522,29 @@ func (rS *ResourceService) processThresholds(ctx *context.Context, rs Resources, var withErrs bool for _, r := range rs { - var thIDs []string if len(r.rPrf.ThresholdIDs) != 0 { if len(r.rPrf.ThresholdIDs) == 1 && r.rPrf.ThresholdIDs[0] == utils.MetaNone { continue } - thIDs = r.rPrf.ThresholdIDs + opts[utils.OptsThresholdsThresholdIDs] = r.rPrf.ThresholdIDs } - thEv := &ThresholdsArgsProcessEvent{ThresholdIDs: thIDs, - CGREvent: &utils.CGREvent{ - Tenant: r.Tenant, - ID: utils.GenUUID(), - Event: map[string]interface{}{ - utils.EventType: utils.ResourceUpdate, - utils.ResourceID: r.ID, - utils.Usage: r.TotalUsage(), - }, - APIOpts: opts, + thEv := &ThresholdsArgsProcessEvent{CGREvent: &utils.CGREvent{ + Tenant: r.Tenant, + ID: utils.GenUUID(), + Event: map[string]interface{}{ + utils.EventType: utils.ResourceUpdate, + utils.ResourceID: r.ID, + utils.Usage: r.TotalUsage(), }, + APIOpts: opts, + }, } var tIDs []string if err := rS.connMgr.Call(ctx, rS.cgrcfg.ResourceSCfg().ThresholdSConns, utils.ThresholdSv1ProcessEvent, thEv, &tIDs); err != nil && - (len(thIDs) != 0 || err.Error() != utils.ErrNotFound.Error()) { + (len(opts[utils.OptsThresholdsThresholdIDs].([]string)) != 0 || err.Error() != utils.ErrNotFound.Error()) { utils.Logger.Warning( fmt.Sprintf("<%s> error: %s processing event %+v with %s.", utils.ResourceS, err.Error(), thEv, utils.ThresholdS)) diff --git a/engine/stats.go b/engine/stats.go index 6c85ec1be..6f20d4fa6 100644 --- a/engine/stats.go +++ b/engine/stats.go @@ -302,16 +302,14 @@ func (sS *StatService) processThresholds(ctx *context.Context, sQs StatQueues, o opts[utils.MetaEventType] = utils.StatUpdate var withErrs bool for _, sq := range sQs { - var thIDs []string if len(sq.sqPrfl.ThresholdIDs) != 0 { if len(sq.sqPrfl.ThresholdIDs) == 1 && sq.sqPrfl.ThresholdIDs[0] == utils.MetaNone { continue } - thIDs = sq.sqPrfl.ThresholdIDs + opts[utils.OptsThresholdsThresholdIDs] = sq.sqPrfl.ThresholdIDs } thEv := &ThresholdsArgsProcessEvent{ - ThresholdIDs: thIDs, CGREvent: &utils.CGREvent{ Tenant: sq.Tenant, ID: utils.GenUUID(), @@ -328,7 +326,7 @@ func (sS *StatService) processThresholds(ctx *context.Context, sQs StatQueues, o var tIDs []string if err := sS.connMgr.Call(ctx, sS.cgrcfg.StatSCfg().ThresholdSConns, utils.ThresholdSv1ProcessEvent, thEv, &tIDs); err != nil && - (len(thIDs) != 0 || err.Error() != utils.ErrNotFound.Error()) { + (len(opts[utils.OptsThresholdsThresholdIDs].([]string)) != 0 || err.Error() != utils.ErrNotFound.Error()) { utils.Logger.Warning( fmt.Sprintf(" error: %s processing event %+v with ThresholdS.", err.Error(), thEv)) withErrs = true diff --git a/engine/stats_test.go b/engine/stats_test.go index 1b4038267..c8408376b 100644 --- a/engine/stats_test.go +++ b/engine/stats_test.go @@ -2962,7 +2962,6 @@ func TestStatQueueProcessThresholdsOK(t *testing.T) { calls: map[string]func(ctx *context.Context, args interface{}, reply interface{}) error{ utils.ThresholdSv1ProcessEvent: func(ctx *context.Context, args, reply interface{}) error { exp := &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"TH1"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: args.(*ThresholdsArgsProcessEvent).CGREvent.ID, @@ -2972,7 +2971,8 @@ func TestStatQueueProcessThresholdsOK(t *testing.T) { "testMetricType": time.Duration(time.Hour), }, APIOpts: map[string]interface{}{ - utils.MetaEventType: utils.StatUpdate, + utils.MetaEventType: utils.StatUpdate, + utils.OptsThresholdsThresholdIDs: []string{"TH1"}, }, }, } diff --git a/engine/thresholds.go b/engine/thresholds.go index 043098331..fc35f67da 100644 --- a/engine/thresholds.go +++ b/engine/thresholds.go @@ -328,7 +328,10 @@ func (tS *ThresholdService) matchingThresholdsForEvent(ctx *context.Context, tnt utils.MetaReq: args.Event, utils.MetaOpts: args.APIOpts, } - tIDs := utils.NewStringSet(args.ThresholdIDs) + var tIDs utils.StringSet + if args.APIOpts[utils.OptsThresholdsThresholdIDs] != nil { + tIDs = utils.NewStringSet(args.APIOpts[utils.OptsThresholdsThresholdIDs].([]string)) + } if len(tIDs) == 0 { tIDs, err = MatchingItemIDsForEvent(ctx, evNm, tS.cgrcfg.ThresholdSCfg().StringIndexedFields, @@ -406,7 +409,6 @@ func (tS *ThresholdService) matchingThresholdsForEvent(ctx *context.Context, tnt // ThresholdsArgsProcessEvent are the arguments to proccess the event with thresholds type ThresholdsArgsProcessEvent struct { - ThresholdIDs []string *utils.CGREvent clnb bool //rpcclonable } @@ -426,13 +428,8 @@ func (attr *ThresholdsArgsProcessEvent) RPCClone() (interface{}, error) { // Clone creates a clone of the object func (attr *ThresholdsArgsProcessEvent) Clone() *ThresholdsArgsProcessEvent { - var thIDs []string - if attr.ThresholdIDs != nil { - thIDs = utils.CloneStringSlice(attr.ThresholdIDs) - } return &ThresholdsArgsProcessEvent{ - ThresholdIDs: thIDs, - CGREvent: attr.CGREvent.Clone(), + CGREvent: attr.CGREvent.Clone(), } } @@ -453,6 +450,7 @@ func (tS *ThresholdService) processEvent(ctx *context.Context, tnt string, args fmt.Sprintf(" threshold: %s, ignoring event: %s, error: %s", t.TenantID(), utils.ConcatenatedKey(tnt, args.CGREvent.ID), err.Error())) withErrors = true + fmt.Println("sal1") continue } if t.dirty == nil || t.Hits == t.tPrfl.MaxHits { // one time threshold diff --git a/engine/thresholds_test.go b/engine/thresholds_test.go index ccbd5af0c..06556aa1f 100644 --- a/engine/thresholds_test.go +++ b/engine/thresholds_test.go @@ -1463,21 +1463,25 @@ func TestThresholdsStoreThresholdNilDirtyField(t *testing.T) { func TestThresholdsSetCloneable(t *testing.T) { args := &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"THD_ID"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "EventTest", Event: map[string]interface{}{}, + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: []string{"THD_ID"}, + }, }, clnb: false, } exp := &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"THD_ID"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "EventTest", Event: map[string]interface{}{}, + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: []string{"THD_ID"}, + }, }, clnb: true, } @@ -1490,23 +1494,25 @@ func TestThresholdsSetCloneable(t *testing.T) { func TestThresholdsRPCClone(t *testing.T) { args := &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"THD_ID"}, CGREvent: &utils.CGREvent{ - Tenant: "cgrates.org", - ID: "EventTest", - Event: make(map[string]interface{}), - APIOpts: make(map[string]interface{}), + Tenant: "cgrates.org", + ID: "EventTest", + Event: make(map[string]interface{}), + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: []string{"THD_ID"}, + }, }, clnb: true, } exp := &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"THD_ID"}, CGREvent: &utils.CGREvent{ - Tenant: "cgrates.org", - ID: "EventTest", - Event: make(map[string]interface{}), - APIOpts: make(map[string]interface{}), + Tenant: "cgrates.org", + ID: "EventTest", + Event: make(map[string]interface{}), + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: []string{"THD_ID"}, + }, }, } @@ -1541,13 +1547,15 @@ func TestThresholdsProcessEventStoreThOK(t *testing.T) { } args := &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"TH2"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "ThdProcessEvent", Event: map[string]interface{}{ utils.AccountField: "1001", }, + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: []string{"TH2"}, + }, }, } exp := &Threshold{ @@ -1627,13 +1635,15 @@ func TestThresholdsProcessEventMaxHitsDMErr(t *testing.T) { } args := &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"TH3"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "ThdProcessEvent", Event: map[string]interface{}{ utils.AccountField: "1001", }, + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: []string{"TH3"}, + }, }, } @@ -1686,13 +1696,15 @@ func TestThresholdsProcessEventNotFound(t *testing.T) { } args := &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"TH6"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "ThdProcessEvent", Event: map[string]interface{}{ utils.AccountField: "1001", }, + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: []string{"TH6"}, + }, }, } @@ -2027,9 +2039,13 @@ func TestThresholdMatchingThresholdForEventLocks(t *testing.T) { ids.Add(rPrf.ID) } dm.RemoveThreshold(context.Background(), "cgrates.org", "TH1") + ev := &utils.CGREvent{ + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: ids.AsSlice(), + }, + } mth, err := rS.matchingThresholdsForEvent(context.Background(), "cgrates.org", &ThresholdsArgsProcessEvent{ - ThresholdIDs: ids.AsSlice(), - CGREvent: new(utils.CGREvent), + CGREvent: ev, }) if err != nil { t.Errorf("Error: %+v", err) @@ -2093,9 +2109,13 @@ func TestThresholdMatchingThresholdForEventLocks2(t *testing.T) { } prfs = append(prfs, rPrf) ids.Add(rPrf.ID) + ev := &utils.CGREvent{ + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: ids.AsSlice(), + }, + } _, err := rS.matchingThresholdsForEvent(context.Background(), "cgrates.org", &ThresholdsArgsProcessEvent{ - ThresholdIDs: ids.AsSlice(), - CGREvent: new(utils.CGREvent), + CGREvent: ev, }) expErr := utils.ErrPrefixNotFound(rPrf.FilterIDs[0]) if err == nil || err.Error() != expErr.Error() { @@ -2143,9 +2163,13 @@ func TestThresholdMatchingThresholdForEventLocksBlocker(t *testing.T) { prfs = append(prfs, rPrf) ids.Add(rPrf.ID) } + ev := &utils.CGREvent{ + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: ids.AsSlice(), + }, + } mres, err := rS.matchingThresholdsForEvent(context.Background(), "cgrates.org", &ThresholdsArgsProcessEvent{ - ThresholdIDs: ids.AsSlice(), - CGREvent: new(utils.CGREvent), + CGREvent: ev, }) if err != nil { t.Errorf("Error: %+v", err) @@ -2212,9 +2236,13 @@ func TestThresholdMatchingThresholdForEventLocks3(t *testing.T) { for i := 0; i < 10; i++ { ids.Add(fmt.Sprintf("TH%d", i)) } + ev := &utils.CGREvent{ + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: ids.AsSlice(), + }, + } _, err := rS.matchingThresholdsForEvent(context.Background(), "cgrates.org", &ThresholdsArgsProcessEvent{ - ThresholdIDs: ids.AsSlice(), - CGREvent: new(utils.CGREvent), + CGREvent: ev, }) if err != utils.ErrNotImplemented { t.Fatalf("Error: %+v", err) @@ -2254,9 +2282,13 @@ func TestThresholdMatchingThresholdForEventLocks4(t *testing.T) { ids.Add(rPrf.ID) } ids.Add("TH20") + ev := &utils.CGREvent{ + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: ids.AsSlice(), + }, + } mres, err := rS.matchingThresholdsForEvent(context.Background(), "cgrates.org", &ThresholdsArgsProcessEvent{ - ThresholdIDs: ids.AsSlice(), - CGREvent: new(utils.CGREvent), + CGREvent: ev, }) if err != nil { t.Errorf("Error: %+v", err) @@ -2309,10 +2341,14 @@ func TestThresholdMatchingThresholdForEventLocks5(t *testing.T) { prfs = append(prfs, rPrf) ids.Add(rPrf.ID) } + ev := &utils.CGREvent{ + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: ids.AsSlice(), + }, + } dm.RemoveThreshold(context.Background(), "cgrates.org", "TH1") _, err := rS.matchingThresholdsForEvent(context.Background(), "cgrates.org", &ThresholdsArgsProcessEvent{ - ThresholdIDs: ids.AsSlice(), - CGREvent: new(utils.CGREvent), + CGREvent: ev, }) if err != utils.ErrDisconnected { t.Errorf("Error: %+v", err) @@ -2474,7 +2510,6 @@ func TestThresholdsV1GetThresholdsForEventOK(t *testing.T) { t.Error(err) } args := &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{}, CGREvent: &utils.CGREvent{ ID: "TestGetThresholdsForEvent", Event: map[string]interface{}{ @@ -2528,8 +2563,7 @@ func TestThresholdsV1GetThresholdsForEventMissingArgs(t *testing.T) { t.Error(err) } args := &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{}, - CGREvent: nil, + CGREvent: nil, } experr := `MANDATORY_IE_MISSING: [CGREvent]` @@ -2540,7 +2574,6 @@ func TestThresholdsV1GetThresholdsForEventMissingArgs(t *testing.T) { } args = &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", Event: map[string]interface{}{ @@ -2556,7 +2589,6 @@ func TestThresholdsV1GetThresholdsForEventMissingArgs(t *testing.T) { } args = &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "TestGetThresholdsForEvent", @@ -3027,13 +3059,15 @@ func TestThreholdsMatchingThresholdsForEventDoesNotPass(t *testing.T) { } args := &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"TH1"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "TestEvent", Event: map[string]interface{}{ utils.AccountField: "1002", }, + APIOpts: map[string]interface{}{ + utils.OptsThresholdsThresholdIDs: []string{"TH1"}, + }, }, } if _, err := tS.matchingThresholdsForEvent(context.Background(), "cgrates.org", diff --git a/engine/z_resources_test.go b/engine/z_resources_test.go index ff67f5e46..288901a33 100644 --- a/engine/z_resources_test.go +++ b/engine/z_resources_test.go @@ -3085,7 +3085,6 @@ func TestResourcesProcessThresholdsOK(t *testing.T) { calls: map[string]func(ctx *context.Context, args interface{}, reply interface{}) error{ utils.ThresholdSv1ProcessEvent: func(ctx *context.Context, args, reply interface{}) error { exp := &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"THD_1"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: args.(*ThresholdsArgsProcessEvent).CGREvent.ID, @@ -3095,7 +3094,8 @@ func TestResourcesProcessThresholdsOK(t *testing.T) { utils.Usage: 0., }, APIOpts: map[string]interface{}{ - utils.MetaEventType: utils.ResourceUpdate, + utils.MetaEventType: utils.ResourceUpdate, + utils.OptsThresholdsThresholdIDs: []string{"THD_1"}, }, }, } @@ -3158,7 +3158,6 @@ func TestResourcesProcessThresholdsCallErr(t *testing.T) { calls: map[string]func(ctx *context.Context, args interface{}, reply interface{}) error{ utils.ThresholdSv1ProcessEvent: func(ctx *context.Context, args, reply interface{}) error { exp := &ThresholdsArgsProcessEvent{ - ThresholdIDs: []string{"THD_1"}, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: args.(*ThresholdsArgsProcessEvent).CGREvent.ID, @@ -3168,7 +3167,8 @@ func TestResourcesProcessThresholdsCallErr(t *testing.T) { utils.Usage: 0., }, APIOpts: map[string]interface{}{ - utils.MetaEventType: utils.ResourceUpdate, + utils.MetaEventType: utils.ResourceUpdate, + utils.OptsThresholdsThresholdIDs: []string{"THD_1"}, }, }, } diff --git a/sessions/sessions.go b/sessions/sessions.go index b809c6a38..8e56c77eb 100644 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -2822,7 +2822,7 @@ func (sS *SessionS) processThreshold(ctx *context.Context, cgrEv *utils.CGREvent } // check if we have thresholdIDs if len(thIDs) != 0 { - thEv.ThresholdIDs = thIDs + cgrEv.APIOpts[utils.OptsThresholdsThresholdIDs] = thIDs } thEv.SetCloneable(clnb) //initialize the returned variable diff --git a/utils/consts.go b/utils/consts.go index 3b51620b2..b2f6bc5e8 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -1882,6 +1882,9 @@ const ( // StatSCfg StoreUncompressedLimitCfg = "store_uncompressed_limit" + //ThresholdSCfg + MetaThresholdIDsCfg = "*thresholdIDs" + // Cache PartitionsCfg = "partitions" PrecacheCfg = "precache" @@ -2167,6 +2170,9 @@ const ( OptsRatesStartTime = "*ratesStartTime" OptsRatesUsage = "*ratesUsage" OptsRatesIntervalStart = "*ratesIntervalStart" + + OptsThresholdsThresholdIDs = "*thresholdIDs" + // STIR OptsStirATest = "*stirATest" OptsStirPayloadMaxDuration = "*stirPayloadMaxDuration"