From 779d46204dda13983a8b0175e47f80736f0f7b96 Mon Sep 17 00:00:00 2001 From: andronache Date: Thu, 10 Jun 2021 16:04:54 +0300 Subject: [PATCH] Changed dispatcher in registrarc to dispatchers and removed enabled from registrarc --- config/config.go | 4 +-- config/config_defaults.go | 2 +- config/config_test.go | 10 +++--- config/configsanity.go | 18 ++++------ config/configsanity_test.go | 35 ++++++------------ config/registrarccfg.go | 28 +++++---------- config/registrarccfg_test.go | 36 +++++-------------- data/conf/cgrates/cgrates.json | 2 +- .../registrarc/all2_mongo/cgrates.json | 2 +- .../registrarc/all2_mysql/cgrates.json | 2 +- .../samples/registrarc/all_mongo/cgrates.json | 2 +- .../samples/registrarc/all_mysql/cgrates.json | 2 +- registrarc/registrarc.go | 28 +++++++-------- registrarc/registrarc_test.go | 21 ++++------- services/registrarc.go | 8 ++++- services/registrarc_it_test.go | 2 +- utils/consts.go | 2 +- 17 files changed, 76 insertions(+), 128 deletions(-) diff --git a/config/config.go b/config/config.go index 983968d08..115446a53 100644 --- a/config/config.go +++ b/config/config.go @@ -151,9 +151,9 @@ func newCGRConfig(config []byte) (cfg *CGRConfig, err error) { cfg.dispatcherSCfg = new(DispatcherSCfg) cfg.registrarCCfg = new(RegistrarCCfgs) cfg.registrarCCfg.RPC = new(RegistrarCCfg) - cfg.registrarCCfg.Dispatcher = new(RegistrarCCfg) + cfg.registrarCCfg.Dispatchers = new(RegistrarCCfg) cfg.registrarCCfg.RPC.Hosts = make(map[string][]*RemoteHost) - cfg.registrarCCfg.Dispatcher.Hosts = make(map[string][]*RemoteHost) + cfg.registrarCCfg.Dispatchers.Hosts = make(map[string][]*RemoteHost) cfg.loaderCgrCfg = new(LoaderCgrCfg) cfg.migratorCgrCfg = new(MigratorCgrCfg) cfg.migratorCgrCfg.OutDataDBOpts = make(map[string]interface{}) diff --git a/config/config_defaults.go b/config/config_defaults.go index 39bbdeddf..3a86ed733 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -1001,7 +1001,7 @@ const CGRATES_CFG_JSON = ` "hosts": {}, "refresh_interval": "5m", }, - "dispatcher":{ + "dispatchers":{ "enabled": false, "registrars_conns": [], "hosts": {}, diff --git a/config/config_test.go b/config/config_test.go index 69d84efd0..572a3601a 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -1460,12 +1460,12 @@ func TestLoadDispatcherSCfgError(t *testing.T) { func TestLoadDispatcherHCfgError(t *testing.T) { cfgJSONStr := `{ "registrarc":{ - "dispatcher":{ + "dispatchers":{ "refresh_interval": 5, }, }, }` - expected := "json: cannot unmarshal number into Go struct field RegistrarCJsonCfg.Dispatcher.Refresh_interval of type string" + expected := "json: cannot unmarshal number into Go struct field RegistrarCJsonCfg.Dispatchers.Refresh_interval of type string" cgrConfig := NewDefaultCGRConfig() if err != nil { t.Error(err) @@ -4324,13 +4324,11 @@ func TestV1GetConfigDispatcherH(t *testing.T) { expected := map[string]interface{}{ RegistrarCJSON: map[string]interface{}{ utils.DispatcherCfg: map[string]interface{}{ - utils.EnabledCfg: false, utils.RegistrarsConnsCfg: []string{}, utils.HostsCfg: map[string][]map[string]interface{}{}, utils.RefreshIntervalCfg: "5m0s", }, utils.RPCCfg: map[string]interface{}{ - utils.EnabledCfg: false, utils.RegistrarsConnsCfg: []string{}, utils.HostsCfg: map[string][]map[string]interface{}{}, utils.RefreshIntervalCfg: "5m0s", @@ -5064,7 +5062,7 @@ func TestV1GetConfigAsJSONDispatcherS(t *testing.T) { func TestV1GetConfigAsJSONDispatcherH(t *testing.T) { var reply string - expected := `{"registrarc":{"dispatcher":{"enabled":false,"hosts":{},"refresh_interval":"5m0s","registrars_conns":[]},"rpc":{"enabled":false,"hosts":{},"refresh_interval":"5m0s","registrars_conns":[]}}}` + expected := `{"registrarc":{"dispatchers":{"hosts":{},"refresh_interval":"5m0s","registrars_conns":[]},"rpc":{"hosts":{},"refresh_interval":"5m0s","registrars_conns":[]}}}` cgrCfg := NewDefaultCGRConfig() if err := cgrCfg.V1GetConfigAsJSON(context.Background(), &SectionWithAPIOpts{Sections: []string{RegistrarCJSON}}, &reply); err != nil { t.Error(err) @@ -5298,7 +5296,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":{"admins_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"process_runs":1,"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":{"actions_conns":[],"attributes_conns":[],"chargers_conns":[],"ees_conns":[],"enabled":false,"extra_fields":[],"online_cdr_exports":[],"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":{"any_subsystem":true,"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":{"*file_csv":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"enabled":false,"exporters":[{"attempts":1,"attribute_context":"","attribute_ids":[],"export_path":"/var/spool/cgrates/ees","fields":[],"filters":[],"flags":[],"id":"*default","opts":{},"synchronous":false,"tenant":"","timezone":"","type":"*none"}]},"ers":{"enabled":false,"partial_cache_action":"*none","partial_cache_ttl":"1s","partial_path":"","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,"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":{"admins_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":"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":"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":"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":"Weight","tag":"Weight","type":"*variable","value":"~*req.3"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.4"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.5"},{"path":"RouteID","tag":"RouteID","type":"*variable","value":"~*req.6"},{"path":"RouteFilterIDs","tag":"RouteFilterIDs","type":"*variable","value":"~*req.7"},{"path":"RouteAccountIDs","tag":"RouteAccountIDs","type":"*variable","value":"~*req.8"},{"path":"RouteRatingPlanIDs","tag":"RouteRatingPlanIDs","type":"*variable","value":"~*req.9"},{"path":"RouteResourceIDs","tag":"RouteResourceIDs","type":"*variable","value":"~*req.10"},{"path":"RouteStatIDs","tag":"RouteStatIDs","type":"*variable","value":"~*req.11"},{"path":"RouteWeight","tag":"RouteWeight","type":"*variable","value":"~*req.12"},{"path":"RouteBlocker","tag":"RouteBlocker","type":"*variable","value":"~*req.13"},{"path":"RouteParameters","tag":"RouteParameters","type":"*variable","value":"~*req.14"}],"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":"Contexts","tag":"Contexts","type":"*variable","value":"~*req.2"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.3"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.4"},{"path":"Strategy","tag":"Strategy","type":"*variable","value":"~*req.5"},{"path":"StrategyParameters","tag":"StrategyParameters","type":"*variable","value":"~*req.6"},{"path":"ConnID","tag":"ConnID","type":"*variable","value":"~*req.7"},{"path":"ConnFilterIDs","tag":"ConnFilterIDs","type":"*variable","value":"~*req.8"},{"path":"ConnWeight","tag":"ConnWeight","type":"*variable","value":"~*req.9"},{"path":"ConnBlocker","tag":"ConnBlocker","type":"*variable","value":"~*req.10"},{"path":"ConnParameters","tag":"ConnParameters","type":"*variable","value":"~*req.11"}],"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":"TLS","tag":"TLS","type":"*variable","value":"~*req.4"}],"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":{"dispatcher":{"enabled":false,"hosts":{},"refresh_interval":"5m0s","registrars_conns":[]},"rpc":{"enabled":false,"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":{"attributes_conns":[],"default_ratio":1,"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"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":{"admins_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"process_runs":1,"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":{"actions_conns":[],"attributes_conns":[],"chargers_conns":[],"ees_conns":[],"enabled":false,"extra_fields":[],"online_cdr_exports":[],"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":{"any_subsystem":true,"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":{"*file_csv":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"enabled":false,"exporters":[{"attempts":1,"attribute_context":"","attribute_ids":[],"export_path":"/var/spool/cgrates/ees","fields":[],"filters":[],"flags":[],"id":"*default","opts":{},"synchronous":false,"tenant":"","timezone":"","type":"*none"}]},"ers":{"enabled":false,"partial_cache_action":"*none","partial_cache_ttl":"1s","partial_path":"","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,"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":{"admins_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":"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":"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":"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":"Weight","tag":"Weight","type":"*variable","value":"~*req.3"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.4"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.5"},{"path":"RouteID","tag":"RouteID","type":"*variable","value":"~*req.6"},{"path":"RouteFilterIDs","tag":"RouteFilterIDs","type":"*variable","value":"~*req.7"},{"path":"RouteAccountIDs","tag":"RouteAccountIDs","type":"*variable","value":"~*req.8"},{"path":"RouteRatingPlanIDs","tag":"RouteRatingPlanIDs","type":"*variable","value":"~*req.9"},{"path":"RouteResourceIDs","tag":"RouteResourceIDs","type":"*variable","value":"~*req.10"},{"path":"RouteStatIDs","tag":"RouteStatIDs","type":"*variable","value":"~*req.11"},{"path":"RouteWeight","tag":"RouteWeight","type":"*variable","value":"~*req.12"},{"path":"RouteBlocker","tag":"RouteBlocker","type":"*variable","value":"~*req.13"},{"path":"RouteParameters","tag":"RouteParameters","type":"*variable","value":"~*req.14"}],"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":"Contexts","tag":"Contexts","type":"*variable","value":"~*req.2"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.3"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.4"},{"path":"Strategy","tag":"Strategy","type":"*variable","value":"~*req.5"},{"path":"StrategyParameters","tag":"StrategyParameters","type":"*variable","value":"~*req.6"},{"path":"ConnID","tag":"ConnID","type":"*variable","value":"~*req.7"},{"path":"ConnFilterIDs","tag":"ConnFilterIDs","type":"*variable","value":"~*req.8"},{"path":"ConnWeight","tag":"ConnWeight","type":"*variable","value":"~*req.9"},{"path":"ConnBlocker","tag":"ConnBlocker","type":"*variable","value":"~*req.10"},{"path":"ConnParameters","tag":"ConnParameters","type":"*variable","value":"~*req.11"}],"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":"TLS","tag":"TLS","type":"*variable","value":"~*req.4"}],"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":{"attributes_conns":[],"default_ratio":1,"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"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}}` cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSON) if err != nil { t.Fatal(err) diff --git a/config/configsanity.go b/config/configsanity.go index 55967d7c4..12d78d2f2 100644 --- a/config/configsanity.go +++ b/config/configsanity.go @@ -946,24 +946,21 @@ func (cfg *CGRConfig) checkConfigSanity() error { } } - if cfg.registrarCCfg.Dispatcher.Enabled { - if len(cfg.registrarCCfg.Dispatcher.Hosts) == 0 { + if len(cfg.registrarCCfg.Dispatchers.RegistrarSConns) != 0 { + if len(cfg.registrarCCfg.Dispatchers.Hosts) == 0 { return fmt.Errorf("<%s> missing dispatcher host IDs", utils.RegistrarC) } - if cfg.registrarCCfg.Dispatcher.RefreshInterval <= 0 { + if cfg.registrarCCfg.Dispatchers.RefreshInterval <= 0 { return fmt.Errorf("<%s> the register imterval needs to be bigger than 0", utils.RegistrarC) } - for tnt, hosts := range cfg.registrarCCfg.Dispatcher.Hosts { + for tnt, hosts := range cfg.registrarCCfg.Dispatchers.Hosts { for _, host := range hosts { if !utils.SliceHasMember([]string{utils.MetaGOB, rpcclient.HTTPjson, utils.MetaJSON, rpcclient.BiRPCJSON, rpcclient.BiRPCGOB}, host.Transport) { return fmt.Errorf("<%s> unsupported transport <%s> for host <%s>", utils.RegistrarC, host.Transport, utils.ConcatenatedKey(tnt, host.ID)) } } } - if len(cfg.registrarCCfg.Dispatcher.RegistrarSConns) == 0 { - return fmt.Errorf("<%s> missing dispatcher connection IDs", utils.RegistrarC) - } - for _, connID := range cfg.registrarCCfg.Dispatcher.RegistrarSConns { + for _, connID := range cfg.registrarCCfg.Dispatchers.RegistrarSConns { if connID == utils.MetaInternal { return fmt.Errorf("<%s> internal connection IDs are not supported", utils.RegistrarC) } @@ -980,7 +977,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { } } - if cfg.registrarCCfg.RPC.Enabled { + if len(cfg.registrarCCfg.RPC.RegistrarSConns) != 0 { if len(cfg.registrarCCfg.RPC.Hosts) == 0 { return fmt.Errorf("<%s> missing RPC host IDs", utils.RegistrarC) } @@ -994,9 +991,6 @@ func (cfg *CGRConfig) checkConfigSanity() error { } } } - if len(cfg.registrarCCfg.RPC.RegistrarSConns) == 0 { - return fmt.Errorf("<%s> missing RPC connection IDs", utils.RegistrarC) - } for _, connID := range cfg.registrarCCfg.RPC.RegistrarSConns { if connID == utils.MetaInternal { return fmt.Errorf("<%s> internal connection IDs are not supported", utils.RegistrarC) diff --git a/config/configsanity_test.go b/config/configsanity_test.go index bc57b0bc6..02960ef60 100644 --- a/config/configsanity_test.go +++ b/config/configsanity_test.go @@ -1399,12 +1399,12 @@ func TestConfigSanityRegistrarCRPC(t *testing.T) { cfg.registrarCCfg = &RegistrarCCfgs{ RPC: &RegistrarCCfg{ - Enabled: true, + RegistrarSConns: []string{utils.MetaLocalHost}, Hosts: map[string][]*RemoteHost{ "hosts": {}, }, }, - Dispatcher: &RegistrarCCfg{}, + Dispatchers: &RegistrarCCfg{}, } expected := " the register imterval needs to be bigger than 0" @@ -1432,10 +1432,6 @@ func TestConfigSanityRegistrarCRPC(t *testing.T) { } cfg.registrarCCfg.RPC.Hosts["hosts"][0].Transport = utils.MetaJSON - expected = " missing RPC connection IDs" - if err := cfg.CheckConfigSanity(); err == nil || err.Error() != expected { - t.Errorf("Expecting: %+q received: %+q", expected, err) - } cfg.registrarCCfg.RPC.RegistrarSConns = []string{utils.MetaInternal} expected = " internal connection IDs are not supported" @@ -1468,8 +1464,8 @@ func TestConfigSanityRegistrarCDispatcher(t *testing.T) { cfg := NewDefaultCGRConfig() cfg.registrarCCfg = &RegistrarCCfgs{ - Dispatcher: &RegistrarCCfg{ - Enabled: true, + Dispatchers: &RegistrarCCfg{ + RegistrarSConns: []string{utils.MetaLocalHost}, Hosts: map[string][]*RemoteHost{ "hosts": {}, }, @@ -1482,14 +1478,9 @@ func TestConfigSanityRegistrarCDispatcher(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } - cfg.registrarCCfg.Dispatcher.Hosts = nil - expected = " missing dispatcher host IDs" - if err := cfg.CheckConfigSanity(); err == nil || err.Error() != expected { - t.Errorf("Expecting: %+q received: %+q", expected, err) - } - - cfg.registrarCCfg.Dispatcher.RefreshInterval = 2 - cfg.registrarCCfg.Dispatcher.Hosts = map[string][]*RemoteHost{ + cfg.registrarCCfg.Dispatchers.Hosts = nil + cfg.registrarCCfg.Dispatchers.RefreshInterval = 2 + cfg.registrarCCfg.Dispatchers.Hosts = map[string][]*RemoteHost{ "hosts": { { ID: "randomID", @@ -1501,25 +1492,21 @@ func TestConfigSanityRegistrarCDispatcher(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } - cfg.registrarCCfg.Dispatcher.Hosts["hosts"][0].Transport = utils.MetaJSON - expected = " missing dispatcher connection IDs" - if err := cfg.CheckConfigSanity(); err == nil || err.Error() != expected { - t.Errorf("Expecting: %+q received: %+q", expected, err) - } + cfg.registrarCCfg.Dispatchers.Hosts["hosts"][0].Transport = utils.MetaJSON - cfg.registrarCCfg.Dispatcher.RegistrarSConns = []string{utils.MetaInternal} + cfg.registrarCCfg.Dispatchers.RegistrarSConns = []string{utils.MetaInternal} expected = " internal connection IDs are not supported" if err := cfg.CheckConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } - cfg.registrarCCfg.Dispatcher.RegistrarSConns = []string{utils.MetaLocalHost} + cfg.registrarCCfg.Dispatchers.RegistrarSConns = []string{utils.MetaLocalHost} expected = " connection with id: <*localhost> unsupported transport <*json>" if err := cfg.CheckConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } - cfg.registrarCCfg.Dispatcher.RegistrarSConns = []string{"*conn1"} + cfg.registrarCCfg.Dispatchers.RegistrarSConns = []string{"*conn1"} expected = " connection with id: <*conn1> not defined" if err := cfg.CheckConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) diff --git a/config/registrarccfg.go b/config/registrarccfg.go index ab4dc9cde..f5e19778f 100644 --- a/config/registrarccfg.go +++ b/config/registrarccfg.go @@ -26,8 +26,8 @@ import ( // RegistrarCCfgs is the configuration of registrarc rpc and dispatcher type RegistrarCCfgs struct { - RPC *RegistrarCCfg - Dispatcher *RegistrarCCfg + RPC *RegistrarCCfg + Dispatchers *RegistrarCCfg } func (dps *RegistrarCCfgs) loadFromJSONCfg(jsnCfg *RegistrarCJsonCfgs) (err error) { @@ -37,28 +37,27 @@ func (dps *RegistrarCCfgs) loadFromJSONCfg(jsnCfg *RegistrarCJsonCfgs) (err erro if err = dps.RPC.loadFromJSONCfg(jsnCfg.RPC); err != nil { return } - return dps.Dispatcher.loadFromJSONCfg(jsnCfg.Dispatcher) + return dps.Dispatchers.loadFromJSONCfg(jsnCfg.Dispatchers) } // AsMapInterface returns the config as a map[string]interface{} func (dps *RegistrarCCfgs) AsMapInterface() (initialMP map[string]interface{}) { return map[string]interface{}{ utils.RPCCfg: dps.RPC.AsMapInterface(), - utils.DispatcherCfg: dps.Dispatcher.AsMapInterface(), + utils.DispatcherCfg: dps.Dispatchers.AsMapInterface(), } } // Clone returns a deep copy of DispatcherHCfg func (dps RegistrarCCfgs) Clone() (cln *RegistrarCCfgs) { return &RegistrarCCfgs{ - RPC: dps.RPC.Clone(), - Dispatcher: dps.Dispatcher.Clone(), + RPC: dps.RPC.Clone(), + Dispatchers: dps.Dispatchers.Clone(), } } // RegistrarCCfg is the configuration of registrarc type RegistrarCCfg struct { - Enabled bool RegistrarSConns []string Hosts map[string][]*RemoteHost RefreshInterval time.Duration @@ -68,9 +67,6 @@ func (dps *RegistrarCCfg) loadFromJSONCfg(jsnCfg *RegistrarCJsonCfg) (err error) if jsnCfg == nil { return nil } - if jsnCfg.Enabled != nil { - dps.Enabled = *jsnCfg.Enabled - } if jsnCfg.Registrars_conns != nil { dps.RegistrarSConns = utils.CloneStringSlice(*jsnCfg.Registrars_conns) } @@ -94,7 +90,6 @@ func (dps *RegistrarCCfg) loadFromJSONCfg(jsnCfg *RegistrarCJsonCfg) (err error) // AsMapInterface returns the config as a map[string]interface{} func (dps *RegistrarCCfg) AsMapInterface() (initialMP map[string]interface{}) { initialMP = map[string]interface{}{ - utils.EnabledCfg: dps.Enabled, utils.RegistrarsConnsCfg: utils.CloneStringSlice(dps.RegistrarSConns), utils.RefreshIntervalCfg: dps.RefreshInterval.String(), } @@ -118,7 +113,6 @@ func (dps *RegistrarCCfg) AsMapInterface() (initialMP map[string]interface{}) { // Clone returns a deep copy of DispatcherHCfg func (dps RegistrarCCfg) Clone() (cln *RegistrarCCfg) { cln = &RegistrarCCfg{ - Enabled: dps.Enabled, RefreshInterval: dps.RefreshInterval, Hosts: make(map[string][]*RemoteHost), } @@ -136,7 +130,6 @@ func (dps RegistrarCCfg) Clone() (cln *RegistrarCCfg) { } type RegistrarCJsonCfg struct { - Enabled *bool Registrars_conns *[]string Hosts map[string][]*RemoteHostJson Refresh_interval *string @@ -146,9 +139,6 @@ func diffRegistrarCJsonCfg(d *RegistrarCJsonCfg, v1, v2 *RegistrarCCfg) *Registr if d == nil { d = new(RegistrarCJsonCfg) } - if v1.Enabled != v2.Enabled { - d.Enabled = utils.BoolPointer(v2.Enabled) - } if !utils.SliceStringEqual(v1.RegistrarSConns, v2.RegistrarSConns) { d.Registrars_conns = utils.SliceStringPointer(utils.CloneStringSlice(v2.RegistrarSConns)) } @@ -170,8 +160,8 @@ func diffRegistrarCJsonCfg(d *RegistrarCJsonCfg, v1, v2 *RegistrarCCfg) *Registr } type RegistrarCJsonCfgs struct { - RPC *RegistrarCJsonCfg - Dispatcher *RegistrarCJsonCfg + RPC *RegistrarCJsonCfg + Dispatchers *RegistrarCJsonCfg } func diffRegistrarCJsonCfgs(d *RegistrarCJsonCfgs, v1, v2 *RegistrarCCfgs) *RegistrarCJsonCfgs { @@ -179,6 +169,6 @@ func diffRegistrarCJsonCfgs(d *RegistrarCJsonCfgs, v1, v2 *RegistrarCCfgs) *Regi d = new(RegistrarCJsonCfgs) } d.RPC = diffRegistrarCJsonCfg(d.RPC, v1.RPC, v2.RPC) - d.Dispatcher = diffRegistrarCJsonCfg(d.Dispatcher, v1.Dispatcher, v2.Dispatcher) + d.Dispatchers = diffRegistrarCJsonCfg(d.Dispatchers, v1.Dispatchers, v2.Dispatchers) return d } diff --git a/config/registrarccfg_test.go b/config/registrarccfg_test.go index ae59dc807..78552d4f1 100644 --- a/config/registrarccfg_test.go +++ b/config/registrarccfg_test.go @@ -29,7 +29,6 @@ import ( func TestDispatcherHCfgloadFromJsonCfg(t *testing.T) { jsonCfg := &RegistrarCJsonCfgs{ RPC: &RegistrarCJsonCfg{ - Enabled: utils.BoolPointer(true), Registrars_conns: &[]string{"*conn1", "*conn2"}, Hosts: map[string][]*RemoteHostJson{ utils.MetaDefault: { @@ -57,8 +56,7 @@ func TestDispatcherHCfgloadFromJsonCfg(t *testing.T) { }, Refresh_interval: utils.StringPointer("5"), }, - Dispatcher: &RegistrarCJsonCfg{ - Enabled: utils.BoolPointer(true), + Dispatchers: &RegistrarCJsonCfg{ Registrars_conns: &[]string{"*conn1", "*conn2"}, Hosts: map[string][]*RemoteHostJson{ utils.MetaDefault: { @@ -89,7 +87,6 @@ func TestDispatcherHCfgloadFromJsonCfg(t *testing.T) { } expected := &RegistrarCCfgs{ RPC: &RegistrarCCfg{ - Enabled: true, RegistrarSConns: []string{"*conn1", "*conn2"}, Hosts: map[string][]*RemoteHost{ utils.MetaDefault: { @@ -117,8 +114,7 @@ func TestDispatcherHCfgloadFromJsonCfg(t *testing.T) { }, RefreshInterval: 5, }, - Dispatcher: &RegistrarCCfg{ - Enabled: true, + Dispatchers: &RegistrarCCfg{ RegistrarSConns: []string{"*conn1", "*conn2"}, Hosts: map[string][]*RemoteHost{ utils.MetaDefault: { @@ -159,7 +155,6 @@ func TestDispatcherHCfgAsMapInterface(t *testing.T) { cfgJSONStr := `{ "registrarc":{ "rpc":{ - "enabled": true, "registrars_conns": ["*conn1","*conn2"], "hosts": { "*default": [ @@ -177,8 +172,7 @@ func TestDispatcherHCfgAsMapInterface(t *testing.T) { }, "refresh_interval": "0", }, - "dispatcher":{ - "enabled": true, + "dispatchers":{ "registrars_conns": ["*conn1","*conn2"], "hosts": { "*default": [ @@ -200,7 +194,6 @@ func TestDispatcherHCfgAsMapInterface(t *testing.T) { }` eMap := map[string]interface{}{ utils.RPCCfg: map[string]interface{}{ - utils.EnabledCfg: true, utils.RegistrarsConnsCfg: []string{"*conn1", "*conn2"}, utils.HostsCfg: map[string][]map[string]interface{}{ utils.MetaDefault: { @@ -217,7 +210,6 @@ func TestDispatcherHCfgAsMapInterface(t *testing.T) { utils.RefreshIntervalCfg: "0", }, utils.DispatcherCfg: map[string]interface{}{ - utils.EnabledCfg: true, utils.RegistrarsConnsCfg: []string{"*conn1", "*conn2"}, utils.HostsCfg: map[string][]map[string]interface{}{ utils.MetaDefault: { @@ -256,7 +248,7 @@ func TestDispatcherCfgParseWithNanoSec(t *testing.T) { func TestDispatcherCfgParseWithNanoSec2(t *testing.T) { jsonCfg := &RegistrarCJsonCfgs{ - Dispatcher: &RegistrarCJsonCfg{ + Dispatchers: &RegistrarCJsonCfg{ Refresh_interval: utils.StringPointer("1ss"), }, } @@ -273,13 +265,11 @@ func TestDispatcherHCfgAsMapInterface2(t *testing.T) { }` eMap := map[string]interface{}{ utils.DispatcherCfg: map[string]interface{}{ - utils.EnabledCfg: false, utils.RegistrarsConnsCfg: []string{}, utils.HostsCfg: map[string][]map[string]interface{}{}, utils.RefreshIntervalCfg: "5m0s", }, utils.RPCCfg: map[string]interface{}{ - utils.EnabledCfg: false, utils.RegistrarsConnsCfg: []string{}, utils.HostsCfg: map[string][]map[string]interface{}{}, utils.RefreshIntervalCfg: "5m0s", @@ -294,7 +284,6 @@ func TestDispatcherHCfgAsMapInterface2(t *testing.T) { func TestDispatcherHCfgClone(t *testing.T) { ban := &RegistrarCCfg{ - Enabled: true, RegistrarSConns: []string{"*conn1", "*conn2"}, Hosts: map[string][]*RemoteHost{ utils.MetaDefault: { @@ -338,7 +327,6 @@ func TestDiffRegistrarCJsonCfg(t *testing.T) { var d *RegistrarCJsonCfg v1 := &RegistrarCCfg{ - Enabled: false, RegistrarSConns: []string{"*localhost"}, Hosts: map[string][]*RemoteHost{ "HOST_1": { @@ -355,7 +343,6 @@ func TestDiffRegistrarCJsonCfg(t *testing.T) { } v2 := &RegistrarCCfg{ - Enabled: true, RegistrarSConns: []string{"*birpc"}, Hosts: map[string][]*RemoteHost{ "HOST_1": { @@ -372,7 +359,6 @@ func TestDiffRegistrarCJsonCfg(t *testing.T) { } expected := &RegistrarCJsonCfg{ - Enabled: utils.BoolPointer(true), Registrars_conns: &[]string{"*birpc"}, Hosts: map[string][]*RemoteHostJson{ "HOST_1": { @@ -418,7 +404,6 @@ func TestDiffRegistrarCJsonCfgs(t *testing.T) { v1 := &RegistrarCCfgs{ RPC: &RegistrarCCfg{ - Enabled: false, RegistrarSConns: []string{"*localhost"}, Hosts: map[string][]*RemoteHost{ "HOST_1": { @@ -433,8 +418,7 @@ func TestDiffRegistrarCJsonCfgs(t *testing.T) { }, RefreshInterval: 2 * time.Second, }, - Dispatcher: &RegistrarCCfg{ - Enabled: false, + Dispatchers: &RegistrarCCfg{ RegistrarSConns: []string{"*localhost"}, Hosts: map[string][]*RemoteHost{ "HOST_1": { @@ -453,7 +437,6 @@ func TestDiffRegistrarCJsonCfgs(t *testing.T) { v2 := &RegistrarCCfgs{ RPC: &RegistrarCCfg{ - Enabled: true, RegistrarSConns: []string{"*birpc"}, Hosts: map[string][]*RemoteHost{ "HOST_1": { @@ -468,8 +451,7 @@ func TestDiffRegistrarCJsonCfgs(t *testing.T) { }, RefreshInterval: 4 * time.Second, }, - Dispatcher: &RegistrarCCfg{ - Enabled: true, + Dispatchers: &RegistrarCCfg{ RegistrarSConns: []string{"*birpc"}, Hosts: map[string][]*RemoteHost{ "HOST_1": { @@ -488,7 +470,6 @@ func TestDiffRegistrarCJsonCfgs(t *testing.T) { expected := &RegistrarCJsonCfgs{ RPC: &RegistrarCJsonCfg{ - Enabled: utils.BoolPointer(true), Registrars_conns: &[]string{"*birpc"}, Hosts: map[string][]*RemoteHostJson{ "HOST_1": { @@ -503,8 +484,7 @@ func TestDiffRegistrarCJsonCfgs(t *testing.T) { }, Refresh_interval: utils.StringPointer("4s"), }, - Dispatcher: &RegistrarCJsonCfg{ - Enabled: utils.BoolPointer(true), + Dispatchers: &RegistrarCJsonCfg{ Registrars_conns: &[]string{"*birpc"}, Hosts: map[string][]*RemoteHostJson{ "HOST_1": { @@ -542,7 +522,7 @@ func TestDiffRegistrarCJsonCfgs(t *testing.T) { }, }, }, - Dispatcher: &RegistrarCJsonCfg{ + Dispatchers: &RegistrarCJsonCfg{ Hosts: map[string][]*RemoteHostJson{ "HOST_1": { { diff --git a/data/conf/cgrates/cgrates.json b/data/conf/cgrates/cgrates.json index 5181c0011..5ae776ee3 100755 --- a/data/conf/cgrates/cgrates.json +++ b/data/conf/cgrates/cgrates.json @@ -1013,7 +1013,7 @@ // "hosts": {}, // "refresh_interval": "5m", // }, -// "dispatcher":{ +// "dispatchers":{ // "enabled": false, // "registrars_conns": [], // "hosts": {}, diff --git a/data/conf/samples/registrarc/all2_mongo/cgrates.json b/data/conf/samples/registrarc/all2_mongo/cgrates.json index 7669cb421..9b9056523 100644 --- a/data/conf/samples/registrarc/all2_mongo/cgrates.json +++ b/data/conf/samples/registrarc/all2_mongo/cgrates.json @@ -105,7 +105,7 @@ "registrarc":{ - "dispatcher":{ + "dispatchers":{ "enabled": true, "registrars_conns": ["dispConn"], "hosts": { diff --git a/data/conf/samples/registrarc/all2_mysql/cgrates.json b/data/conf/samples/registrarc/all2_mysql/cgrates.json index aea5b87d6..90772b178 100644 --- a/data/conf/samples/registrarc/all2_mysql/cgrates.json +++ b/data/conf/samples/registrarc/all2_mysql/cgrates.json @@ -103,7 +103,7 @@ "registrarc":{ - "dispatcher":{ + "dispatchers":{ "enabled": true, "registrars_conns": ["dispConn"], "hosts": { diff --git a/data/conf/samples/registrarc/all_mongo/cgrates.json b/data/conf/samples/registrarc/all_mongo/cgrates.json index c837bf36a..5166dabf3 100644 --- a/data/conf/samples/registrarc/all_mongo/cgrates.json +++ b/data/conf/samples/registrarc/all_mongo/cgrates.json @@ -109,7 +109,7 @@ "registrarc":{ - "dispatcher":{ + "dispatchers":{ "enabled": true, "registrars_conns": ["dispConn"], "hosts": { diff --git a/data/conf/samples/registrarc/all_mysql/cgrates.json b/data/conf/samples/registrarc/all_mysql/cgrates.json index 30474506b..81bc8d99b 100644 --- a/data/conf/samples/registrarc/all_mysql/cgrates.json +++ b/data/conf/samples/registrarc/all_mysql/cgrates.json @@ -107,7 +107,7 @@ "registrarc":{ - "dispatcher":{ + "dispatchers":{ "enabled": true, "registrars_conns": ["dispConn"], "hosts": { diff --git a/registrarc/registrarc.go b/registrarc/registrarc.go index 139cb237b..dd35b3673 100644 --- a/registrarc/registrarc.go +++ b/registrarc/registrarc.go @@ -48,11 +48,11 @@ type RegistrarCService struct { func (dhS *RegistrarCService) ListenAndServe(stopChan, rldChan <-chan struct{}) { dTm, rTm := &time.Timer{}, &time.Timer{} var dTmStarted, rTmStarted bool - if dTmStarted = dhS.cfg.RegistrarCCfg().Dispatcher.Enabled; dTmStarted { - dTm = time.NewTimer(dhS.cfg.RegistrarCCfg().Dispatcher.RefreshInterval) + if len(dhS.cfg.RegistrarCCfg().Dispatchers.RegistrarSConns) != 0 { + dTm = time.NewTimer(dhS.cfg.RegistrarCCfg().Dispatchers.RefreshInterval) dhS.registerDispHosts() } - if rTmStarted = dhS.cfg.RegistrarCCfg().RPC.Enabled; rTmStarted { + if len(dhS.cfg.RegistrarCCfg().RPC.RegistrarSConns) != 0 { rTm = time.NewTimer(dhS.cfg.RegistrarCCfg().RPC.RefreshInterval) dhS.registerRPCHosts() } @@ -65,25 +65,25 @@ func (dhS *RegistrarCService) ListenAndServe(stopChan, rldChan <-chan struct{}) if dTmStarted { dTm.Stop() } - if dTmStarted = dhS.cfg.RegistrarCCfg().Dispatcher.Enabled; dTmStarted { - dTm = time.NewTimer(dhS.cfg.RegistrarCCfg().Dispatcher.RefreshInterval) + if len(dhS.cfg.RegistrarCCfg().Dispatchers.RegistrarSConns) != 0 { + dTm = time.NewTimer(dhS.cfg.RegistrarCCfg().Dispatchers.RefreshInterval) dhS.registerDispHosts() } - if rTmStarted = dhS.cfg.RegistrarCCfg().RPC.Enabled; rTmStarted { + if len(dhS.cfg.RegistrarCCfg().RPC.RegistrarSConns) != 0 { rTm = time.NewTimer(dhS.cfg.RegistrarCCfg().RPC.RefreshInterval) dhS.registerRPCHosts() } case <-stopChan: - if dhS.cfg.RegistrarCCfg().Dispatcher.Enabled { + if len(dhS.cfg.RegistrarCCfg().Dispatchers.RegistrarSConns) != 0 { dTm.Stop() } - if dhS.cfg.RegistrarCCfg().RPC.Enabled { + if len(dhS.cfg.RegistrarCCfg().RPC.RegistrarSConns) != 0 { rTm.Stop() } return case <-dTm.C: dhS.registerDispHosts() - dTm.Reset(dhS.cfg.RegistrarCCfg().Dispatcher.RefreshInterval) + dTm.Reset(dhS.cfg.RegistrarCCfg().Dispatchers.RefreshInterval) case <-rTm.C: dhS.registerRPCHosts() rTm.Reset(dhS.cfg.RegistrarCCfg().RPC.RefreshInterval) @@ -94,11 +94,11 @@ func (dhS *RegistrarCService) ListenAndServe(stopChan, rldChan <-chan struct{}) // Shutdown is called to shutdown the service func (dhS *RegistrarCService) Shutdown() { utils.Logger.Info(fmt.Sprintf("<%s> service shutdown initialized", utils.RegistrarC)) - if dhS.cfg.RegistrarCCfg().Dispatcher.Enabled { - unregisterHosts(dhS.connMgr, dhS.cfg.RegistrarCCfg().Dispatcher, + if len(dhS.cfg.RegistrarCCfg().Dispatchers.RegistrarSConns) != 0 { + unregisterHosts(dhS.connMgr, dhS.cfg.RegistrarCCfg().Dispatchers, dhS.cfg.GeneralCfg().DefaultTenant, utils.RegistrarSv1UnregisterDispatcherHosts) } - if dhS.cfg.RegistrarCCfg().RPC.Enabled { + if len(dhS.cfg.RegistrarCCfg().RPC.RegistrarSConns) != 0 { unregisterHosts(dhS.connMgr, dhS.cfg.RegistrarCCfg().RPC, dhS.cfg.GeneralCfg().DefaultTenant, utils.RegistrarSv1UnregisterRPCHosts) } @@ -106,8 +106,8 @@ func (dhS *RegistrarCService) Shutdown() { } func (dhS *RegistrarCService) registerDispHosts() { - for _, connID := range dhS.cfg.RegistrarCCfg().Dispatcher.RegistrarSConns { - for tnt, hostCfgs := range dhS.cfg.RegistrarCCfg().Dispatcher.Hosts { + for _, connID := range dhS.cfg.RegistrarCCfg().Dispatchers.RegistrarSConns { + for tnt, hostCfgs := range dhS.cfg.RegistrarCCfg().Dispatchers.Hosts { if tnt == utils.MetaDefault { tnt = dhS.cfg.GeneralCfg().DefaultTenant } diff --git a/registrarc/registrarc_test.go b/registrarc/registrarc_test.go index ddcf22170..6b5e075e2 100644 --- a/registrarc/registrarc_test.go +++ b/registrarc/registrarc_test.go @@ -46,8 +46,7 @@ func TestDispatcherHostsService(t *testing.T) { Transport: rpcclient.HTTPjson, }}, } - cfg.RegistrarCCfg().Dispatcher.Enabled = true - cfg.RegistrarCCfg().Dispatcher.Hosts = map[string][]*config.RemoteHost{ + cfg.RegistrarCCfg().Dispatchers.Hosts = map[string][]*config.RemoteHost{ utils.MetaDefault: { { ID: "Host1", @@ -55,8 +54,8 @@ func TestDispatcherHostsService(t *testing.T) { }, }, } - cfg.RegistrarCCfg().Dispatcher.RefreshInterval = 100 * time.Millisecond - cfg.RegistrarCCfg().Dispatcher.RegistrarSConns = []string{"conn1"} + cfg.RegistrarCCfg().Dispatchers.RefreshInterval = 100 * time.Millisecond + cfg.RegistrarCCfg().Dispatchers.RegistrarSConns = []string{"conn1"} ds := NewRegistrarCService(cfg, engine.NewConnManager(cfg, map[string]chan birpc.ClientConnector{})) @@ -76,7 +75,7 @@ func TestDispatcherHostsService(t *testing.T) { } else if !reflect.DeepEqual(host1, x) { t.Errorf("Expected: %s ,received: %s", utils.ToJSON(host1), utils.ToJSON(x)) } - cfg.RegistrarCCfg().Dispatcher.Hosts = map[string][]*config.RemoteHost{ + cfg.RegistrarCCfg().Dispatchers.Hosts = map[string][]*config.RemoteHost{ utils.MetaDefault: { { ID: "Host2", @@ -93,7 +92,7 @@ func TestDispatcherHostsService(t *testing.T) { } else if !reflect.DeepEqual(host1, x) { t.Errorf("Expected: %s ,received: %s", utils.ToJSON(host1), utils.ToJSON(x)) } - unregisterHosts(ds.connMgr, cfg.RegistrarCCfg().Dispatcher, "cgrates.org", utils.RegistrarSv1UnregisterDispatcherHosts) + unregisterHosts(ds.connMgr, cfg.RegistrarCCfg().Dispatchers, "cgrates.org", utils.RegistrarSv1UnregisterDispatcherHosts) if _, ok := engine.Cache.Get(utils.CacheDispatcherHosts, host1.TenantID()); ok { t.Errorf("Expected to not find Host2 in cache") } @@ -102,7 +101,7 @@ func TestDispatcherHostsService(t *testing.T) { config.CgrConfig().CacheCfg().ReplicationConns = []string{} host1.ID = "Host1" - cfg.RegistrarCCfg().Dispatcher.Hosts = map[string][]*config.RemoteHost{ + cfg.RegistrarCCfg().Dispatchers.Hosts = map[string][]*config.RemoteHost{ utils.MetaDefault: { { ID: "Host1", @@ -128,8 +127,6 @@ func TestDispatcherHostsService(t *testing.T) { func TestRegistrarcListenAndServe(t *testing.T) { //cover purposes only cfg := config.NewDefaultCGRConfig() - cfg.RegistrarCCfg().Dispatcher.Enabled = true - cfg.RegistrarCCfg().RPC.Enabled = true regStSrv := NewRegistrarCService(cfg, nil) stopChan := make(chan struct{}, 1) rldChan := make(chan struct{}, 1) @@ -195,9 +192,7 @@ func TestRegisterRPCHosts(t *testing.T) { func TestRegistrarcListenAndServedTmCDispatcher(t *testing.T) { //cover purposes only cfg := config.NewDefaultCGRConfig() - cfg.RegistrarCCfg().Dispatcher.Enabled = true - cfg.RegistrarCCfg().Dispatcher.RefreshInterval = 1 - cfg.RegistrarCCfg().RPC.Enabled = true + cfg.RegistrarCCfg().Dispatchers.RefreshInterval = 1 regStSrv := NewRegistrarCService(cfg, nil) stopChan := make(chan struct{}, 1) rldChan := make(chan struct{}, 1) @@ -212,8 +207,6 @@ func TestRegistrarcListenAndServedTmCDispatcher(t *testing.T) { func TestRegistrarcListenAndServedTmCRPC(t *testing.T) { //cover purposes only cfg := config.NewDefaultCGRConfig() - cfg.RegistrarCCfg().Dispatcher.Enabled = true - cfg.RegistrarCCfg().RPC.Enabled = true cfg.RegistrarCCfg().RPC.RefreshInterval = 1 regStSrv := NewRegistrarCService(cfg, nil) stopChan := make(chan struct{}, 1) diff --git a/services/registrarc.go b/services/registrarc.go index 4b738dfa9..a1bf64371 100644 --- a/services/registrarc.go +++ b/services/registrarc.go @@ -103,5 +103,11 @@ func (dspS *RegistrarCService) ServiceName() string { // ShouldRun returns if the service should be running func (dspS *RegistrarCService) ShouldRun() bool { - return dspS.cfg.RegistrarCCfg().Dispatcher.Enabled || dspS.cfg.RegistrarCCfg().RPC.Enabled + if len(dspS.cfg.RegistrarCCfg().RPC.RegistrarSConns) != 0 { + return true + } + if len(dspS.cfg.RegistrarCCfg().Dispatchers.RegistrarSConns) != 0 { + return true + } + return false } diff --git a/services/registrarc_it_test.go b/services/registrarc_it_test.go index 0097c518a..eb6021b4e 100644 --- a/services/registrarc_it_test.go +++ b/services/registrarc_it_test.go @@ -91,7 +91,7 @@ func TestDispatcherHReload(t *testing.T) { if err != nil { t.Errorf("\nExpecting ,\n Received <%+v>", err) } - cfg.RegistrarCCfg().Dispatcher.Enabled = false + cfg.RegistrarCCfg().Dispatchers.Enabled = false cfg.GetReloadChan(config.RegistrarCJSON) <- struct{}{} time.Sleep(10 * time.Millisecond) if srv.IsRunning() { diff --git a/utils/consts.go b/utils/consts.go index b54213e62..233b49827 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -2104,7 +2104,7 @@ const ( // RegistrarCCfg const ( RPCCfg = "rpc" - DispatcherCfg = "dispatcher" + DispatcherCfg = "dispatchers" RegistrarsConnsCfg = "registrars_conns" HostsCfg = "hosts" RefreshIntervalCfg = "refresh_interval"