diff --git a/accounts/accounts.go b/accounts/accounts.go index 3ec44033d..f39dc3278 100644 --- a/accounts/accounts.go +++ b/accounts/accounts.go @@ -55,9 +55,8 @@ func (aS *AccountS) ListenAndServe(stopChan, cfgRld chan struct{}) { } // Shutdown is called to shutdown the service -func (aS *AccountS) Shutdown() (err error) { +func (aS *AccountS) Shutdown() { utils.Logger.Info(fmt.Sprintf("<%s> shutdown <%s>", utils.CoreS, utils.AccountS)) - return } // Call implements rpcclient.ClientConnector interface for internal RPC diff --git a/apier/v1/dispatcher_it_test.go b/apier/v1/dispatcher_it_test.go index a288efd3c..fe0c303c6 100644 --- a/apier/v1/dispatcher_it_test.go +++ b/apier/v1/dispatcher_it_test.go @@ -265,8 +265,8 @@ func testDispatcherSSetDispatcherHost(t *testing.T) { dispatcherHost = &DispatcherHostWithCache{ DispatcherHost: &engine.DispatcherHost{ Tenant: "cgrates.org", - ID: "DspHst1", - Conn: &config.RemoteHost{ + RemoteHost: &config.RemoteHost{ + ID: "DspHst1", Address: "*internal", }, }, @@ -309,7 +309,7 @@ func testDispatcherSGetDispatcherHostIDs(t *testing.T) { func testDispatcherSUpdateDispatcherHost(t *testing.T) { var result string - dispatcherHost.Conn = &config.RemoteHost{ + dispatcherHost.RemoteHost = &config.RemoteHost{ Address: ":4012", Transport: utils.MetaGOB, TLS: false, @@ -419,8 +419,8 @@ func testDispatcherSRemDispatcherProfileWithoutTenant(t *testing.T) { func testDispatcherSSetDispatcherHostWithoutTenant(t *testing.T) { dispatcherHost = &DispatcherHostWithCache{ DispatcherHost: &engine.DispatcherHost{ - ID: "DspHst7", - Conn: &config.RemoteHost{ + RemoteHost: &config.RemoteHost{ + ID: "DspHst7", Address: "*internal", }, }, diff --git a/apier/v1/remote_it_test.go b/apier/v1/remote_it_test.go index ffe3ff9e4..8ec00a0f4 100644 --- a/apier/v1/remote_it_test.go +++ b/apier/v1/remote_it_test.go @@ -648,8 +648,8 @@ func testInternalRemoteITGetDispatcherHost(t *testing.T) { dispatcherHost = &DispatcherHostWithCache{ DispatcherHost: &engine.DispatcherHost{ Tenant: "cgrates.org", - ID: "DspHst1", - Conn: &config.RemoteHost{ + RemoteHost: &config.RemoteHost{ + ID: "DspHst1", Address: "*internal", }, }, diff --git a/apier/v1/replicate_it_test.go b/apier/v1/replicate_it_test.go index 5b2033d14..d7be19676 100644 --- a/apier/v1/replicate_it_test.go +++ b/apier/v1/replicate_it_test.go @@ -637,8 +637,8 @@ func testInternalReplicateITDispatcherHost(t *testing.T) { dispatcherHost = &DispatcherHostWithCache{ DispatcherHost: &engine.DispatcherHost{ Tenant: "cgrates.org", - ID: "DspHst1", - Conn: &config.RemoteHost{ + RemoteHost: &config.RemoteHost{ + ID: "DspHst1", Address: "*internal", }, }, diff --git a/cmd/cgr-engine/cgr-engine.go b/cmd/cgr-engine/cgr-engine.go index 87080852f..54c56e296 100644 --- a/cmd/cgr-engine/cgr-engine.go +++ b/cmd/cgr-engine/cgr-engine.go @@ -591,8 +591,8 @@ func main() { // Rpc/http server server := cores.NewServer(caps) - if len(cfg.HTTPCfg().DispatchersRegistrarURL) != 0 { - server.RegisterHttpFunc(cfg.HTTPCfg().DispatchersRegistrarURL, registrarc.Registrar) + if len(cfg.HTTPCfg().RegistrarSURL) != 0 { + server.RegisterHttpFunc(cfg.HTTPCfg().RegistrarSURL, registrarc.Registrar) } if cfg.ConfigSCfg().Enabled { server.RegisterHttpFunc(cfg.ConfigSCfg().URL, config.HandlerConfigS) diff --git a/config/config.go b/config/config.go index 3b536970a..08c49542c 100644 --- a/config/config.go +++ b/config/config.go @@ -713,13 +713,13 @@ func (cfg *CGRConfig) loadDispatcherSCfg(jsnCfg *CgrJsonCfg) (err error) { return cfg.dispatcherSCfg.loadFromJSONCfg(jsnDispatcherSCfg) } -// loadRegistrarCCfg loads the DispatcherH section of the configuration +// loadRegistrarCCfg loads the RegistrarC section of the configuration func (cfg *CGRConfig) loadRegistrarCCfg(jsnCfg *CgrJsonCfg) (err error) { - var jsnDispatcherHCfg *RegistrarCJsonCfgs - if jsnDispatcherHCfg, err = jsnCfg.RegistrarCJsonCfgs(); err != nil { + var jsnRegistrarCCfg *RegistrarCJsonCfgs + if jsnRegistrarCCfg, err = jsnCfg.RegistrarCJsonCfgs(); err != nil { return } - return cfg.registrarCCfg.loadFromJSONCfg(jsnDispatcherHCfg) + return cfg.registrarCCfg.loadFromJSONCfg(jsnRegistrarCCfg) } // loadLoaderCgrCfg loads the Loader section of the configuration diff --git a/config/config_defaults.go b/config/config_defaults.go index b958a5941..9ab02f7d3 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -66,7 +66,7 @@ const CGRATES_CFG_JSON = ` "rpc_conns": { "*localhost": { - "conns": [{"address": "127.0.0.1:2012", "transport":"*json"},{}], + "conns": [{"address": "127.0.0.1:2012", "transport":"*json"}], }, }, // rpc connections definitions @@ -195,7 +195,7 @@ const CGRATES_CFG_JSON = ` "http": { // HTTP server configuration "json_rpc_url": "/jsonrpc", // JSON RPC relative URL ("" to disable) - "dispatchers_registrar_url": "/dispatchers_registrar", // dispatcherH registrar service relative URL + "registrars_url": "/registrar", // registrar service relative URL "ws_url": "/ws", // WebSockets relative URL ("" to disable) "freeswitch_cdrs_url": "/freeswitch_json", // Freeswitch CDRS relative URL ("" to disable) "http_cdrs": "/cdr_http", // CDRS relative URL ("" to disable) @@ -964,11 +964,19 @@ const CGRATES_CFG_JSON = ` }, -"dispatcherh":{ - "enabled": false, - "dispatchers_conns": [], - "hosts": {}, - "register_interval": "5m", +"registrarc":{ + "rpc":{ + "enabled": false, + "registrars_conns": [], + "hosts": {}, + "refresh_interval": "5m", + }, + "dispatcher":{ + "enabled": false, + "registrars_conns": [], + "hosts": {}, + "refresh_interval": "5m", + }, }, diff --git a/config/config_json_test.go b/config/config_json_test.go index eef673304..75577fb2e 100644 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -1854,13 +1854,13 @@ func TestDfSureTaxJsonCfg(t *testing.T) { func TestDfHttpJsonCfg(t *testing.T) { eCfg := &HTTPJsonCfg{ - Json_rpc_url: utils.StringPointer("/jsonrpc"), - Dispatchers_registrar_url: utils.StringPointer("/dispatchers_registrar"), - Ws_url: utils.StringPointer("/ws"), - Freeswitch_cdrs_url: utils.StringPointer("/freeswitch_json"), - Http_Cdrs: utils.StringPointer("/cdr_http"), - Use_basic_auth: utils.BoolPointer(false), - Auth_users: utils.MapStringStringPointer(map[string]string{}), + Json_rpc_url: utils.StringPointer("/jsonrpc"), + Registrars_url: utils.StringPointer("/registrar"), + Ws_url: utils.StringPointer("/ws"), + Freeswitch_cdrs_url: utils.StringPointer("/freeswitch_json"), + Http_Cdrs: utils.StringPointer("/cdr_http"), + Use_basic_auth: utils.BoolPointer(false), + Auth_users: utils.MapStringStringPointer(map[string]string{}), Client_opts: map[string]interface{}{ utils.HTTPClientTLSClientConfigCfg: false, utils.HTTPClientTLSHandshakeTimeoutCfg: "10s", diff --git a/config/config_test.go b/config/config_test.go index 1f2e3e5c6..11f5738ec 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -1648,11 +1648,13 @@ func TestLoadDispatcherSCfgError(t *testing.T) { func TestLoadDispatcherHCfgError(t *testing.T) { cfgJSONStr := `{ - "dispatcherh":{ - "register_interval": 5, + "registrarc":{ + "dispatcher":{ + "refresh_interval": 5, + }, }, }` - expected := "json: cannot unmarshal number into Go struct field DispatcherHJsonCfg.Register_interval of type string" + expected := "json: cannot unmarshal number into Go struct field RegistrarCJsonCfg.Dispatcher.Refresh_interval of type string" cgrConfig := NewDefaultCGRConfig() if err != nil { t.Error(err) @@ -4046,7 +4048,7 @@ func TestV1GetConfigHTTP(t *testing.T) { expected := map[string]interface{}{ HTTP_JSN: map[string]interface{}{ utils.HTTPJsonRPCURLCfg: "/jsonrpc", - utils.RegistrarSURLCfg: "/dispatchers_registrar", + utils.RegistrarSURLCfg: "/registrar", utils.HTTPWSURLCfg: "/ws", utils.HTTPFreeswitchCDRsURLCfg: "/freeswitch_json", utils.HTTPCDRsURLCfg: "/cdr_http", @@ -4602,10 +4604,18 @@ func TestV1GetConfigDispatcherH(t *testing.T) { var reply map[string]interface{} expected := map[string]interface{}{ RegistrarCJson: map[string]interface{}{ - utils.EnabledCfg: false, - utils.RegistrarsConnsCfg: []string{}, - utils.HostsCfg: map[string][]map[string]interface{}{}, - utils.RefreshIntervalCfg: "5m0s", + 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", + }, }, } cfgCgr := NewDefaultCGRConfig() @@ -4793,10 +4803,8 @@ func TestV1GetConfigSectionRPConns(t *testing.T) { utils.StrategyCfg: utils.MetaFirst, utils.Conns: []map[string]interface{}{ { - utils.AddressCfg: "127.0.0.1:2012", - utils.TransportCfg: "*json", - utils.SynchronousCfg: false, - utils.TLS: false, + utils.AddressCfg: "127.0.0.1:2012", + utils.TransportCfg: "*json", }, }, }, @@ -4805,10 +4813,8 @@ func TestV1GetConfigSectionRPConns(t *testing.T) { utils.PoolSize: 0, utils.Conns: []map[string]interface{}{ { - utils.AddressCfg: utils.MetaInternal, - utils.TransportCfg: utils.EmptyString, - utils.SynchronousCfg: false, - utils.TLS: false, + utils.AddressCfg: utils.MetaInternal, + utils.TransportCfg: utils.EmptyString, }, }, }, @@ -4817,10 +4823,8 @@ func TestV1GetConfigSectionRPConns(t *testing.T) { utils.PoolSize: 0, utils.Conns: []map[string]interface{}{ { - utils.AddressCfg: rpcclient.BiRPCInternal, - utils.TransportCfg: utils.EmptyString, - utils.SynchronousCfg: false, - utils.TLS: false, + utils.AddressCfg: rpcclient.BiRPCInternal, + utils.TransportCfg: utils.EmptyString, }, }, }, @@ -5169,7 +5173,7 @@ func TestV1GetConfigAsJSONAccounts(t *testing.T) { func TestV1GetConfigAsJSONHTTP(t *testing.T) { var reply string - expected := `{"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"},"dispatchers_registrar_url":"/dispatchers_registrar","freeswitch_cdrs_url":"/freeswitch_json","http_cdrs":"/cdr_http","json_rpc_url":"/jsonrpc","use_basic_auth":false,"ws_url":"/ws"}}` + expected := `{"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"}}` cfgCgr := NewDefaultCGRConfig() if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: HTTP_JSN}, &reply); err != nil { t.Error(err) @@ -5391,7 +5395,7 @@ func TestV1GetConfigAsJSONDispatcherS(t *testing.T) { func TestV1GetConfigAsJSONDispatcherH(t *testing.T) { var reply string - expected := `{"dispatcherh":{"dispatchers_conns":[],"enabled":false,"hosts":{},"register_interval":"5m0s"}}` + expected := `{"registrarc":{"dispatcher":{"enabled":false,"hosts":{},"refresh_interval":"5m0s","registrars_conns":[]},"rpc":{"enabled":false,"hosts":{},"refresh_interval":"5m0s","registrars_conns":[]}}}` cgrCfg := NewDefaultCGRConfig() if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: RegistrarCJson}, &reply); err != nil { t.Error(err) @@ -5501,7 +5505,7 @@ func TestV1GetConfigAsJSONApiBan(t *testing.T) { func TestV1GetConfigAsJSONRPCConns(t *testing.T) { var reply string - expected := `{"rpc_conns":{"*birpc_internal":{"conns":[{"TLS":false,"address":"*birpc_internal","synchronous":false,"transport":""}],"poolSize":0,"strategy":"*first"},"*internal":{"conns":[{"TLS":false,"address":"*internal","synchronous":false,"transport":""}],"poolSize":0,"strategy":"*first"},"*localhost":{"conns":[{"TLS":false,"address":"127.0.0.1:2012","synchronous":false,"transport":"*json"}],"poolSize":0,"strategy":"*first"}}}` + expected := `{"rpc_conns":{"*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"}}}` cgrCfg := NewDefaultCGRConfig() if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: RPCConnsJsonName}, &reply); err != nil { t.Error(err) @@ -5636,7 +5640,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":[],"ees_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"stats_conns":[],"suffix_indexed_fields":[],"tenants":[],"thresholds_conns":[]},"analyzers":{"cleanup_interval":"1h0m0s","db_path":"/var/spool/cgrates/analyzers","enabled":false,"index_type":"*scorch","ttl":"24h0m0s"},"apiban":{"enabled":false,"keys":[]},"apiers":{"attributes_conns":[],"caches_conns":["*internal"],"ees_conns":[],"enabled":false,"scheduler_conns":[]},"asterisk_agent":{"asterisk_conns":[{"address":"127.0.0.1:8088","alias":"","connect_attempts":3,"password":"CGRateS.org","reconnects":5,"user":"cgrates"}],"create_cdr":false,"enabled":false,"sessions_conns":["*birpc_internal"]},"attributes":{"apiers_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_action_plans":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*account_profile_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*account_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*accounts":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*action_plans":{"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":""},"*action_triggers":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*actions":{"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"},"*destinations":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*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":""},"*rating_plans":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rating_profiles":{"limit":-1,"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_destinations":{"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":""},"*shared_groups":{"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":""},"*timings":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_account_actions":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_account_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_action_plans":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_action_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_action_triggers":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_actions":{"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_destination_rates":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_destinations":{"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_rates":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_rating_plans":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_rating_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_shared_groups":{"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":""},"*tp_timings":{"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":{"attributes_conns":[],"chargers_conns":[],"ees_conns":[],"enabled":false,"extra_fields":[],"online_cdr_exports":[],"rals_conns":[],"scheduler_conns":[],"session_cost_retries":5,"stats_conns":[],"store_cdrs":true,"thresholds_conns":[]},"chargers":{"attributes_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"suffix_indexed_fields":[]},"configs":{"enabled":false,"root_dir":"/var/spool/cgrates/configs","url":"/configs/"},"cores":{"caps":0,"caps_stats_interval":"0","caps_strategy":"*busy","shutdown_timeout":"1s"},"data_db":{"db_host":"127.0.0.1","db_name":"10","db_password":"","db_port":6379,"db_type":"*redis","db_user":"cgrates","items":{"*account_action_plans":{"remote":false,"replicate":false},"*account_profiles":{"remote":false,"replicate":false},"*accounts":{"remote":false,"replicate":false},"*action_plans":{"remote":false,"replicate":false},"*action_profiles":{"remote":false,"replicate":false},"*action_triggers":{"remote":false,"replicate":false},"*actions":{"remote":false,"replicate":false},"*attribute_profiles":{"remote":false,"replicate":false},"*charger_profiles":{"remote":false,"replicate":false},"*destinations":{"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},"*rating_plans":{"remote":false,"replicate":false},"*rating_profiles":{"remote":false,"replicate":false},"*resource_profiles":{"remote":false,"replicate":false},"*resources":{"remote":false,"replicate":false},"*reverse_destinations":{"remote":false,"replicate":false},"*route_profiles":{"remote":false,"replicate":false},"*shared_groups":{"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},"*timings":{"remote":false,"replicate":false}},"opts":{"query_timeout":"10s","redis_ca_certificate":"","redis_client_certificate":"","redis_client_key":"","redis_cluster":false,"redis_cluster_ondown_delay":"0","redis_cluster_sync":"5s","redis_sentinel":"","redis_tls":false},"remote_conns":[],"replication_conns":[]},"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},"dispatcherh":{"dispatchers_conns":[],"enabled":false,"hosts":{},"register_interval":"5m0s"},"dispatchers":{"attributes_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"suffix_indexed_fields":[]},"dns_agent":{"enabled":false,"listen":"127.0.0.1:2053","listen_net":"udp","request_processors":[],"sessions_conns":["*internal"],"timezone":""},"ees":{"attributes_conns":[],"cache":{"*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","field_separator":",","fields":[],"filters":[],"flags":[],"id":"*default","opts":{},"synchronous":false,"tenant":"","timezone":"","type":"*none"}]},"ers":{"enabled":false,"readers":[{"cache_dump_fields":[],"concurrent_requests":1024,"failed_calls_prefix":"","field_separator":",","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":[],"header_define_character":":","id":"*default","opts":{},"partial_cache_expiry_action":"","partial_record_cache":"0","processed_path":"/var/spool/cgrates/ers/out","row_length":0,"run_delay":"0","source_path":"/var/spool/cgrates/ers/in","tenant":"","timezone":"","type":"*none","xml_root_path":[""]}],"sessions_conns":["*internal"]},"filters":{"apiers_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"},"dispatchers_registrar_url":"/dispatchers_registrar","freeswitch_cdrs_url":"/freeswitch_json","http_cdrs":"/cdr_http","json_rpc_url":"/jsonrpc","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":{"caches_conns":["*localhost"],"data_path":"./","disable_reverse":false,"field_separator":",","gapi_credentials":".gapi/credentials.json","gapi_token":".gapi/token.json","scheduler_conns":["*localhost"],"tpid":""},"loaders":[{"caches_conns":["*internal"],"data":[{"fields":[{"mandatory":true,"path":"Tenant","tag":"TenantID","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ProfileID","type":"*variable","value":"~*req.1"},{"path":"Contexts","tag":"Contexts","type":"*variable","value":"~*req.2"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.3"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.4"},{"path":"AttributeFilterIDs","tag":"AttributeFilterIDs","type":"*variable","value":"~*req.5"},{"path":"Path","tag":"Path","type":"*variable","value":"~*req.6"},{"path":"Type","tag":"Type","type":"*variable","value":"~*req.7"},{"path":"Value","tag":"Value","type":"*variable","value":"~*req.8"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.9"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.10"}],"file_name":"Attributes.csv","flags":null,"type":"*attributes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Type","tag":"Type","type":"*variable","value":"~*req.2"},{"path":"Element","tag":"Element","type":"*variable","value":"~*req.3"},{"path":"Values","tag":"Values","type":"*variable","value":"~*req.4"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.5"}],"file_name":"Filters.csv","flags":null,"type":"*filters"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"UsageTTL","tag":"TTL","type":"*variable","value":"~*req.4"},{"path":"Limit","tag":"Limit","type":"*variable","value":"~*req.5"},{"path":"AllocationMessage","tag":"AllocationMessage","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.9"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.10"}],"file_name":"Resources.csv","flags":null,"type":"*resources"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"QueueLength","tag":"QueueLength","type":"*variable","value":"~*req.4"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.5"},{"path":"MinItems","tag":"MinItems","type":"*variable","value":"~*req.6"},{"path":"MetricIDs","tag":"MetricIDs","type":"*variable","value":"~*req.7"},{"path":"MetricFilterIDs","tag":"MetricFilterIDs","type":"*variable","value":"~*req.8"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.9"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.10"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.11"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.12"}],"file_name":"Stats.csv","flags":null,"type":"*stats"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"MaxHits","tag":"MaxHits","type":"*variable","value":"~*req.4"},{"path":"MinHits","tag":"MinHits","type":"*variable","value":"~*req.5"},{"path":"MinSleep","tag":"MinSleep","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.8"},{"path":"ActionIDs","tag":"ActionIDs","type":"*variable","value":"~*req.9"},{"path":"Async","tag":"Async","type":"*variable","value":"~*req.10"}],"file_name":"Thresholds.csv","flags":null,"type":"*thresholds"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.4"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.5"},{"path":"RouteID","tag":"RouteID","type":"*variable","value":"~*req.6"},{"path":"RouteFilterIDs","tag":"RouteFilterIDs","type":"*variable","value":"~*req.7"},{"path":"RouteAccountIDs","tag":"RouteAccountIDs","type":"*variable","value":"~*req.8"},{"path":"RouteRatingPlanIDs","tag":"RouteRatingPlanIDs","type":"*variable","value":"~*req.9"},{"path":"RouteResourceIDs","tag":"RouteResourceIDs","type":"*variable","value":"~*req.10"},{"path":"RouteStatIDs","tag":"RouteStatIDs","type":"*variable","value":"~*req.11"},{"path":"RouteWeight","tag":"RouteWeight","type":"*variable","value":"~*req.12"},{"path":"RouteBlocker","tag":"RouteBlocker","type":"*variable","value":"~*req.13"},{"path":"RouteParameters","tag":"RouteParameters","type":"*variable","value":"~*req.14"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.15"}],"file_name":"Routes.csv","flags":null,"type":"*routes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"RunID","tag":"RunID","type":"*variable","value":"~*req.4"},{"path":"AttributeIDs","tag":"AttributeIDs","type":"*variable","value":"~*req.5"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.6"}],"file_name":"Chargers.csv","flags":null,"type":"*chargers"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Contexts","tag":"Contexts","type":"*variable","value":"~*req.2"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.3"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.4"},{"path":"Strategy","tag":"Strategy","type":"*variable","value":"~*req.5"},{"path":"StrategyParameters","tag":"StrategyParameters","type":"*variable","value":"~*req.6"},{"path":"ConnID","tag":"ConnID","type":"*variable","value":"~*req.7"},{"path":"ConnFilterIDs","tag":"ConnFilterIDs","type":"*variable","value":"~*req.8"},{"path":"ConnWeight","tag":"ConnWeight","type":"*variable","value":"~*req.9"},{"path":"ConnBlocker","tag":"ConnBlocker","type":"*variable","value":"~*req.10"},{"path":"ConnParameters","tag":"ConnParameters","type":"*variable","value":"~*req.11"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.12"}],"file_name":"DispatcherProfiles.csv","flags":null,"type":"*dispatchers"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Address","tag":"Address","type":"*variable","value":"~*req.2"},{"path":"Transport","tag":"Transport","type":"*variable","value":"~*req.3"},{"path":"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":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.4"},{"path":"MinCost","tag":"MinCost","type":"*variable","value":"~*req.5"},{"path":"MaxCost","tag":"MaxCost","type":"*variable","value":"~*req.6"},{"path":"MaxCostStrategy","tag":"MaxCostStrategy","type":"*variable","value":"~*req.7"},{"path":"RateID","tag":"RateID","type":"*variable","value":"~*req.8"},{"path":"RateFilterIDs","tag":"RateFilterIDs","type":"*variable","value":"~*req.9"},{"path":"RateActivationTimes","tag":"RateActivationTimes","type":"*variable","value":"~*req.10"},{"path":"RateWeight","tag":"RateWeight","type":"*variable","value":"~*req.11"},{"path":"RateBlocker","tag":"RateBlocker","type":"*variable","value":"~*req.12"},{"path":"RateIntervalStart","tag":"RateIntervalStart","type":"*variable","value":"~*req.13"},{"path":"RateFixedFee","tag":"RateFixedFee","type":"*variable","value":"~*req.14"},{"path":"RateRecurrentFee","tag":"RateRecurrentFee","type":"*variable","value":"~*req.15"},{"path":"RateUnit","tag":"RateUnit","type":"*variable","value":"~*req.16"},{"path":"RateIncrement","tag":"RateIncrement","type":"*variable","value":"~*req.17"}],"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":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.4"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.5"},{"path":"TargetType","tag":"TargetType","type":"*variable","value":"~*req.6"},{"path":"TargetIDs","tag":"TargetIDs","type":"*variable","value":"~*req.7"},{"path":"ActionID","tag":"ActionID","type":"*variable","value":"~*req.8"},{"path":"ActionFilterIDs","tag":"ActionFilterIDs","type":"*variable","value":"~*req.9"},{"path":"ActionBlocker","tag":"ActionBlocker","type":"*variable","value":"~*req.10"},{"path":"ActionTTL","tag":"ActionTTL","type":"*variable","value":"~*req.11"},{"path":"ActionType","tag":"ActionType","type":"*variable","value":"~*req.12"},{"path":"ActionOpts","tag":"ActionOpts","type":"*variable","value":"~*req.13"},{"path":"ActionPath","tag":"ActionPath","type":"*variable","value":"~*req.14"},{"path":"ActionValue","tag":"ActionValue","type":"*variable","value":"~*req.15"}],"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":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.4"},{"path":"BalanceID","tag":"BalanceID","type":"*variable","value":"~*req.5"},{"path":"BalanceFilterIDs","tag":"BalanceFilterIDs","type":"*variable","value":"~*req.6"},{"path":"BalanceWeight","tag":"BalanceWeight","type":"*variable","value":"~*req.7"},{"path":"BalanceBlocker","tag":"BalanceBlocker","type":"*variable","value":"~*req.8"},{"path":"BalanceType","tag":"BalanceType","type":"*variable","value":"~*req.9"},{"path":"BalanceOpts","tag":"BalanceOpts","type":"*variable","value":"~*req.10"},{"path":"BalanceCostIncrements","tag":"BalanceCostIncrements","type":"*variable","value":"~*req.11"},{"path":"BalanceAttributeIDs","tag":"BalanceAttributeIDs","type":"*variable","value":"~*req.12"},{"path":"BalanceRateProfileIDs","tag":"BalanceRateProfileIDs","type":"*variable","value":"~*req.13"},{"path":"BalanceUnitFactors","tag":"BalanceUnitFactors","type":"*variable","value":"~*req.14"},{"path":"BalanceUnits","tag":"BalanceUnits","type":"*variable","value":"~*req.15"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.16"}],"file_name":"AccountProfiles.csv","flags":null,"type":"*account_profiles"}],"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"}],"mailer":{"auth_password":"CGRateS.org","auth_user":"cgrates","from_address":"cgr-mailer@localhost.localdomain","server":"localhost"},"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"redis_ca_certificate":"","redis_client_certificate":"","redis_client_key":"","redis_cluster":false,"redis_cluster_ondown_delay":"0","redis_cluster_sync":"5s","redis_sentinel":"","redis_tls":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"]},"rals":{"balance_rating_subject":{"*any":"*zero1ns","*voice":"*zero1s"},"caches_conns":["*internal"],"dynaprepaid_actionplans":[],"enabled":false,"max_computed_usage":{"*any":"189h0m0s","*data":"107374182400","*mms":"10000","*sms":"10000","*voice":"72h0m0s"},"max_increments":1000000,"remove_expired":true,"rp_subject_prefix_matching":false,"stats_conns":[],"thresholds_conns":[]},"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},"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":[],"rals_conns":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"rpc_conns":{"*birpc_internal":{"conns":[{"TLS":false,"address":"*birpc_internal","synchronous":false,"transport":""}],"poolSize":0,"strategy":"*first"},"*internal":{"conns":[{"TLS":false,"address":"*internal","synchronous":false,"transport":""}],"poolSize":0,"strategy":"*first"},"*localhost":{"conns":[{"TLS":false,"address":"127.0.0.1:2012","synchronous":false,"transport":"*json"}],"poolSize":0,"strategy":"*first"}},"schedulers":{"cdrs_conns":[],"enabled":false,"filters":[],"stats_conns":[],"thresholds_conns":[]},"sessions":{"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","rals_conns":[],"replication_conns":[],"resources_conns":[],"routes_conns":[],"scheduler_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":1000000000,"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_account_actions":{"remote":false,"replicate":false},"*tp_account_profiles":{"remote":false,"replicate":false},"*tp_action_plans":{"remote":false,"replicate":false},"*tp_action_profiles":{"remote":false,"replicate":false},"*tp_action_triggers":{"remote":false,"replicate":false},"*tp_actions":{"remote":false,"replicate":false},"*tp_attributes":{"remote":false,"replicate":false},"*tp_chargers":{"remote":false,"replicate":false},"*tp_destination_rates":{"remote":false,"replicate":false},"*tp_destinations":{"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_rates":{"remote":false,"replicate":false},"*tp_rating_plans":{"remote":false,"replicate":false},"*tp_rating_profiles":{"remote":false,"replicate":false},"*tp_resources":{"remote":false,"replicate":false},"*tp_routes":{"remote":false,"replicate":false},"*tp_shared_groups":{"remote":false,"replicate":false},"*tp_stats":{"remote":false,"replicate":false},"*tp_thresholds":{"remote":false,"replicate":false},"*tp_timings":{"remote":false,"replicate":false},"*versions":{"remote":false,"replicate":false}},"opts":{"conn_max_lifetime":0,"max_idle_conns":10,"max_open_conns":100,"mysql_location":"Local","query_timeout":"10s","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":{"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":[],"ees_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"stats_conns":[],"suffix_indexed_fields":[],"tenants":[],"thresholds_conns":[]},"analyzers":{"cleanup_interval":"1h0m0s","db_path":"/var/spool/cgrates/analyzers","enabled":false,"index_type":"*scorch","ttl":"24h0m0s"},"apiban":{"enabled":false,"keys":[]},"apiers":{"attributes_conns":[],"caches_conns":["*internal"],"ees_conns":[],"enabled":false,"scheduler_conns":[]},"asterisk_agent":{"asterisk_conns":[{"address":"127.0.0.1:8088","alias":"","connect_attempts":3,"password":"CGRateS.org","reconnects":5,"user":"cgrates"}],"create_cdr":false,"enabled":false,"sessions_conns":["*birpc_internal"]},"attributes":{"apiers_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_action_plans":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*account_profile_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*account_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*accounts":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*action_plans":{"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":""},"*action_triggers":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*actions":{"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"},"*destinations":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*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":""},"*rating_plans":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rating_profiles":{"limit":-1,"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_destinations":{"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":""},"*shared_groups":{"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":""},"*timings":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_account_actions":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_account_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_action_plans":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_action_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_action_triggers":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_actions":{"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_destination_rates":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_destinations":{"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_rates":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_rating_plans":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_rating_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_shared_groups":{"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":""},"*tp_timings":{"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":{"attributes_conns":[],"chargers_conns":[],"ees_conns":[],"enabled":false,"extra_fields":[],"online_cdr_exports":[],"rals_conns":[],"scheduler_conns":[],"session_cost_retries":5,"stats_conns":[],"store_cdrs":true,"thresholds_conns":[]},"chargers":{"attributes_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"suffix_indexed_fields":[]},"configs":{"enabled":false,"root_dir":"/var/spool/cgrates/configs","url":"/configs/"},"cores":{"caps":0,"caps_stats_interval":"0","caps_strategy":"*busy","shutdown_timeout":"1s"},"data_db":{"db_host":"127.0.0.1","db_name":"10","db_password":"","db_port":6379,"db_type":"*redis","db_user":"cgrates","items":{"*account_action_plans":{"remote":false,"replicate":false},"*account_profiles":{"remote":false,"replicate":false},"*accounts":{"remote":false,"replicate":false},"*action_plans":{"remote":false,"replicate":false},"*action_profiles":{"remote":false,"replicate":false},"*action_triggers":{"remote":false,"replicate":false},"*actions":{"remote":false,"replicate":false},"*attribute_profiles":{"remote":false,"replicate":false},"*charger_profiles":{"remote":false,"replicate":false},"*destinations":{"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},"*rating_plans":{"remote":false,"replicate":false},"*rating_profiles":{"remote":false,"replicate":false},"*resource_profiles":{"remote":false,"replicate":false},"*resources":{"remote":false,"replicate":false},"*reverse_destinations":{"remote":false,"replicate":false},"*route_profiles":{"remote":false,"replicate":false},"*shared_groups":{"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},"*timings":{"remote":false,"replicate":false}},"opts":{"query_timeout":"10s","redis_ca_certificate":"","redis_client_certificate":"","redis_client_key":"","redis_cluster":false,"redis_cluster_ondown_delay":"0","redis_cluster_sync":"5s","redis_sentinel":"","redis_tls":false},"remote_conns":[],"replication_conns":[]},"diameter_agent":{"asr_template":"","concurrent_requests":-1,"dictionaries_path":"/usr/share/cgrates/diameter/dict/","enabled":false,"forced_disconnect":"*none","listen":"127.0.0.1:3868","listen_net":"tcp","origin_host":"CGR-DA","origin_realm":"cgrates.org","product_name":"CGRateS","rar_template":"","request_processors":[],"sessions_conns":["*birpc_internal"],"synced_conn_requests":false,"vendor_id":0},"dispatchers":{"attributes_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"suffix_indexed_fields":[]},"dns_agent":{"enabled":false,"listen":"127.0.0.1:2053","listen_net":"udp","request_processors":[],"sessions_conns":["*internal"],"timezone":""},"ees":{"attributes_conns":[],"cache":{"*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","field_separator":",","fields":[],"filters":[],"flags":[],"id":"*default","opts":{},"synchronous":false,"tenant":"","timezone":"","type":"*none"}]},"ers":{"enabled":false,"readers":[{"cache_dump_fields":[],"concurrent_requests":1024,"failed_calls_prefix":"","field_separator":",","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":[],"header_define_character":":","id":"*default","opts":{},"partial_cache_expiry_action":"","partial_record_cache":"0","processed_path":"/var/spool/cgrates/ers/out","row_length":0,"run_delay":"0","source_path":"/var/spool/cgrates/ers/in","tenant":"","timezone":"","type":"*none","xml_root_path":[""]}],"sessions_conns":["*internal"]},"filters":{"apiers_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":{"caches_conns":["*localhost"],"data_path":"./","disable_reverse":false,"field_separator":",","gapi_credentials":".gapi/credentials.json","gapi_token":".gapi/token.json","scheduler_conns":["*localhost"],"tpid":""},"loaders":[{"caches_conns":["*internal"],"data":[{"fields":[{"mandatory":true,"path":"Tenant","tag":"TenantID","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ProfileID","type":"*variable","value":"~*req.1"},{"path":"Contexts","tag":"Contexts","type":"*variable","value":"~*req.2"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.3"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.4"},{"path":"AttributeFilterIDs","tag":"AttributeFilterIDs","type":"*variable","value":"~*req.5"},{"path":"Path","tag":"Path","type":"*variable","value":"~*req.6"},{"path":"Type","tag":"Type","type":"*variable","value":"~*req.7"},{"path":"Value","tag":"Value","type":"*variable","value":"~*req.8"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.9"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.10"}],"file_name":"Attributes.csv","flags":null,"type":"*attributes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Type","tag":"Type","type":"*variable","value":"~*req.2"},{"path":"Element","tag":"Element","type":"*variable","value":"~*req.3"},{"path":"Values","tag":"Values","type":"*variable","value":"~*req.4"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.5"}],"file_name":"Filters.csv","flags":null,"type":"*filters"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"UsageTTL","tag":"TTL","type":"*variable","value":"~*req.4"},{"path":"Limit","tag":"Limit","type":"*variable","value":"~*req.5"},{"path":"AllocationMessage","tag":"AllocationMessage","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.9"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.10"}],"file_name":"Resources.csv","flags":null,"type":"*resources"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"QueueLength","tag":"QueueLength","type":"*variable","value":"~*req.4"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.5"},{"path":"MinItems","tag":"MinItems","type":"*variable","value":"~*req.6"},{"path":"MetricIDs","tag":"MetricIDs","type":"*variable","value":"~*req.7"},{"path":"MetricFilterIDs","tag":"MetricFilterIDs","type":"*variable","value":"~*req.8"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.9"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.10"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.11"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.12"}],"file_name":"Stats.csv","flags":null,"type":"*stats"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"MaxHits","tag":"MaxHits","type":"*variable","value":"~*req.4"},{"path":"MinHits","tag":"MinHits","type":"*variable","value":"~*req.5"},{"path":"MinSleep","tag":"MinSleep","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.8"},{"path":"ActionIDs","tag":"ActionIDs","type":"*variable","value":"~*req.9"},{"path":"Async","tag":"Async","type":"*variable","value":"~*req.10"}],"file_name":"Thresholds.csv","flags":null,"type":"*thresholds"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.4"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.5"},{"path":"RouteID","tag":"RouteID","type":"*variable","value":"~*req.6"},{"path":"RouteFilterIDs","tag":"RouteFilterIDs","type":"*variable","value":"~*req.7"},{"path":"RouteAccountIDs","tag":"RouteAccountIDs","type":"*variable","value":"~*req.8"},{"path":"RouteRatingPlanIDs","tag":"RouteRatingPlanIDs","type":"*variable","value":"~*req.9"},{"path":"RouteResourceIDs","tag":"RouteResourceIDs","type":"*variable","value":"~*req.10"},{"path":"RouteStatIDs","tag":"RouteStatIDs","type":"*variable","value":"~*req.11"},{"path":"RouteWeight","tag":"RouteWeight","type":"*variable","value":"~*req.12"},{"path":"RouteBlocker","tag":"RouteBlocker","type":"*variable","value":"~*req.13"},{"path":"RouteParameters","tag":"RouteParameters","type":"*variable","value":"~*req.14"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.15"}],"file_name":"Routes.csv","flags":null,"type":"*routes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"RunID","tag":"RunID","type":"*variable","value":"~*req.4"},{"path":"AttributeIDs","tag":"AttributeIDs","type":"*variable","value":"~*req.5"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.6"}],"file_name":"Chargers.csv","flags":null,"type":"*chargers"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Contexts","tag":"Contexts","type":"*variable","value":"~*req.2"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.3"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.4"},{"path":"Strategy","tag":"Strategy","type":"*variable","value":"~*req.5"},{"path":"StrategyParameters","tag":"StrategyParameters","type":"*variable","value":"~*req.6"},{"path":"ConnID","tag":"ConnID","type":"*variable","value":"~*req.7"},{"path":"ConnFilterIDs","tag":"ConnFilterIDs","type":"*variable","value":"~*req.8"},{"path":"ConnWeight","tag":"ConnWeight","type":"*variable","value":"~*req.9"},{"path":"ConnBlocker","tag":"ConnBlocker","type":"*variable","value":"~*req.10"},{"path":"ConnParameters","tag":"ConnParameters","type":"*variable","value":"~*req.11"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.12"}],"file_name":"DispatcherProfiles.csv","flags":null,"type":"*dispatchers"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Address","tag":"Address","type":"*variable","value":"~*req.2"},{"path":"Transport","tag":"Transport","type":"*variable","value":"~*req.3"},{"path":"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":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.4"},{"path":"MinCost","tag":"MinCost","type":"*variable","value":"~*req.5"},{"path":"MaxCost","tag":"MaxCost","type":"*variable","value":"~*req.6"},{"path":"MaxCostStrategy","tag":"MaxCostStrategy","type":"*variable","value":"~*req.7"},{"path":"RateID","tag":"RateID","type":"*variable","value":"~*req.8"},{"path":"RateFilterIDs","tag":"RateFilterIDs","type":"*variable","value":"~*req.9"},{"path":"RateActivationTimes","tag":"RateActivationTimes","type":"*variable","value":"~*req.10"},{"path":"RateWeight","tag":"RateWeight","type":"*variable","value":"~*req.11"},{"path":"RateBlocker","tag":"RateBlocker","type":"*variable","value":"~*req.12"},{"path":"RateIntervalStart","tag":"RateIntervalStart","type":"*variable","value":"~*req.13"},{"path":"RateFixedFee","tag":"RateFixedFee","type":"*variable","value":"~*req.14"},{"path":"RateRecurrentFee","tag":"RateRecurrentFee","type":"*variable","value":"~*req.15"},{"path":"RateUnit","tag":"RateUnit","type":"*variable","value":"~*req.16"},{"path":"RateIncrement","tag":"RateIncrement","type":"*variable","value":"~*req.17"}],"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":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.4"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.5"},{"path":"TargetType","tag":"TargetType","type":"*variable","value":"~*req.6"},{"path":"TargetIDs","tag":"TargetIDs","type":"*variable","value":"~*req.7"},{"path":"ActionID","tag":"ActionID","type":"*variable","value":"~*req.8"},{"path":"ActionFilterIDs","tag":"ActionFilterIDs","type":"*variable","value":"~*req.9"},{"path":"ActionBlocker","tag":"ActionBlocker","type":"*variable","value":"~*req.10"},{"path":"ActionTTL","tag":"ActionTTL","type":"*variable","value":"~*req.11"},{"path":"ActionType","tag":"ActionType","type":"*variable","value":"~*req.12"},{"path":"ActionOpts","tag":"ActionOpts","type":"*variable","value":"~*req.13"},{"path":"ActionPath","tag":"ActionPath","type":"*variable","value":"~*req.14"},{"path":"ActionValue","tag":"ActionValue","type":"*variable","value":"~*req.15"}],"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":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.4"},{"path":"BalanceID","tag":"BalanceID","type":"*variable","value":"~*req.5"},{"path":"BalanceFilterIDs","tag":"BalanceFilterIDs","type":"*variable","value":"~*req.6"},{"path":"BalanceWeight","tag":"BalanceWeight","type":"*variable","value":"~*req.7"},{"path":"BalanceBlocker","tag":"BalanceBlocker","type":"*variable","value":"~*req.8"},{"path":"BalanceType","tag":"BalanceType","type":"*variable","value":"~*req.9"},{"path":"BalanceOpts","tag":"BalanceOpts","type":"*variable","value":"~*req.10"},{"path":"BalanceCostIncrements","tag":"BalanceCostIncrements","type":"*variable","value":"~*req.11"},{"path":"BalanceAttributeIDs","tag":"BalanceAttributeIDs","type":"*variable","value":"~*req.12"},{"path":"BalanceRateProfileIDs","tag":"BalanceRateProfileIDs","type":"*variable","value":"~*req.13"},{"path":"BalanceUnitFactors","tag":"BalanceUnitFactors","type":"*variable","value":"~*req.14"},{"path":"BalanceUnits","tag":"BalanceUnits","type":"*variable","value":"~*req.15"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.16"}],"file_name":"AccountProfiles.csv","flags":null,"type":"*account_profiles"}],"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"}],"mailer":{"auth_password":"CGRateS.org","auth_user":"cgrates","from_address":"cgr-mailer@localhost.localdomain","server":"localhost"},"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"redis_ca_certificate":"","redis_client_certificate":"","redis_client_key":"","redis_cluster":false,"redis_cluster_ondown_delay":"0","redis_cluster_sync":"5s","redis_sentinel":"","redis_tls":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"]},"rals":{"balance_rating_subject":{"*any":"*zero1ns","*voice":"*zero1s"},"caches_conns":["*internal"],"dynaprepaid_actionplans":[],"enabled":false,"max_computed_usage":{"*any":"189h0m0s","*data":"107374182400","*mms":"10000","*sms":"10000","*voice":"72h0m0s"},"max_increments":1000000,"remove_expired":true,"rp_subject_prefix_matching":false,"stats_conns":[],"thresholds_conns":[]},"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":[],"rals_conns":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"rpc_conns":{"*birpc_internal":{"conns":[{"address":"*birpc_internal","transport":""}],"poolSize":0,"strategy":"*first"},"*internal":{"conns":[{"address":"*internal","transport":""}],"poolSize":0,"strategy":"*first"},"*localhost":{"conns":[{"address":"127.0.0.1:2012","transport":"*json"}],"poolSize":0,"strategy":"*first"}},"schedulers":{"cdrs_conns":[],"enabled":false,"filters":[],"stats_conns":[],"thresholds_conns":[]},"sessions":{"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","rals_conns":[],"replication_conns":[],"resources_conns":[],"routes_conns":[],"scheduler_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":1000000000,"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_account_actions":{"remote":false,"replicate":false},"*tp_account_profiles":{"remote":false,"replicate":false},"*tp_action_plans":{"remote":false,"replicate":false},"*tp_action_profiles":{"remote":false,"replicate":false},"*tp_action_triggers":{"remote":false,"replicate":false},"*tp_actions":{"remote":false,"replicate":false},"*tp_attributes":{"remote":false,"replicate":false},"*tp_chargers":{"remote":false,"replicate":false},"*tp_destination_rates":{"remote":false,"replicate":false},"*tp_destinations":{"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_rates":{"remote":false,"replicate":false},"*tp_rating_plans":{"remote":false,"replicate":false},"*tp_rating_profiles":{"remote":false,"replicate":false},"*tp_resources":{"remote":false,"replicate":false},"*tp_routes":{"remote":false,"replicate":false},"*tp_shared_groups":{"remote":false,"replicate":false},"*tp_stats":{"remote":false,"replicate":false},"*tp_thresholds":{"remote":false,"replicate":false},"*tp_timings":{"remote":false,"replicate":false},"*versions":{"remote":false,"replicate":false}},"opts":{"conn_max_lifetime":0,"max_idle_conns":10,"max_open_conns":100,"mysql_location":"Local","query_timeout":"10s","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":{"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_test.go b/config/configsanity_test.go index cdf1d6c72..342431734 100644 --- a/config/configsanity_test.go +++ b/config/configsanity_test.go @@ -1054,6 +1054,7 @@ func TestConfigSanityRegistrarCRPC(t *testing.T) { "hosts": {}, }, }, + Dispatcher: &RegistrarCCfg{}, } expected := " the register imterval needs to be bigger than 0" @@ -1123,6 +1124,7 @@ func TestConfigSanityRegistrarCDispatcher(t *testing.T) { "hosts": {}, }, }, + RPC: &RegistrarCCfg{}, } expected := " the register imterval needs to be bigger than 0" diff --git a/config/httpcfg.go b/config/httpcfg.go index 25c101307..ba83e5f7b 100644 --- a/config/httpcfg.go +++ b/config/httpcfg.go @@ -24,14 +24,14 @@ import ( // HTTPCfg is the HTTP config section type HTTPCfg struct { - HTTPJsonRPCURL string // JSON RPC relative URL ("" to disable) - DispatchersRegistrarURL string // dispatcherH registrar service relative URL - HTTPWSURL string // WebSocket relative URL ("" to disable) - HTTPFreeswitchCDRsURL string // Freeswitch CDRS relative URL ("" to disable) - HTTPCDRsURL string // CDRS relative URL ("" to disable) - HTTPUseBasicAuth bool // Use basic auth for HTTP API - HTTPAuthUsers map[string]string // Basic auth user:password map (base64 passwords) - ClientOpts map[string]interface{} + HTTPJsonRPCURL string // JSON RPC relative URL ("" to disable) + RegistrarSURL string // registrar service relative URL + HTTPWSURL string // WebSocket relative URL ("" to disable) + HTTPFreeswitchCDRsURL string // Freeswitch CDRS relative URL ("" to disable) + HTTPCDRsURL string // CDRS relative URL ("" to disable) + HTTPUseBasicAuth bool // Use basic auth for HTTP API + HTTPAuthUsers map[string]string // Basic auth user:password map (base64 passwords) + ClientOpts map[string]interface{} } // loadFromJSONCfg loads Database config from JsonCfg @@ -42,8 +42,8 @@ func (httpcfg *HTTPCfg) loadFromJSONCfg(jsnHTTPCfg *HTTPJsonCfg) (err error) { if jsnHTTPCfg.Json_rpc_url != nil { httpcfg.HTTPJsonRPCURL = *jsnHTTPCfg.Json_rpc_url } - if jsnHTTPCfg.Dispatchers_registrar_url != nil { - httpcfg.DispatchersRegistrarURL = *jsnHTTPCfg.Dispatchers_registrar_url + if jsnHTTPCfg.Registrars_url != nil { + httpcfg.RegistrarSURL = *jsnHTTPCfg.Registrars_url } if jsnHTTPCfg.Ws_url != nil { httpcfg.HTTPWSURL = *jsnHTTPCfg.Ws_url @@ -76,7 +76,7 @@ func (httpcfg *HTTPCfg) AsMapInterface() map[string]interface{} { } return map[string]interface{}{ utils.HTTPJsonRPCURLCfg: httpcfg.HTTPJsonRPCURL, - utils.RegistrarSURLCfg: httpcfg.DispatchersRegistrarURL, + utils.RegistrarSURLCfg: httpcfg.RegistrarSURL, utils.HTTPWSURLCfg: httpcfg.HTTPWSURL, utils.HTTPFreeswitchCDRsURLCfg: httpcfg.HTTPFreeswitchCDRsURL, utils.HTTPCDRsURLCfg: httpcfg.HTTPCDRsURL, @@ -89,14 +89,14 @@ func (httpcfg *HTTPCfg) AsMapInterface() map[string]interface{} { // Clone returns a deep copy of HTTPCfg func (httpcfg HTTPCfg) Clone() (cln *HTTPCfg) { cln = &HTTPCfg{ - HTTPJsonRPCURL: httpcfg.HTTPJsonRPCURL, - DispatchersRegistrarURL: httpcfg.DispatchersRegistrarURL, - HTTPWSURL: httpcfg.HTTPWSURL, - HTTPFreeswitchCDRsURL: httpcfg.HTTPFreeswitchCDRsURL, - HTTPCDRsURL: httpcfg.HTTPCDRsURL, - HTTPUseBasicAuth: httpcfg.HTTPUseBasicAuth, - HTTPAuthUsers: make(map[string]string), - ClientOpts: make(map[string]interface{}), + HTTPJsonRPCURL: httpcfg.HTTPJsonRPCURL, + RegistrarSURL: httpcfg.RegistrarSURL, + HTTPWSURL: httpcfg.HTTPWSURL, + HTTPFreeswitchCDRsURL: httpcfg.HTTPFreeswitchCDRsURL, + HTTPCDRsURL: httpcfg.HTTPCDRsURL, + HTTPUseBasicAuth: httpcfg.HTTPUseBasicAuth, + HTTPAuthUsers: make(map[string]string), + ClientOpts: make(map[string]interface{}), } for u, a := range httpcfg.HTTPAuthUsers { cln.HTTPAuthUsers[u] = a diff --git a/config/httpcfg_test.go b/config/httpcfg_test.go index cc9f7a60c..e48001caa 100644 --- a/config/httpcfg_test.go +++ b/config/httpcfg_test.go @@ -26,22 +26,22 @@ import ( func TestHTTPCfgloadFromJsonCfg(t *testing.T) { cfgJSONStr := &HTTPJsonCfg{ - Json_rpc_url: utils.StringPointer("/jsonrpc"), - Ws_url: utils.StringPointer("/ws"), - Dispatchers_registrar_url: utils.StringPointer("/randomUrl"), - Freeswitch_cdrs_url: utils.StringPointer("/freeswitch_json"), - Http_Cdrs: utils.StringPointer("/cdr_http"), - Use_basic_auth: utils.BoolPointer(false), - Auth_users: utils.MapStringStringPointer(map[string]string{}), + Json_rpc_url: utils.StringPointer("/jsonrpc"), + Ws_url: utils.StringPointer("/ws"), + Registrars_url: utils.StringPointer("/randomUrl"), + Freeswitch_cdrs_url: utils.StringPointer("/freeswitch_json"), + Http_Cdrs: utils.StringPointer("/cdr_http"), + Use_basic_auth: utils.BoolPointer(false), + Auth_users: utils.MapStringStringPointer(map[string]string{}), } expected := &HTTPCfg{ - HTTPJsonRPCURL: "/jsonrpc", - HTTPWSURL: "/ws", - DispatchersRegistrarURL: "/randomUrl", - HTTPFreeswitchCDRsURL: "/freeswitch_json", - HTTPCDRsURL: "/cdr_http", - HTTPUseBasicAuth: false, - HTTPAuthUsers: map[string]string{}, + HTTPJsonRPCURL: "/jsonrpc", + HTTPWSURL: "/ws", + RegistrarSURL: "/randomUrl", + HTTPFreeswitchCDRsURL: "/freeswitch_json", + HTTPCDRsURL: "/cdr_http", + HTTPUseBasicAuth: false, + HTTPAuthUsers: map[string]string{}, ClientOpts: map[string]interface{}{ utils.HTTPClientTLSClientConfigCfg: false, utils.HTTPClientTLSHandshakeTimeoutCfg: "10s", @@ -73,7 +73,7 @@ func TestHTTPCfgAsMapInterface(t *testing.T) { }` eMap := map[string]interface{}{ utils.HTTPJsonRPCURLCfg: "/jsonrpc", - utils.RegistrarSURLCfg: "/dispatchers_registrar", + utils.RegistrarSURLCfg: "/registrar", utils.HTTPWSURLCfg: "/ws", utils.HTTPFreeswitchCDRsURLCfg: "/freeswitch_json", utils.HTTPCDRsURLCfg: "/cdr_http", @@ -114,7 +114,7 @@ func TestHTTPCfgAsMapInterface1(t *testing.T) { }` eMap := map[string]interface{}{ utils.HTTPJsonRPCURLCfg: "/rpc", - utils.RegistrarSURLCfg: "/dispatchers_registrar", + utils.RegistrarSURLCfg: "/registrar", utils.HTTPWSURLCfg: "", utils.HTTPFreeswitchCDRsURLCfg: "/freeswitch_json", utils.HTTPCDRsURLCfg: "/cdr_http", @@ -149,12 +149,12 @@ func TestHTTPCfgAsMapInterface1(t *testing.T) { func TestHTTPCfgClone(t *testing.T) { ban := &HTTPCfg{ - HTTPJsonRPCURL: "/jsonrpc", - HTTPWSURL: "/ws", - DispatchersRegistrarURL: "/randomUrl", - HTTPFreeswitchCDRsURL: "/freeswitch_json", - HTTPCDRsURL: "/cdr_http", - HTTPUseBasicAuth: false, + HTTPJsonRPCURL: "/jsonrpc", + HTTPWSURL: "/ws", + RegistrarSURL: "/randomUrl", + HTTPFreeswitchCDRsURL: "/freeswitch_json", + HTTPCDRsURL: "/cdr_http", + HTTPUseBasicAuth: false, HTTPAuthUsers: map[string]string{ "user": "pass", }, diff --git a/config/libconfig_json.go b/config/libconfig_json.go index 83c7821f1..541c8c687 100644 --- a/config/libconfig_json.go +++ b/config/libconfig_json.go @@ -61,14 +61,14 @@ type ListenJsonCfg struct { // HTTP config section type HTTPJsonCfg struct { - Json_rpc_url *string - Dispatchers_registrar_url *string - Ws_url *string - Freeswitch_cdrs_url *string - Http_Cdrs *string - Use_basic_auth *bool - Auth_users *map[string]string - Client_opts map[string]interface{} + Json_rpc_url *string + Registrars_url *string + Ws_url *string + Freeswitch_cdrs_url *string + Http_Cdrs *string + Use_basic_auth *bool + Auth_users *map[string]string + Client_opts map[string]interface{} } type TlsJsonCfg struct { diff --git a/config/registrarccfg.go b/config/registrarccfg.go index e28cbc560..dd2ad7f2f 100644 --- a/config/registrarccfg.go +++ b/config/registrarccfg.go @@ -78,7 +78,7 @@ func (dps *RegistrarCCfg) loadFromJSONCfg(jsnCfg *RegistrarCJsonCfg) (err error) if jsnCfg.Hosts != nil { for tnt, hosts := range jsnCfg.Hosts { for _, hostJSON := range hosts { - conn := NewDfltRemoteHost() + conn := new(RemoteHost) conn.loadFromJSONCfg(hostJSON) dps.Hosts[tnt] = append(dps.Hosts[tnt], conn) } @@ -106,7 +106,9 @@ func (dps *RegistrarCCfg) AsMapInterface() (initialMP map[string]interface{}) { hosts := make(map[string][]map[string]interface{}) for tnt, hs := range dps.Hosts { for _, h := range hs { - hosts[tnt] = append(hosts[tnt], h.AsMapInterface()) + mp := h.AsMapInterface() + delete(mp, utils.AddressCfg) + hosts[tnt] = append(hosts[tnt], mp) } } initialMP[utils.HostsCfg] = hosts diff --git a/config/registrarccfg_test.go b/config/registrarccfg_test.go index 85adbc091..505aee1eb 100644 --- a/config/registrarccfg_test.go +++ b/config/registrarccfg_test.go @@ -156,44 +156,82 @@ func TestDispatcherHCfgloadFromJsonCfg(t *testing.T) { func TestDispatcherHCfgAsMapInterface(t *testing.T) { cfgJSONStr := `{ - "dispatcherh":{ - "enabled": true, - "dispatchers_conns": ["*conn1","*conn2"], - "hosts": { - "*default": [ - { - "ID": "Host1", - "register_transport": "*json", - "register_tls": false - }, - { - "ID": "Host2", - "register_transport": "*gob", - "register_tls": false - } - ] + "registrarc":{ + "rpc":{ + "enabled": true, + "registrars_conns": ["*conn1","*conn2"], + "hosts": { + "*default": [ + { + "ID": "Host1", + "transport": "*json", + "tls": false + }, + { + "ID": "Host2", + "transport": "*gob", + "tls": false + } + ] + }, + "refresh_interval": "0", + }, + "dispatcher":{ + "enabled": true, + "registrars_conns": ["*conn1","*conn2"], + "hosts": { + "*default": [ + { + "ID": "Host1", + "transport": "*json", + "tls": false + }, + { + "ID": "Host2", + "transport": "*gob", + "tls": false + } + ] + }, + "refresh_interval": "0", }, - "register_interval": "0", }, }` eMap := map[string]interface{}{ - utils.EnabledCfg: true, - utils.RegistrarsConnsCfg: []string{"*conn1", "*conn2"}, - utils.HostsCfg: map[string][]map[string]interface{}{ - utils.MetaDefault: { - { - utils.IDCfg: "Host1", - utils.TransportCfg: "*json", - utils.TLS: false, - }, - { - utils.IDCfg: "Host2", - utils.TransportCfg: "*gob", - utils.TLS: false, + utils.RPCCfg: map[string]interface{}{ + utils.EnabledCfg: true, + utils.RegistrarsConnsCfg: []string{"*conn1", "*conn2"}, + utils.HostsCfg: map[string][]map[string]interface{}{ + utils.MetaDefault: { + { + utils.IDCfg: "Host1", + utils.TransportCfg: "*json", + }, + { + utils.IDCfg: "Host2", + utils.TransportCfg: "*gob", + }, }, }, + 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: { + { + utils.IDCfg: "Host1", + utils.TransportCfg: "*json", + }, + { + utils.IDCfg: "Host2", + utils.TransportCfg: "*gob", + }, + }, + }, + utils.RefreshIntervalCfg: "0", }, - utils.RefreshIntervalCfg: "0", } if cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSONStr); err != nil { t.Error(err) @@ -228,73 +266,23 @@ func TestDispatcherCfgParseWithNanoSec2(t *testing.T) { } } -func TestDispatcherHCfgAsMapInterface1(t *testing.T) { - cfgJSONStr := `{ - "dispatcherh":{ - "enabled": true, - "dispatchers_conns":["conn1"], - "hosts": { - "*default": [ - { - "ID":"", - "register_transport": "*json", - "register_tls":false, - }, - { - "ID":"host2", - "register_transport": "", - "register_tls":true, - }, - ] - }, - "register_interval": "1m", - }, - -}` - eMap := map[string]interface{}{ - utils.EnabledCfg: true, - utils.RegistrarsConnsCfg: []string{"conn1"}, - utils.HostsCfg: map[string][]map[string]interface{}{ - utils.MetaDefault: { - { - utils.IDCfg: utils.EmptyString, - utils.TransportCfg: utils.MetaJSON, - utils.TLS: false, - }, - { - utils.IDCfg: "host2", - utils.TransportCfg: utils.EmptyString, - utils.TLS: true, - }, - }, - }, - utils.RefreshIntervalCfg: "1m0s", - } - if cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSONStr); err != nil { - t.Error(err) - } else { - rcv := cgrCfg.registrarCCfg.AsMapInterface() - if !reflect.DeepEqual(eMap[utils.HostsCfg].(map[string][]map[string]interface{})[utils.IDCfg], - rcv[utils.HostsCfg].(map[string][]map[string]interface{})[utils.IDCfg]) { - t.Errorf("Expected %+v, received %+v", eMap[utils.HostsCfg].(map[string][]map[string]interface{})[utils.IDCfg], - rcv[utils.HostsCfg].(map[string][]map[string]interface{})[utils.IDCfg]) - } else if !reflect.DeepEqual(eMap[utils.HostsCfg], rcv[utils.HostsCfg]) { - t.Errorf("Expected %+v, received %+v", eMap[utils.HostsCfg], rcv[utils.HostsCfg]) - } else if !reflect.DeepEqual(eMap, rcv) { - t.Errorf("Expected %+v, received %+v", eMap, rcv) - } - } -} - func TestDispatcherHCfgAsMapInterface2(t *testing.T) { cfgJSONStr := `{ - "dispatcherh": {}, + "registrarc": {}, }` eMap := map[string]interface{}{ - utils.EnabledCfg: false, - utils.RegistrarsConnsCfg: []string{}, - utils.HostsCfg: map[string][]map[string]interface{}{}, - utils.RefreshIntervalCfg: "5m0s", + 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", + }, } if cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSONStr); err != nil { t.Error(err) diff --git a/config/rpcconn.go b/config/rpcconn.go index f37004ea5..933f45bea 100644 --- a/config/rpcconn.go +++ b/config/rpcconn.go @@ -148,19 +148,27 @@ func (rh *RemoteHost) loadFromJSONCfg(jsnCfg *RemoteHostJson) { } // AsMapInterface returns the config as a map[string]interface{} -func (rh *RemoteHost) AsMapInterface() map[string]interface{} { - return map[string]interface{}{ - utils.IDCfg: rh.ID, - utils.AddressCfg: rh.Address, - utils.TransportCfg: rh.Transport, - utils.SynchronousCfg: rh.Synchronous, - utils.TLS: rh.TLS, +func (rh *RemoteHost) AsMapInterface() (mp map[string]interface{}) { + mp = map[string]interface{}{ + utils.AddressCfg: rh.Address, + utils.TransportCfg: rh.Transport, } + if rh.ID != utils.EmptyString { + mp[utils.IDCfg] = rh.ID + } + if rh.Synchronous { + mp[utils.SynchronousCfg] = rh.Synchronous + } + if rh.TLS { + mp[utils.TLS] = rh.TLS + } + return } // Clone returns a deep copy of RemoteHost func (rh RemoteHost) Clone() (cln *RemoteHost) { return &RemoteHost{ + ID: rh.ID, Address: rh.Address, Transport: rh.Transport, Synchronous: rh.Synchronous, diff --git a/config/rpcconn_test.go b/config/rpcconn_test.go index 8cc377207..661d2d79f 100644 --- a/config/rpcconn_test.go +++ b/config/rpcconn_test.go @@ -146,10 +146,8 @@ func TestRPCConnsAsMapInterface(t *testing.T) { utils.StrategyCfg: utils.MetaFirst, utils.Conns: []map[string]interface{}{ { - utils.AddressCfg: "127.0.0.1:2012", - utils.TransportCfg: "*json", - utils.SynchronousCfg: false, - utils.TLS: false, + utils.AddressCfg: "127.0.0.1:2012", + utils.TransportCfg: "*json", }, }, }, @@ -158,10 +156,8 @@ func TestRPCConnsAsMapInterface(t *testing.T) { utils.PoolSize: 0, utils.Conns: []map[string]interface{}{ { - utils.AddressCfg: utils.MetaInternal, - utils.TransportCfg: utils.EmptyString, - utils.SynchronousCfg: false, - utils.TLS: false, + utils.AddressCfg: utils.MetaInternal, + utils.TransportCfg: utils.EmptyString, }, }, }, @@ -170,10 +166,8 @@ func TestRPCConnsAsMapInterface(t *testing.T) { utils.PoolSize: 0, utils.Conns: []map[string]interface{}{ { - utils.AddressCfg: rpcclient.BiRPCInternal, - utils.TransportCfg: utils.EmptyString, - utils.SynchronousCfg: false, - utils.TLS: false, + utils.AddressCfg: rpcclient.BiRPCInternal, + utils.TransportCfg: utils.EmptyString, }, }, }, @@ -200,10 +194,8 @@ func TestRpcConnAsMapInterface1(t *testing.T) { utils.MetaInternal: map[string]interface{}{ utils.Conns: []map[string]interface{}{ { - utils.TLS: false, - utils.AddressCfg: utils.MetaInternal, - utils.SynchronousCfg: false, - utils.TransportCfg: utils.EmptyString, + utils.AddressCfg: utils.MetaInternal, + utils.TransportCfg: utils.EmptyString, }, }, utils.PoolSize: 0, @@ -212,10 +204,8 @@ func TestRpcConnAsMapInterface1(t *testing.T) { rpcclient.BiRPCInternal: map[string]interface{}{ utils.Conns: []map[string]interface{}{ { - utils.TLS: false, - utils.AddressCfg: rpcclient.BiRPCInternal, - utils.SynchronousCfg: false, - utils.TransportCfg: utils.EmptyString, + utils.AddressCfg: rpcclient.BiRPCInternal, + utils.TransportCfg: utils.EmptyString, }, }, utils.PoolSize: 0, diff --git a/data/conf/samples/dispatcherh/all2_mongo/cgrates.json b/data/conf/samples/dispatcherh/all2_mongo/cgrates.json index 3646c6992..3c8c1a8f8 100644 --- a/data/conf/samples/dispatcherh/all2_mongo/cgrates.json +++ b/data/conf/samples/dispatcherh/all2_mongo/cgrates.json @@ -36,7 +36,7 @@ }, "dispConn": { "strategy": "*first", - "conns": [{"address": "http://127.0.0.1:2080/dispatchers_registrar", "transport":"*http_jsonrpc"}] + "conns": [{"address": "http://127.0.0.1:2080/registrar", "transport":"*http_jsonrpc"}] } }, diff --git a/data/conf/samples/dispatcherh/all2_mysql/cgrates.json b/data/conf/samples/dispatcherh/all2_mysql/cgrates.json index 1ce9d6b8d..7f2cb35bb 100644 --- a/data/conf/samples/dispatcherh/all2_mysql/cgrates.json +++ b/data/conf/samples/dispatcherh/all2_mysql/cgrates.json @@ -34,7 +34,7 @@ }, "dispConn": { "strategy": "*first", - "conns": [{"address": "http://127.0.0.1:2080/dispatchers_registrar", "transport":"*http_jsonrpc"}] + "conns": [{"address": "http://127.0.0.1:2080/registrar", "transport":"*http_jsonrpc"}] } }, @@ -102,24 +102,24 @@ }, -"registrarc":{ - "rpc":{ - "enabled": true, - "registrars_conns": ["dispConn"], - "hosts": { - "*default":[{"ID":"ALL2", "transport": "*json", "tls": false}] - }, - "refresh_interval": "1s", - }, - "dispatcher":{ - "enabled": true, - "registrars_conns": ["dispConn"], - "hosts": { - "*default":[{"ID":"ALL2", "transport": "*json", "tls": false}] - }, - "refresh_interval": "1s", - }, -} - + "registrarc":{ + "rpc":{ + "enabled": true, + "registrars_conns": ["dispConn"], + "hosts": { + "*default":[{"ID":"ALL2", "transport": "*json", "tls": false}] + }, + "refresh_interval": "1s", + }, + "dispatcher":{ + "enabled": true, + "registrars_conns": ["dispConn"], + "hosts": { + "*default":[{"ID":"ALL2", "transport": "*json", "tls": false}] + }, + "refresh_interval": "1s", + }, } + +} \ No newline at end of file diff --git a/data/conf/samples/dispatcherh/all_mongo/cgrates.json b/data/conf/samples/dispatcherh/all_mongo/cgrates.json index b5a143d5c..6e3cf2e7a 100644 --- a/data/conf/samples/dispatcherh/all_mongo/cgrates.json +++ b/data/conf/samples/dispatcherh/all_mongo/cgrates.json @@ -40,7 +40,7 @@ }, "dispConn": { "strategy": "*first", - "conns": [{"address": "http://127.0.0.1:2080/dispatchers_registrar", "transport":"*http_jsonrpc"}] + "conns": [{"address": "http://127.0.0.1:2080/registrar", "transport":"*http_jsonrpc"}] } }, diff --git a/data/conf/samples/dispatcherh/all_mysql/cgrates.json b/data/conf/samples/dispatcherh/all_mysql/cgrates.json index b0213f935..3e79ad4b0 100644 --- a/data/conf/samples/dispatcherh/all_mysql/cgrates.json +++ b/data/conf/samples/dispatcherh/all_mysql/cgrates.json @@ -37,7 +37,7 @@ }, "dispConn": { "strategy": "*first", - "conns": [{"address": "http://127.0.0.1:2080/dispatchers_registrar", "transport":"*http_jsonrpc"}] + "conns": [{"address": "http://127.0.0.1:2080/registrar", "transport":"*http_jsonrpc"}] } }, diff --git a/data/conf/samples/dispatcherh/test_dispatcherh/cgrates.json b/data/conf/samples/dispatcherh/test_dispatcherh/cgrates.json index 0cc4448eb..c9ae00b2f 100644 --- a/data/conf/samples/dispatcherh/test_dispatcherh/cgrates.json +++ b/data/conf/samples/dispatcherh/test_dispatcherh/cgrates.json @@ -40,7 +40,7 @@ }, "dispConn": { "strategy": "*first", - "conns": [{"address": "http://127.0.0.1:2080/dispatchers_registrar", "transport":"*http_jsonrpc"}] + "conns": [{"address": "http://127.0.0.1:2080/registrar", "transport":"*http_jsonrpc"}] } }, diff --git a/dispatchers/replicator_it_test.go b/dispatchers/replicator_it_test.go index 761d929c4..5d7935f2b 100644 --- a/dispatchers/replicator_it_test.go +++ b/dispatchers/replicator_it_test.go @@ -24,6 +24,7 @@ import ( "reflect" "testing" + "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) @@ -437,7 +438,9 @@ func testDspRplDispatcherHost(t *testing.T) { setDispatcherHost := &engine.DispatcherHostWithOpts{ DispatcherHost: &engine.DispatcherHost{ Tenant: "cgrates.org", - ID: "ID", + RemoteHost: &config.RemoteHost{ + ID: "ID", + }, }, Opts: map[string]interface{}{ utils.OptsAPIKey: "repl12345", diff --git a/engine/z_loader_it_test.go b/engine/z_loader_it_test.go index 94b530f68..915f17bfc 100644 --- a/engine/z_loader_it_test.go +++ b/engine/z_loader_it_test.go @@ -46,13 +46,13 @@ var ( testLoaderITInitDataDB, testLoaderITInitStoreDB, testLoaderITRemoveLoad, - // testLoaderITLoadFromCSV, - // testLoaderITWriteToDatabase, - // testLoaderITImportToStorDb, - // testLoaderITInitDataDB, - // testLoaderITLoadFromStorDb, - // testLoaderITInitDataDB, - // testLoaderITLoadIndividualProfiles, + testLoaderITLoadFromCSV, + testLoaderITWriteToDatabase, + testLoaderITImportToStorDb, + testLoaderITInitDataDB, + testLoaderITLoadFromStorDb, + testLoaderITInitDataDB, + testLoaderITLoadIndividualProfiles, } ) diff --git a/loaders/loader_test.go b/loaders/loader_test.go index 8bfa2e335..78eaca966 100644 --- a/loaders/loader_test.go +++ b/loaders/loader_test.go @@ -1376,8 +1376,8 @@ func TestLoaderProcessDispatcheHosts(t *testing.T) { } eDispHost := &engine.DispatcherHost{ Tenant: "cgrates.org", - ID: "ALL1", - Conn: &config.RemoteHost{ + RemoteHost: &config.RemoteHost{ + ID: "ALL1", Address: "127.0.0.1:2012", Transport: utils.MetaJSON, TLS: true, @@ -4402,7 +4402,9 @@ cgrates.org,REM_DISPATCHERH_1 } expDispatchers := &engine.DispatcherHost{ Tenant: "cgrates.org", - ID: "REM_DISPATCHERH_1", + RemoteHost: &config.RemoteHost{ + ID: "REM_DISPATCHERH_1", + }, } if err := ldr.dm.SetDispatcherHost(expDispatchers); err != nil { t.Error(err) diff --git a/migrator/dispatchers_it_test.go b/migrator/dispatchers_it_test.go index 8461ef9d0..e4883ed4e 100644 --- a/migrator/dispatchers_it_test.go +++ b/migrator/dispatchers_it_test.go @@ -191,8 +191,8 @@ func testDspITMigrateAndMove(t *testing.T) { } dspHost := &engine.DispatcherHost{ Tenant: "cgrates.org", - ID: "ALL", - Conn: &config.RemoteHost{ + RemoteHost: &config.RemoteHost{ + ID: "ALL", Address: "127.0.0.1", Transport: utils.MetaJSON, }, diff --git a/registrarc/dispatcherh.go b/registrarc/dispatcherh.go deleted file mode 100644 index 26b8fe044..000000000 --- a/registrarc/dispatcherh.go +++ /dev/null @@ -1,102 +0,0 @@ -/* -Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments -Copyright (C) ITsysCOM GmbH - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -package registrarc - -import ( - "fmt" - "time" - - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" -) - -// NewRegistrarCService constructs a DispatcherHService -func NewRegistrarCService(cfg *config.CGRConfig, - connMgr *engine.ConnManager) *DispatcherHostsService { - return &DispatcherHostsService{ - cfg: cfg, - connMgr: connMgr, - } -} - -// DispatcherHostsService is the service handling dispatching towards internal components -// designed to handle automatic partitioning and failover -type DispatcherHostsService struct { - cfg *config.CGRConfig - connMgr *engine.ConnManager -} - -// ListenAndServe will initialize the service -func (dhS *DispatcherHostsService) ListenAndServe(stopChan chan struct{}) { - utils.Logger.Info("Starting DispatcherH service") - for { - dhS.registerHosts() - select { - case <-stopChan: - return - case <-time.After(dhS.cfg.RegistrarCCfg().Dispatcher.RefreshInterval): - } - } -} - -// Shutdown is called to shutdown the service -func (dhS *DispatcherHostsService) Shutdown() { - utils.Logger.Info(fmt.Sprintf("<%s> service shutdown initialized", utils.RegistrarC)) - dhS.unregisterHosts() - utils.Logger.Info(fmt.Sprintf("<%s> service shutdown complete", utils.RegistrarC)) - return -} - -func (dhS *DispatcherHostsService) registerHosts() { - for _, connID := range dhS.cfg.RegistrarCCfg().Dispatcher.RegistrarSConns { - for tnt, hostCfgs := range dhS.cfg.RegistrarCCfg().Dispatcher.Hosts { - if tnt == utils.MetaDefault { - tnt = dhS.cfg.GeneralCfg().DefaultTenant - } - args, err := NewRegisterArgs(dhS.cfg, tnt, hostCfgs) - if err != nil { - continue - } - var rply string - if err := dhS.connMgr.Call([]string{connID}, nil, utils.RegistrarSv1RegisterDispatcherHosts, args, &rply); err != nil { - utils.Logger.Warning(fmt.Sprintf("<%s> Unable to set the hosts to the conn with ID <%s> because : %s", - utils.RegistrarC, connID, err)) - continue - } - } - } - return -} - -func (dhS *DispatcherHostsService) unregisterHosts() { - var rply string - for _, connID := range dhS.cfg.RegistrarCCfg().Dispatcher.RegistrarSConns { - for tnt, hostCfgs := range dhS.cfg.RegistrarCCfg().Dispatcher.Hosts { - if tnt == utils.MetaDefault { - tnt = dhS.cfg.GeneralCfg().DefaultTenant - } - if err := dhS.connMgr.Call([]string{connID}, nil, utils.RegistrarSv1UnregisterDispatcherHosts, NewUnregisterArgs(tnt, hostCfgs), &rply); err != nil { - utils.Logger.Warning(fmt.Sprintf("<%s> Unable to set the hosts with tenant<%s> to the conn with ID <%s> because : %s", - utils.RegistrarC, tnt, connID, err)) - continue - } - } - } -} diff --git a/registrarc/libdispatcherh.go b/registrarc/libregistrarc.go similarity index 88% rename from registrarc/libdispatcherh.go rename to registrarc/libregistrarc.go index 00ce53a91..ef8342710 100644 --- a/registrarc/libdispatcherh.go +++ b/registrarc/libregistrarc.go @@ -165,21 +165,12 @@ func register(req *http.Request) (*json.RawMessage, error) { } case utils.RegistrarSv1RegisterDispatcherHosts: - var dHs RegisterArgs - params := []interface{}{&dHs} - if err = json.Unmarshal(*sReq.Params, ¶ms); err != nil { - utils.Logger.Warning(fmt.Sprintf("<%s> Failed to decode params because: %s", - utils.RegistrarC, err)) - return sReq.Id, err - } - var addr string - if addr, err = utils.GetRemoteIP(req); err != nil { - utils.Logger.Warning(fmt.Sprintf("<%s> Failed to obtain the remote IP because: %s", - utils.RegistrarC, err)) + dH, err := unmarshallRegisterArgs(req, *sReq.Params) + if err != nil { return sReq.Id, err } - for _, dH := range dHs.AsDispatcherHosts(addr) { + for _, dH := range dH { if err = engine.Cache.Set(utils.CacheDispatcherHosts, dH.TenantID(), dH, nil, true, utils.NonTransactional); err != nil { utils.Logger.Warning(fmt.Sprintf("<%s> Failed to set DispatcherHost <%s> in cache because: %s", @@ -208,22 +199,12 @@ func register(req *http.Request) (*json.RawMessage, error) { } config.CgrConfig().UnlockSections(config.RPCConnsJsonName) case utils.RegistrarSv1RegisterRPCHosts: - var dHs RegisterArgs - params := []interface{}{&dHs} - if err = json.Unmarshal(*sReq.Params, ¶ms); err != nil { - utils.Logger.Warning(fmt.Sprintf("<%s> Failed to decode params because: %s", - utils.RegistrarC, err)) + dH, err := unmarshallRegisterArgs(req, *sReq.Params) + if err != nil { return sReq.Id, err } - var addr string - if addr, err = utils.GetRemoteIP(req); err != nil { - utils.Logger.Warning(fmt.Sprintf("<%s> Failed to obtain the remote IP because: %s", - utils.RegistrarC, err)) - return sReq.Id, err - } - cfgHosts := make(map[string]*config.RemoteHost) - for _, dH := range dHs.AsDispatcherHosts(addr) { + for _, dH := range dH { cfgHosts[dH.ID] = dH.RemoteHost } config.CgrConfig().LockSections(config.RPCConnsJsonName) @@ -266,6 +247,10 @@ func getConnPort(cfg *config.CGRConfig, transport string, tls bool) (port string address = cfg.ListenCfg().HTTPListen } extraPath = cfg.HTTPCfg().HTTPJsonRPCURL + case rpcclient.BiRPCJSON: + address = cfg.SessionSCfg().ListenBijson + case rpcclient.BiRPCGOB: + address = cfg.SessionSCfg().ListenBigob } if _, port, err = net.SplitHostPort(address); err != nil { return @@ -273,3 +258,21 @@ func getConnPort(cfg *config.CGRConfig, transport string, tls bool) (port string port += extraPath return } + +func unmarshallRegisterArgs(req *http.Request, reqParams json.RawMessage) (dH []*engine.DispatcherHost, err error) { + var dHs RegisterArgs + params := []interface{}{&dHs} + if err = json.Unmarshal(reqParams, ¶ms); err != nil { + utils.Logger.Warning(fmt.Sprintf("<%s> Failed to decode params because: %s", + utils.RegistrarC, err)) + return + } + var addr string + if addr, err = utils.GetRemoteIP(req); err != nil { + utils.Logger.Warning(fmt.Sprintf("<%s> Failed to obtain the remote IP because: %s", + utils.RegistrarC, err)) + return + } + + return dHs.AsDispatcherHosts(addr), nil +} diff --git a/registrarc/libdispatcherh_test.go b/registrarc/libregistrarc_test.go similarity index 100% rename from registrarc/libdispatcherh_test.go rename to registrarc/libregistrarc_test.go diff --git a/registrarc/registrarc.go b/registrarc/registrarc.go new file mode 100644 index 000000000..6fd6a49db --- /dev/null +++ b/registrarc/registrarc.go @@ -0,0 +1,162 @@ +/* +Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments +Copyright (C) ITsysCOM GmbH + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +package registrarc + +import ( + "fmt" + "time" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" +) + +// NewRegistrarCService constructs a DispatcherHService +func NewRegistrarCService(cfg *config.CGRConfig, + connMgr *engine.ConnManager) *RegistrarCService { + return &RegistrarCService{ + cfg: cfg, + connMgr: connMgr, + } +} + +// RegistrarCService is the service handling dispatching towards internal components +// designed to handle automatic partitioning and failover +type RegistrarCService struct { + cfg *config.CGRConfig + connMgr *engine.ConnManager +} + +// ListenAndServe will initialize the service +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) + dhS.registerDispHosts() + } + if rTmStarted = dhS.cfg.RegistrarCCfg().RPC.Enabled; rTmStarted { + rTm = time.NewTimer(dhS.cfg.RegistrarCCfg().RPC.RefreshInterval) + dhS.registerRPCHosts() + } + for { + select { + case <-rldChan: + if rTmStarted { + rTm.Stop() + } + if dTmStarted { + dTm.Stop() + } + if dTmStarted = dhS.cfg.RegistrarCCfg().Dispatcher.Enabled; dTmStarted { + dTm = time.NewTimer(dhS.cfg.RegistrarCCfg().Dispatcher.RefreshInterval) + dhS.registerDispHosts() + } + if rTmStarted = dhS.cfg.RegistrarCCfg().RPC.Enabled; rTmStarted { + rTm = time.NewTimer(dhS.cfg.RegistrarCCfg().RPC.RefreshInterval) + dhS.registerRPCHosts() + } + case <-stopChan: + if dhS.cfg.RegistrarCCfg().Dispatcher.Enabled { + dTm.Stop() + } + if dhS.cfg.RegistrarCCfg().RPC.Enabled { + rTm.Stop() + } + return + case <-dTm.C: + dhS.registerDispHosts() + dTm.Reset(dhS.cfg.RegistrarCCfg().Dispatcher.RefreshInterval) + case <-rTm.C: + dhS.registerRPCHosts() + rTm.Reset(dhS.cfg.RegistrarCCfg().RPC.RefreshInterval) + } + } +} + +// 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, + dhS.cfg.GeneralCfg().DefaultTenant, utils.RegistrarSv1UnregisterDispatcherHosts) + } + if dhS.cfg.RegistrarCCfg().RPC.Enabled { + unregisterHosts(dhS.connMgr, dhS.cfg.RegistrarCCfg().RPC, + dhS.cfg.GeneralCfg().DefaultTenant, utils.RegistrarSv1UnregisterRPCHosts) + } + utils.Logger.Info(fmt.Sprintf("<%s> service shutdown complete", utils.RegistrarC)) +} + +func (dhS *RegistrarCService) registerDispHosts() { + for _, connID := range dhS.cfg.RegistrarCCfg().Dispatcher.RegistrarSConns { + for tnt, hostCfgs := range dhS.cfg.RegistrarCCfg().Dispatcher.Hosts { + if tnt == utils.MetaDefault { + tnt = dhS.cfg.GeneralCfg().DefaultTenant + } + args, err := NewRegisterArgs(dhS.cfg, tnt, hostCfgs) + if err != nil { + continue + } + var rply string + if err := dhS.connMgr.Call([]string{connID}, nil, utils.RegistrarSv1RegisterDispatcherHosts, args, &rply); err != nil { + utils.Logger.Warning(fmt.Sprintf("<%s> Unable to set the hosts to the conn with ID <%s> because : %s", + utils.RegistrarC, connID, err)) + continue + } + } + } + return +} + +func (dhS *RegistrarCService) registerRPCHosts() { + for _, connID := range dhS.cfg.RegistrarCCfg().RPC.RegistrarSConns { + for tnt, hostCfgs := range dhS.cfg.RegistrarCCfg().RPC.Hosts { + if tnt == utils.MetaDefault { + tnt = dhS.cfg.GeneralCfg().DefaultTenant + } + args, err := NewRegisterArgs(dhS.cfg, tnt, hostCfgs) + if err != nil { + continue + } + var rply string + if err := dhS.connMgr.Call([]string{connID}, nil, utils.RegistrarSv1RegisterRPCHosts, args, &rply); err != nil { + utils.Logger.Warning(fmt.Sprintf("<%s> Unable to set the hosts to the conn with ID <%s> because : %s", + utils.RegistrarC, connID, err)) + continue + } + } + } + return +} + +func unregisterHosts(connMgr *engine.ConnManager, regCfg *config.RegistrarCCfg, dTnt, method string) { + var rply string + for _, connID := range regCfg.RegistrarSConns { + for tnt, hostCfgs := range regCfg.Hosts { + if tnt == utils.MetaDefault { + tnt = dTnt + } + if err := connMgr.Call([]string{connID}, nil, method, NewUnregisterArgs(tnt, hostCfgs), &rply); err != nil { + utils.Logger.Warning(fmt.Sprintf("<%s> Unable to unregister the hosts with tenant<%s> to the conn with ID <%s> because : %s", + utils.RegistrarC, tnt, connID, err)) + } + } + } +} diff --git a/registrarc/dispatcherh_it_test.go b/registrarc/registrarc_it_test.go similarity index 100% rename from registrarc/dispatcherh_it_test.go rename to registrarc/registrarc_it_test.go diff --git a/registrarc/dispatcherh_test.go b/registrarc/registrarc_test.go similarity index 76% rename from registrarc/dispatcherh_test.go rename to registrarc/registrarc_test.go index 494bbeeaf..ab7ce0d5e 100644 --- a/registrarc/dispatcherh_test.go +++ b/registrarc/registrarc_test.go @@ -32,7 +32,7 @@ import ( ) func TestDispatcherHostsService(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(Registar)) + ts := httptest.NewServer(http.HandlerFunc(Registrar)) defer ts.Close() cfg := config.NewDefaultCGRConfig() @@ -45,26 +45,26 @@ func TestDispatcherHostsService(t *testing.T) { Transport: rpcclient.HTTPjson, }}, } - cfg.DispatcherHCfg().Enabled = true - cfg.DispatcherHCfg().Hosts = map[string][]*config.DispatcherHRegistarCfg{ + cfg.RegistrarCCfg().Dispatcher.Enabled = true + cfg.RegistrarCCfg().Dispatcher.Hosts = map[string][]*config.RemoteHost{ utils.MetaDefault: { { - ID: "Host1", - RegisterTransport: utils.MetaJSON, + ID: "Host1", + Transport: utils.MetaJSON, }, }, } - cfg.DispatcherHCfg().RefreshInterval = 100 * time.Millisecond - cfg.DispatcherHCfg().RegistrarSConns = []string{"conn1"} + cfg.RegistrarCCfg().Dispatcher.RefreshInterval = 100 * time.Millisecond + cfg.RegistrarCCfg().Dispatcher.RegistrarSConns = []string{"conn1"} ds := NewRegistrarCService(cfg, engine.NewConnManager(cfg, map[string]chan rpcclient.ClientConnector{})) - ds.registerHosts() + ds.registerDispHosts() host1 := &engine.DispatcherHost{ Tenant: "cgrates.org", - ID: "Host1", - Conn: &config.RemoteHost{ + RemoteHost: &config.RemoteHost{ + ID: "Host1", Address: "127.0.0.1:2012", Transport: utils.MetaJSON, }, @@ -75,24 +75,24 @@ func TestDispatcherHostsService(t *testing.T) { } else if !reflect.DeepEqual(host1, x) { t.Errorf("Expected: %s ,received: %s", utils.ToJSON(host1), utils.ToJSON(x)) } - cfg.DispatcherHCfg().Hosts = map[string][]*config.DispatcherHRegistarCfg{ + cfg.RegistrarCCfg().Dispatcher.Hosts = map[string][]*config.RemoteHost{ utils.MetaDefault: { { - ID: "Host2", - RegisterTransport: utils.MetaJSON, + ID: "Host2", + Transport: utils.MetaJSON, }, }, } config.CgrConfig().CacheCfg().Partitions[utils.CacheDispatcherHosts].Replicate = true config.CgrConfig().CacheCfg().ReplicationConns = []string{"*localhost"} - ds.registerHosts() + ds.registerDispHosts() host1.ID = "Host2" if x, ok := engine.Cache.Get(utils.CacheDispatcherHosts, host1.TenantID()); !ok { t.Errorf("Expected to find Host2 in cache") } else if !reflect.DeepEqual(host1, x) { t.Errorf("Expected: %s ,received: %s", utils.ToJSON(host1), utils.ToJSON(x)) } - ds.unregisterHosts() + unregisterHosts(ds.connMgr, cfg.RegistrarCCfg().Dispatcher, "cgrates.org", utils.RegistrarSv1UnregisterDispatcherHosts) if _, ok := engine.Cache.Get(utils.CacheDispatcherHosts, host1.TenantID()); ok { t.Errorf("Expected to not find Host2 in cache") } @@ -101,11 +101,11 @@ func TestDispatcherHostsService(t *testing.T) { config.CgrConfig().CacheCfg().ReplicationConns = []string{} host1.ID = "Host1" - cfg.DispatcherHCfg().Hosts = map[string][]*config.DispatcherHRegistarCfg{ + cfg.RegistrarCCfg().Dispatcher.Hosts = map[string][]*config.RemoteHost{ utils.MetaDefault: { { - ID: "Host1", - RegisterTransport: utils.MetaJSON, + ID: "Host1", + Transport: utils.MetaJSON, }, }, } @@ -115,11 +115,11 @@ func TestDispatcherHostsService(t *testing.T) { } cfg.ListenCfg().RPCJSONListen = "2012" - ds.registerHosts() + ds.registerDispHosts() ds = NewRegistrarCService(cfg, engine.NewConnManager(cfg, map[string]chan rpcclient.ClientConnector{})) ds.Shutdown() stopChan := make(chan struct{}) close(stopChan) - ds.ListenAndServe(stopChan) + ds.ListenAndServe(stopChan, make(chan struct{})) } diff --git a/services/accounts.go b/services/accounts.go index d88a7f992..4f2b9f3c1 100644 --- a/services/accounts.go +++ b/services/accounts.go @@ -112,14 +112,12 @@ func (acts *AccountService) Reload() (err error) { // Shutdown stops the service func (acts *AccountService) Shutdown() (err error) { acts.Lock() - defer acts.Unlock() close(acts.stopChan) - if err = acts.acts.Shutdown(); err != nil { - return - } + acts.acts.Shutdown() acts.acts = nil acts.rpc = nil <-acts.connChan + acts.Unlock() return } diff --git a/services/registrarc.go b/services/registrarc.go index d32a27f0b..4b738dfa9 100644 --- a/services/registrarc.go +++ b/services/registrarc.go @@ -23,8 +23,8 @@ import ( "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/cores" - "github.com/cgrates/cgrates/dispatcherh" "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/registrarc" "github.com/cgrates/cgrates/servmanager" "github.com/cgrates/cgrates/utils" ) @@ -49,8 +49,9 @@ type RegistrarCService struct { server *cores.Server connMgr *engine.ConnManager stopChan chan struct{} + rldChan chan struct{} - dspS *dispatcherh.DispatcherHostsService + dspS *registrarc.RegistrarCService anz *AnalyzerService srvDep map[string]*sync.WaitGroup } @@ -65,14 +66,16 @@ func (dspS *RegistrarCService) Start() (err error) { defer dspS.Unlock() dspS.stopChan = make(chan struct{}) - dspS.dspS = dispatcherh.NewDispatcherHService(dspS.cfg, dspS.connMgr) - go dspS.dspS.ListenAndServe(dspS.stopChan) + dspS.rldChan = make(chan struct{}) + dspS.dspS = registrarc.NewRegistrarCService(dspS.cfg, dspS.connMgr) + go dspS.dspS.ListenAndServe(dspS.stopChan, dspS.rldChan) return } // Reload handles the change of config func (dspS *RegistrarCService) Reload() (err error) { + dspS.rldChan <- struct{}{} return // for the momment nothing to reload } @@ -100,5 +103,5 @@ func (dspS *RegistrarCService) ServiceName() string { // ShouldRun returns if the service should be running func (dspS *RegistrarCService) ShouldRun() bool { - return dspS.cfg.DispatcherHCfg().Enabled + return dspS.cfg.RegistrarCCfg().Dispatcher.Enabled || dspS.cfg.RegistrarCCfg().RPC.Enabled } diff --git a/services/registrarc_it_test.go b/services/registrarc_it_test.go index 85f08fbd8..1b0ae6352 100644 --- a/services/registrarc_it_test.go +++ b/services/registrarc_it_test.go @@ -89,7 +89,7 @@ func TestDispatcherHReload(t *testing.T) { if err != nil { t.Errorf("\nExpecting ,\n Received <%+v>", err) } - cfg.DispatcherHCfg().Enabled = false + cfg.RegistrarCCfg().Dispatcher.Enabled = false cfg.GetReloadChan(config.RegistrarCJson) <- struct{}{} time.Sleep(10 * time.Millisecond) if srv.IsRunning() { diff --git a/services/registrarc_test.go b/services/registrarc_test.go index c3846ea2d..680a805c9 100644 --- a/services/registrarc_test.go +++ b/services/registrarc_test.go @@ -21,8 +21,8 @@ import ( "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/cores" - "github.com/cgrates/cgrates/dispatcherh" "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/registrarc" "github.com/cgrates/cgrates/utils" "github.com/cgrates/rpcclient" ) @@ -52,7 +52,7 @@ func TestDispatcherHCoverage(t *testing.T) { if srv2.IsRunning() { t.Errorf("Expected service to be down") } - srv2.dspS = &dispatcherh.DispatcherHostsService{} + srv2.dspS = ®istrarc.RegistrarCService{} if !srv2.IsRunning() { t.Errorf("Expected service to be running") } @@ -69,7 +69,7 @@ func TestDispatcherHCoverage(t *testing.T) { t.Errorf("Expected service to be running") } srv2.stopChan = make(chan struct{}, 1) - srv2.dspS = dispatcherh.NewDispatcherHService(cfg, cM) + srv2.dspS = registrarc.NewRegistrarCService(cfg, cM) shutdownSrv := srv2.Shutdown() if shutdownSrv != nil { t.Errorf("\nExpecting ,\n Received <%+v>", shutdownSrv) diff --git a/utils/coreutils.go b/utils/coreutils.go index 71882d996..be4df8185 100644 --- a/utils/coreutils.go +++ b/utils/coreutils.go @@ -275,7 +275,7 @@ func ParseTimeDetectLayout(tmStr string, timezone string) (time.Time, error) { return time.ParseInLocation("02/01/2006 15:04:05", tmStr, loc) case broadsoftTimestampRule.MatchString(tmStr): return time.ParseInLocation("20060102150405.999", tmStr, loc) - case tmStr == "*now": + case tmStr == MetaNow: return time.Now(), nil case strings.HasPrefix(tmStr, "+"): tmStr = strings.TrimPrefix(tmStr, "+")