From 5a85c119c820e35df111c39df59291a9492e5fff Mon Sep 17 00:00:00 2001 From: gezimbll Date: Fri, 27 Oct 2023 09:33:57 -0400 Subject: [PATCH] Replacing IsSliceMember ,CloneStringSlice and SliceStringEqual with slices package equivalent functions --- agents/agentreq.go | 9 +++--- agents/fsevent.go | 5 +-- agents/kamevent.go | 11 ++++--- apier/v1/accounts.go | 3 +- apier/v1/apier.go | 3 +- apier/v1/filter_indexes.go | 9 +++--- apier/v2/accounts.go | 5 +-- config/attributescfg.go | 8 +++-- config/cachecfg.go | 5 +-- config/config_test.go | 6 ++-- config/configsanity.go | 13 ++++---- config/fctemplate.go | 5 +-- config/migratorcfg.go | 5 +-- config/migratorcfg_test.go | 2 +- config/statscfg.go | 3 +- config/thresholdscfg.go | 3 +- console/command_executer.go | 3 +- dispatchers/dispatchers.go | 3 +- engine/account.go | 3 +- engine/action.go | 5 +-- engine/argees.go | 3 +- engine/attributes.go | 5 +-- engine/cdrs.go | 3 +- engine/datamanager.go | 7 ++-- engine/datamanager_test.go | 3 +- engine/destinations.go | 3 +- engine/eventcost.go | 3 +- engine/exportrequest.go | 3 +- engine/libindex_health.go | 13 ++++---- engine/libtest.go | 3 +- engine/storage_internal_stordb.go | 49 ++++++++++++++-------------- engine/z_actions_it_test.go | 5 +-- engine/z_onstor_it_test.go | 9 ++++-- ers/ers.go | 3 +- migrator/user.go | 3 +- sessions/libsessions.go | 5 +-- sessions/sessions.go | 3 +- utils/apitpdata.go | 3 +- utils/coreutils.go | 3 +- utils/map.go | 3 +- utils/orderednavigablemap.go | 9 +++--- utils/slice.go | 39 ---------------------- utils/slice_test.go | 54 ------------------------------- 43 files changed, 148 insertions(+), 195 deletions(-) diff --git a/agents/agentreq.go b/agents/agentreq.go index 809a59d14..0b997c2a3 100644 --- a/agents/agentreq.go +++ b/agents/agentreq.go @@ -20,6 +20,7 @@ package agents import ( "fmt" + "slices" "strings" "github.com/cgrates/cgrates/config" @@ -229,7 +230,7 @@ func (ar *AgentRequest) SetFields(tplFlds []*config.FCTemplate) (err error) { return } else if fullPath == nil { // no dynamic path fullPath = &utils.FullPath{ - PathSlice: utils.CloneStringSlice(tplFld.GetPathSlice()), // need to clone so me do not modify the template + PathSlice: slices.Clone(tplFld.GetPathSlice()), // need to clone so me do not modify the template Path: tplFld.Path, } } @@ -321,14 +322,14 @@ func (ar *AgentRequest) Remove(fullPath *utils.FullPath) error { default: return fmt.Errorf("unsupported field prefix: <%s> when set fields", fullPath.PathSlice[0]) case utils.MetaVars: - return ar.Vars.Remove(utils.CloneStringSlice(fullPath.PathSlice[1:])) + return ar.Vars.Remove(slices.Clone(fullPath.PathSlice[1:])) case utils.MetaCgreq: return ar.CGRRequest.Remove(&utils.FullPath{ PathSlice: fullPath.PathSlice[1:], Path: fullPath.Path[7:], }) case utils.MetaCgrep: - return ar.CGRReply.Remove(utils.CloneStringSlice(fullPath.PathSlice[1:])) + return ar.CGRReply.Remove(slices.Clone(fullPath.PathSlice[1:])) case utils.MetaRep: return ar.Reply.Remove(&utils.FullPath{ PathSlice: fullPath.PathSlice[1:], @@ -340,7 +341,7 @@ func (ar *AgentRequest) Remove(fullPath *utils.FullPath) error { Path: fullPath.Path[9:], }) case utils.MetaTmp: - return ar.tmp.Remove(utils.CloneStringSlice(fullPath.PathSlice[1:])) + return ar.tmp.Remove(slices.Clone(fullPath.PathSlice[1:])) case utils.MetaOpts: return ar.Opts.Remove(fullPath.PathSlice[1:]) case utils.MetaUCH: diff --git a/agents/fsevent.go b/agents/fsevent.go index 97eecb50e..c6b6cdbd3 100644 --- a/agents/fsevent.go +++ b/agents/fsevent.go @@ -20,6 +20,7 @@ package agents import ( "fmt" + "slices" "strconv" "strings" "time" @@ -231,7 +232,7 @@ func (fsev FSEvent) GetDuration(fieldName string) (time.Duration, error) { func (fsev FSEvent) GetPdd(fieldName string) (time.Duration, error) { var PDDStr string - if utils.SliceHasMember([]string{utils.MetaDefault, utils.PDD}, fieldName) { + if slices.Contains([]string{utils.MetaDefault, utils.PDD}, fieldName) { PDDStr = utils.FirstNonEmpty(fsev[PDD_MEDIA_MS], fsev[PDD_NOMEDIA_MS]) if len(PDDStr) != 0 { PDDStr = PDDStr + "ms" // PDD is in milliseconds and CGR expects it in seconds @@ -246,7 +247,7 @@ func (fsev FSEvent) GetPdd(fieldName string) (time.Duration, error) { func (fsev FSEvent) GetADC(fieldName string) (time.Duration, error) { var ACDStr string - if utils.SliceHasMember([]string{utils.MetaDefault, utils.ACD}, fieldName) { + if slices.Contains([]string{utils.MetaDefault, utils.ACD}, fieldName) { ACDStr = utils.FirstNonEmpty(fsev[VarCGRACD]) if len(ACDStr) != 0 { ACDStr = ACDStr + "s" // ACD is in seconds and CGR expects it in seconds diff --git a/agents/kamevent.go b/agents/kamevent.go index 72d442fc0..edc37b86c 100644 --- a/agents/kamevent.go +++ b/agents/kamevent.go @@ -21,6 +21,7 @@ package agents import ( "encoding/json" "fmt" + "slices" "strings" "time" @@ -87,12 +88,12 @@ type KamEvent map[string]string func (kev KamEvent) MissingParameter() bool { switch kev[EVENT] { case CGR_AUTH_REQUEST: - return utils.IsSliceMember([]string{ + return slices.Contains([]string{ kev[KamTRIndex], kev[KamTRLabel], }, "") case CGR_CALL_START: - return utils.IsSliceMember([]string{ + return slices.Contains([]string{ kev[KamHashEntry], kev[KamHashID], kev[utils.OriginID], @@ -101,7 +102,7 @@ func (kev KamEvent) MissingParameter() bool { kev[utils.Destination], }, "") case CGR_CALL_END: - return utils.IsSliceMember([]string{ + return slices.Contains([]string{ kev[utils.OriginID], kev[utils.AnswerTime], kev[utils.AccountField], @@ -119,10 +120,10 @@ func (kev KamEvent) MissingParameter() bool { kev[utils.AccountField], kev[utils.Destination]) } - return utils.IsSliceMember(mndPrm, "") + return slices.Contains(mndPrm, "") case CGR_PROCESS_CDR: // TRIndex and TRLabel must exist in order to know where to send back the response - return utils.IsSliceMember([]string{ + return slices.Contains([]string{ kev[KamTRIndex], kev[KamTRLabel], kev[utils.OriginID], diff --git a/apier/v1/accounts.go b/apier/v1/accounts.go index 34d7d13c8..8dc6d112c 100644 --- a/apier/v1/accounts.go +++ b/apier/v1/accounts.go @@ -21,6 +21,7 @@ package v1 import ( "errors" "math" + "slices" "strings" "time" @@ -219,7 +220,7 @@ func (apierSv1 *APIerSv1) SetAccount(ctx *context.Context, attr *utils.AttrSetAc dirtyActionPlans[apID] = ap acntAPids = append(acntAPids[:i], acntAPids[i+1:]...) // remove the item from the list so we can overwrite the real list } - if !utils.IsSliceMember(acntAPids, attr.ActionPlanID) { // Account not yet attached to action plan, do it here + if !slices.Contains(acntAPids, attr.ActionPlanID) { // Account not yet attached to action plan, do it here ap, err := apierSv1.DataManager.GetActionPlan(attr.ActionPlanID, true, true, utils.NonTransactional) if err != nil { return err diff --git a/apier/v1/apier.go b/apier/v1/apier.go index f85d05787..c37400392 100644 --- a/apier/v1/apier.go +++ b/apier/v1/apier.go @@ -24,6 +24,7 @@ import ( "fmt" "os" "path" + "slices" "strconv" "strings" "time" @@ -1259,7 +1260,7 @@ func (apierSv1 *APIerSv1) RemoveRatingProfile(ctx *context.Context, attr *AttrRe if attr.Tenant == utils.EmptyString { attr.Tenant = apierSv1.Config.GeneralCfg().DefaultTenant } - if (attr.Subject != utils.EmptyString && utils.IsSliceMember([]string{attr.Tenant, attr.Category}, utils.EmptyString)) || + if (attr.Subject != utils.EmptyString && slices.Contains([]string{attr.Tenant, attr.Category}, utils.EmptyString)) || (attr.Category != utils.EmptyString && attr.Tenant == utils.EmptyString) { return utils.ErrMandatoryIeMissing } diff --git a/apier/v1/filter_indexes.go b/apier/v1/filter_indexes.go index 4d8982058..4115ee8c5 100644 --- a/apier/v1/filter_indexes.go +++ b/apier/v1/filter_indexes.go @@ -19,6 +19,7 @@ along with this program. If not, see package v1 import ( + "slices" "strings" "time" @@ -312,7 +313,7 @@ func (apierSv1 *APIerSv1) ComputeFilterIndexes(ctx *context.Context, args *utils if e != nil { return nil, e } - if !utils.IsSliceMember(ap.Contexts, ctx) { + if !slices.Contains(ap.Contexts, ctx) { return nil, nil } fltrIDs := make([]string, len(ap.FilterIDs)) @@ -354,7 +355,7 @@ func (apierSv1 *APIerSv1) ComputeFilterIndexes(ctx *context.Context, args *utils if e != nil { return nil, e } - if !utils.IsSliceMember(dsp.Subsystems, ctx) { + if !slices.Contains(dsp.Subsystems, ctx) { return nil, nil } fltrIDs := make([]string, len(dsp.FilterIDs)) @@ -524,7 +525,7 @@ func (apierSv1 *APIerSv1) ComputeFilterIndexIDs(ctx *context.Context, args *util if e != nil { return nil, e } - if !utils.IsSliceMember(ap.Contexts, ctx) { + if !slices.Contains(ap.Contexts, ctx) { return nil, nil } fltrIDs := make([]string, len(ap.FilterIDs)) @@ -563,7 +564,7 @@ func (apierSv1 *APIerSv1) ComputeFilterIndexIDs(ctx *context.Context, args *util if e != nil { return nil, e } - if !utils.IsSliceMember(dsp.Subsystems, ctx) { + if !slices.Contains(dsp.Subsystems, ctx) { return nil, nil } fltrIDs := make([]string, len(dsp.FilterIDs)) diff --git a/apier/v2/accounts.go b/apier/v2/accounts.go index 3b396f9bd..bc7b85208 100644 --- a/apier/v2/accounts.go +++ b/apier/v2/accounts.go @@ -21,6 +21,7 @@ package v2 import ( "errors" "math" + "slices" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/config" @@ -156,7 +157,7 @@ func (apiv2 *APIerSv2) SetAccount(ctx *context.Context, attr *AttrSetAccount, re // clean previous action plans nAcntAPids := make([]string, 0, len(acntAPids)) for _, apID := range acntAPids { - if utils.IsSliceMember(attr.ActionPlanIDs, apID) { + if slices.Contains(attr.ActionPlanIDs, apID) { nAcntAPids = append(nAcntAPids, apID) continue // not removing the ones where } @@ -193,7 +194,7 @@ func (apiv2 *APIerSv2) SetAccount(ctx *context.Context, attr *AttrSetAccount, re schedNeedsReload = true } if schedTasks == len(ap.ActionTimings) || // scheduled all actions, no need to add account to AP - utils.IsSliceMember(acntAPids, apID) { + slices.Contains(acntAPids, apID) { continue // No need to reschedule since already there } if ap.AccountIDs == nil { diff --git a/config/attributescfg.go b/config/attributescfg.go index 0c2e24550..b8453a906 100644 --- a/config/attributescfg.go +++ b/config/attributescfg.go @@ -18,7 +18,11 @@ along with this program. If not, see package config -import "github.com/cgrates/cgrates/utils" +import ( + "slices" + + "github.com/cgrates/cgrates/utils" +) type AttributesOpts struct { ProfileIDs []string @@ -212,7 +216,7 @@ func (alS *AttributeSCfg) AsMapInterface() (initialMP map[string]any) { func (attrOpts *AttributesOpts) Clone() *AttributesOpts { cln := &AttributesOpts{ - ProfileIDs: utils.CloneStringSlice(attrOpts.ProfileIDs), + ProfileIDs: slices.Clone(attrOpts.ProfileIDs), ProfileRuns: attrOpts.ProfileRuns, ProfileIgnoreFilters: attrOpts.ProfileIgnoreFilters, ProcessRuns: attrOpts.ProcessRuns, diff --git a/config/cachecfg.go b/config/cachecfg.go index cf93387fd..e6f317dba 100644 --- a/config/cachecfg.go +++ b/config/cachecfg.go @@ -20,6 +20,7 @@ package config import ( "fmt" + "slices" "time" "github.com/cgrates/cgrates/utils" @@ -173,10 +174,10 @@ func (cCfg CacheCfg) Clone() (cln *CacheCfg) { cln.Partitions[key] = par.Clone() } if cCfg.ReplicationConns != nil { - cln.ReplicationConns = utils.CloneStringSlice(cCfg.ReplicationConns) + cln.ReplicationConns = slices.Clone(cCfg.ReplicationConns) } if cCfg.RemoteConns != nil { - cln.RemoteConns = utils.CloneStringSlice(cCfg.RemoteConns) + cln.RemoteConns = slices.Clone(cCfg.RemoteConns) } return } diff --git a/config/config_test.go b/config/config_test.go index 26bb24bdb..fd62662fa 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -4346,7 +4346,7 @@ func TestV1GetConfigSectionMigrator(t *testing.T) { utils.OutStorDBNameCfg: "cgrates", utils.OutStorDBUserCfg: "cgrates", utils.OutStorDBPasswordCfg: "", - utils.UsersFiltersCfg: []string{}, + utils.UsersFiltersCfg: []string(nil), utils.OutStorDBOptsCfg: map[string]any{ utils.MongoQueryTimeoutCfg: "0s", utils.MYSQLDSNParams: map[string]string(nil), @@ -5101,7 +5101,7 @@ func TestV1GetConfigAsJSONCgrLoader(t *testing.T) { func TestV1GetConfigAsJSONCgrMigrator(t *testing.T) { var reply string - expected := `{"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"mongoQueryTimeout":"0s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"out_datadb_password":"","out_datadb_port":"6379","out_datadb_type":"*redis","out_datadb_user":"cgrates","out_stordb_host":"127.0.0.1","out_stordb_name":"cgrates","out_stordb_opts":{"mongoQueryTimeout":"0s","mysqlDSNParams":null,"mysqlLocation":"","pgSSLMode":"","sqlConnMaxLifetime":"0s","sqlMaxIdleConns":0,"sqlMaxOpenConns":0},"out_stordb_password":"","out_stordb_port":"3306","out_stordb_type":"*mysql","out_stordb_user":"cgrates","users_filters":[]}}` + expected := `{"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"mongoQueryTimeout":"0s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"out_datadb_password":"","out_datadb_port":"6379","out_datadb_type":"*redis","out_datadb_user":"cgrates","out_stordb_host":"127.0.0.1","out_stordb_name":"cgrates","out_stordb_opts":{"mongoQueryTimeout":"0s","mysqlDSNParams":null,"mysqlLocation":"","pgSSLMode":"","sqlConnMaxLifetime":"0s","sqlMaxIdleConns":0,"sqlMaxOpenConns":0},"out_stordb_password":"","out_stordb_port":"3306","out_stordb_type":"*mysql","out_stordb_user":"cgrates","users_filters":null}}` cgrCfg := NewDefaultCGRConfig() if err := cgrCfg.V1GetConfigAsJSON(context.Background(), &SectionWithAPIOpts{Section: CgrMigratorCfgJson}, &reply); err != nil { t.Error(err) @@ -5314,7 +5314,7 @@ func TestV1GetConfigAsJSONAllConfig(t *testing.T) { }` var reply string cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSON) - expected := `{"analyzers":{"cleanup_interval":"1h0m0s","db_path":"/var/spool/cgrates/analyzers","enabled":false,"index_type":"*scorch","ttl":"24h0m0s"},"apiban":{"keys":[]},"apiers":{"attributes_conns":[],"caches_conns":["*internal"],"ees_conns":[],"enabled":false,"scheduler_conns":[]},"asterisk_agent":{"asterisk_conns":[{"address":"127.0.0.1:8088","alias":"","connect_attempts":3,"max_reconnect_interval":"0s","password":"CGRateS.org","reconnects":5,"user":"cgrates"}],"create_cdr":false,"enabled":false,"sessions_conns":["*birpc_internal"]},"attributes":{"any_context":true,"apiers_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"opts":{"*processRuns":1,"*profileIDs":[],"*profileIgnoreFilters":false,"*profileRuns":0},"prefix_indexed_fields":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"caches":{"partitions":{"*account_action_plans":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_plans":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_triggers":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*actions":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*apiban":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2m0s"},"*attribute_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*caps_events":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*cdr_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10m0s"},"*charger_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*closed_sessions":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*destinations":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*diameter_messages":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*dispatcher_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_hosts":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_loads":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_routes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatchers":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*event_charges":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*event_resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rating_plans":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rating_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*replication_hosts":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*reverse_destinations":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_connections":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_responses":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2s"},"*sentrypeer":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":true,"ttl":"24h0m0s"},"*shared_groups":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*stat_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*stir":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*threshold_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*timings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*uch":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"}},"remote_conns":[],"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":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_triggers":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*destinations":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_hosts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rating_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rating_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*reverse_destinations":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*shared_groups":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*stat_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*timings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*versions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_filtered":false},"diameter_agent":{"asr_template":"","concurrent_requests":-1,"dictionaries_path":"/usr/share/cgrates/diameter/dict/","enabled":false,"forced_disconnect":"*none","listen":"127.0.0.1:3868","listen_net":"tcp","origin_host":"CGR-DA","origin_realm":"cgrates.org","product_name":"CGRateS","rar_template":"","request_processors":[],"sessions_conns":["*birpc_internal"],"synced_conn_requests":false,"vendor_id":0},"dispatchers":{"any_subsystem":true,"attributes_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"prevent_loop":false,"suffix_indexed_fields":[]},"dns_agent":{"enabled":false,"listeners":[{"address":"127.0.0.1:53","network":"udp"}],"request_processors":[],"sessions_conns":["*internal"],"timezone":""},"ees":{"attributes_conns":[],"cache":{"*file_csv":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"enabled":false,"exporters":[{"attempts":1,"attribute_context":"","attribute_ids":[],"concurrent_requests":0,"export_path":"/var/spool/cgrates/ees","failed_posts_dir":"/var/spool/cgrates/failed_posts","fields":[],"filters":[],"flags":[],"id":"*default","opts":{},"synchronous":false,"timezone":"","type":"*none"}]},"ers":{"enabled":false,"partial_cache_ttl":"1s","readers":[{"cache_dump_fields":[],"concurrent_requests":1024,"fields":[{"mandatory":true,"path":"*cgreq.ToR","tag":"ToR","type":"*variable","value":"~*req.2"},{"mandatory":true,"path":"*cgreq.OriginID","tag":"OriginID","type":"*variable","value":"~*req.3"},{"mandatory":true,"path":"*cgreq.RequestType","tag":"RequestType","type":"*variable","value":"~*req.4"},{"mandatory":true,"path":"*cgreq.Tenant","tag":"Tenant","type":"*variable","value":"~*req.6"},{"mandatory":true,"path":"*cgreq.Category","tag":"Category","type":"*variable","value":"~*req.7"},{"mandatory":true,"path":"*cgreq.Account","tag":"Account","type":"*variable","value":"~*req.8"},{"mandatory":true,"path":"*cgreq.Subject","tag":"Subject","type":"*variable","value":"~*req.9"},{"mandatory":true,"path":"*cgreq.Destination","tag":"Destination","type":"*variable","value":"~*req.10"},{"mandatory":true,"path":"*cgreq.SetupTime","tag":"SetupTime","type":"*variable","value":"~*req.11"},{"mandatory":true,"path":"*cgreq.AnswerTime","tag":"AnswerTime","type":"*variable","value":"~*req.12"},{"mandatory":true,"path":"*cgreq.Usage","tag":"Usage","type":"*variable","value":"~*req.13"}],"filters":[],"flags":[],"id":"*default","opts":{"csvFieldSeparator":",","csvHeaderDefineChar":":","csvRowLength":0,"natsSubject":"cgrates_cdrs","partialCacheAction":"*none","partialOrderField":"~*req.AnswerTime"},"partial_commit_fields":[],"processed_path":"/var/spool/cgrates/ers/out","run_delay":"0","source_path":"/var/spool/cgrates/ers/in","tenant":"","timezone":"","type":"*none"}],"sessions_conns":["*internal"]},"filters":{"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","max_reconnect_interval":"0s","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,"max_reconnect_interval":"0","node_id":"ENGINE1","poster_attempts":3,"reconnects":-1,"reply_timeout":"2s","rounding_decimals":5,"rsr_separator":";","tpexport_dir":"/var/spool/cgrates/tpe"},"http":{"auth_users":{},"client_opts":{"dialFallbackDelay":"300ms","dialKeepAlive":"30s","dialTimeout":"30s","disableCompression":false,"disableKeepAlives":false,"expectContinueTimeout":"0s","forceAttemptHttp2":true,"idleConnTimeout":"1m30s","maxConnsPerHost":0,"maxIdleConns":100,"maxIdleConnsPerHost":2,"responseHeaderTimeout":"0s","skipTlsVerify":false,"tlsHandshakeTimeout":"10s"},"freeswitch_cdrs_url":"/freeswitch_json","http_cdrs":"/cdr_http","json_rpc_url":"/jsonrpc","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":"","max_reconnect_interval":"0s","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":"ConnectAttempts","tag":"ConnectAttempts","type":"*variable","value":"~*req.4"},{"path":"Reconnects","tag":"Reconnects","type":"*variable","value":"~*req.5"},{"path":"MaxReconnectInterval","tag":"MaxReconnectInterval","type":"*variable","value":"~*req.6"},{"path":"ConnectTimeout","tag":"ConnectTimeout","type":"*variable","value":"~*req.7"},{"path":"ReplyTimeout","tag":"ReplyTimeout","type":"*variable","value":"~*req.8"},{"path":"TLS","tag":"TLS","type":"*variable","value":"~*req.9"},{"path":"ClientKey","tag":"ClientKey","type":"*variable","value":"~*req.10"},{"path":"ClientCertificate","tag":"ClientCertificate","type":"*variable","value":"~*req.11"},{"path":"CaCertificate","tag":"CaCertificate","type":"*variable","value":"~*req.12"}],"file_name":"DispatcherHosts.csv","flags":null,"type":"*dispatcher_hosts"}],"dry_run":false,"enabled":false,"field_separator":",","id":"*default","lockfile_path":".cgr.lck","run_delay":"0","tenant":"","tp_in_dir":"/var/spool/cgrates/loader/in","tp_out_dir":"/var/spool/cgrates/loader/out"}],"mailer":{"auth_password":"CGRateS.org","auth_user":"cgrates","from_address":"cgr-mailer@localhost.localdomain","server":"localhost"},"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"mongoQueryTimeout":"0s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"out_datadb_password":"","out_datadb_port":"6379","out_datadb_type":"*redis","out_datadb_user":"cgrates","out_stordb_host":"127.0.0.1","out_stordb_name":"cgrates","out_stordb_opts":{"mongoQueryTimeout":"0s","mysqlDSNParams":null,"mysqlLocation":"","pgSSLMode":"","sqlConnMaxLifetime":"0s","sqlMaxIdleConns":0,"sqlMaxOpenConns":0},"out_stordb_password":"","out_stordb_port":"3306","out_stordb_type":"*mysql","out_stordb_user":"cgrates","users_filters":[]},"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"},"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":[]},"registrarc":{"dispatchers":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]},"rpc":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]}},"resources":{"enabled":false,"indexed_selects":true,"nested_fields":false,"opts":{"*units":1,"*usageID":""},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[],"thresholds_conns":[]},"routes":{"attributes_conns":[],"default_ratio":1,"enabled":false,"indexed_selects":true,"nested_fields":false,"opts":{"*context":"*routes","*ignoreErrors":false,"*maxCost":""},"prefix_indexed_fields":[],"rals_conns":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"rpc_conns":{"*bijson_localhost":{"conns":[{"address":"127.0.0.1:2014","transport":"*birpc_json"}],"poolSize":0,"strategy":"*first"},"*birpc_internal":{"conns":[{"address":"*birpc_internal","transport":""}],"poolSize":0,"strategy":"*first"},"*internal":{"conns":[{"address":"*internal","transport":""}],"poolSize":0,"strategy":"*first"},"*localhost":{"conns":[{"address":"127.0.0.1:2012","transport":"*json"}],"poolSize":0,"strategy":"*first"}},"schedulers":{"cdrs_conns":[],"dynaprepaid_actionplans":[],"enabled":false,"filters":[],"stats_conns":[],"thresholds_conns":[]},"sentrypeer":{"Audience":"https://sentrypeer.com/api","ClientID":"","ClientSecret":"","GrantType":"client_credentials","IpUrl":"https://sentrypeer.com/api/ip-addresses","NumberUrl":"https://sentrypeer.com/api/phone-numbers","TokenURL":"https://authz.sentrypeer.com/oauth/token"},"sessions":{"alterable_fields":[],"attributes_conns":[],"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","stale_chan_max_extra_usage":"0","stats_conns":[],"stir":{"allowed_attest":["*any"],"default_attest":"A","payload_maxduration":"-1","privatekey_path":"","publickey_path":""},"store_session_costs":false,"terminate_attempts":5,"thresholds_conns":[]},"sip_agent":{"enabled":false,"listen":"127.0.0.1:5060","listen_net":"udp","request_processors":[],"retransmission_timer":1000000000,"sessions_conns":["*internal"],"timezone":""},"stats":{"enabled":false,"indexed_selects":true,"nested_fields":false,"opts":{"*profileIDs":[],"*profileIgnoreFilters":false},"prefix_indexed_fields":[],"store_interval":"","store_uncompressed_limit":0,"suffix_indexed_fields":[],"thresholds_conns":[]},"stor_db":{"db_host":"127.0.0.1","db_name":"cgrates","db_password":"CGRateS.org","db_port":3306,"db_type":"*mysql","db_user":"cgrates","items":{"*cdrs":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*session_costs":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_account_actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_action_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_action_triggers":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_attributes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_chargers":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_destination_rates":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_destinations":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_dispatcher_hosts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_dispatcher_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_filters":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_rates":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_rating_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_rating_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_resources":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_routes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_shared_groups":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_stats":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_thresholds":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_timings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*versions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"mongoQueryTimeout":"10s","mysqlDSNParams":{},"mysqlLocation":"Local","pgSSLMode":"disable","sqlConnMaxLifetime":"0s","sqlMaxIdleConns":10,"sqlMaxOpenConns":100},"prefix_indexed_fields":[],"remote_conns":null,"replication_conns":null,"string_indexed_fields":[]},"suretax":{"bill_to_number":"","business_unit":"","client_number":"","client_tracking":"~*req.CGRID","customer_number":"~*req.Subject","include_local_cost":false,"orig_number":"~*req.Subject","p2pplus4":"","p2pzipcode":"","plus4":"","regulatory_code":"03","response_group":"03","response_type":"D4","return_file_code":"0","sales_type_code":"R","tax_exemption_code_list":"","tax_included":"0","tax_situs_rule":"04","term_number":"~*req.Destination","timezone":"UTC","trans_type_code":"010101","unit_type":"00","units":"1","url":"","validation_key":"","zipcode":""},"templates":{"*asr":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"}],"*cca":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"path":"*rep.Result-Code","tag":"ResultCode","type":"*constant","value":"2001"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"},{"mandatory":true,"path":"*rep.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"mandatory":true,"path":"*rep.CC-Request-Type","tag":"CCRequestType","type":"*variable","value":"~*req.CC-Request-Type"},{"mandatory":true,"path":"*rep.CC-Request-Number","tag":"CCRequestNumber","type":"*variable","value":"~*req.CC-Request-Number"}],"*cdrLog":[{"mandatory":true,"path":"*cdr.ToR","tag":"ToR","type":"*variable","value":"~*req.BalanceType"},{"mandatory":true,"path":"*cdr.OriginHost","tag":"OriginHost","type":"*constant","value":"127.0.0.1"},{"mandatory":true,"path":"*cdr.RequestType","tag":"RequestType","type":"*constant","value":"*none"},{"mandatory":true,"path":"*cdr.Tenant","tag":"Tenant","type":"*variable","value":"~*req.Tenant"},{"mandatory":true,"path":"*cdr.Account","tag":"Account","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Subject","tag":"Subject","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Cost","tag":"Cost","type":"*variable","value":"~*req.Cost"},{"mandatory":true,"path":"*cdr.Source","tag":"Source","type":"*constant","value":"*cdrLog"},{"mandatory":true,"path":"*cdr.Usage","tag":"Usage","type":"*constant","value":"1"},{"mandatory":true,"path":"*cdr.RunID","tag":"RunID","type":"*variable","value":"~*req.ActionType"},{"mandatory":true,"path":"*cdr.SetupTime","tag":"SetupTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.AnswerTime","tag":"AnswerTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.PreRated","tag":"PreRated","type":"*constant","value":"true"}],"*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,"opts":{"*profileIDs":[],"*profileIgnoreFilters":false},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[]},"tls":{"ca_certificate":"","client_certificate":"","client_key":"","server_certificate":"","server_key":"","server_name":"","server_policy":4}}` + expected := `{"analyzers":{"cleanup_interval":"1h0m0s","db_path":"/var/spool/cgrates/analyzers","enabled":false,"index_type":"*scorch","ttl":"24h0m0s"},"apiban":{"keys":[]},"apiers":{"attributes_conns":[],"caches_conns":["*internal"],"ees_conns":[],"enabled":false,"scheduler_conns":[]},"asterisk_agent":{"asterisk_conns":[{"address":"127.0.0.1:8088","alias":"","connect_attempts":3,"max_reconnect_interval":"0s","password":"CGRateS.org","reconnects":5,"user":"cgrates"}],"create_cdr":false,"enabled":false,"sessions_conns":["*birpc_internal"]},"attributes":{"any_context":true,"apiers_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"opts":{"*processRuns":1,"*profileIDs":[],"*profileIgnoreFilters":false,"*profileRuns":0},"prefix_indexed_fields":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"caches":{"partitions":{"*account_action_plans":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_plans":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_triggers":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*actions":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*apiban":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2m0s"},"*attribute_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*caps_events":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*cdr_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10m0s"},"*charger_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*closed_sessions":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*destinations":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*diameter_messages":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*dispatcher_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_hosts":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_loads":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_routes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*dispatchers":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*event_charges":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*event_resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rating_plans":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rating_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*replication_hosts":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*reverse_destinations":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_connections":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_responses":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2s"},"*sentrypeer":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":true,"ttl":"24h0m0s"},"*shared_groups":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*stat_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*stir":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*threshold_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*timings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*uch":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"}},"remote_conns":[],"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":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_triggers":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*destinations":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_hosts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*dispatcher_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rating_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rating_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*reverse_destinations":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*shared_groups":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*stat_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*timings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*versions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_filtered":false},"diameter_agent":{"asr_template":"","concurrent_requests":-1,"dictionaries_path":"/usr/share/cgrates/diameter/dict/","enabled":false,"forced_disconnect":"*none","listen":"127.0.0.1:3868","listen_net":"tcp","origin_host":"CGR-DA","origin_realm":"cgrates.org","product_name":"CGRateS","rar_template":"","request_processors":[],"sessions_conns":["*birpc_internal"],"synced_conn_requests":false,"vendor_id":0},"dispatchers":{"any_subsystem":true,"attributes_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"prevent_loop":false,"suffix_indexed_fields":[]},"dns_agent":{"enabled":false,"listeners":[{"address":"127.0.0.1:53","network":"udp"}],"request_processors":[],"sessions_conns":["*internal"],"timezone":""},"ees":{"attributes_conns":[],"cache":{"*file_csv":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"enabled":false,"exporters":[{"attempts":1,"attribute_context":"","attribute_ids":[],"concurrent_requests":0,"export_path":"/var/spool/cgrates/ees","failed_posts_dir":"/var/spool/cgrates/failed_posts","fields":[],"filters":[],"flags":[],"id":"*default","opts":{},"synchronous":false,"timezone":"","type":"*none"}]},"ers":{"enabled":false,"partial_cache_ttl":"1s","readers":[{"cache_dump_fields":[],"concurrent_requests":1024,"fields":[{"mandatory":true,"path":"*cgreq.ToR","tag":"ToR","type":"*variable","value":"~*req.2"},{"mandatory":true,"path":"*cgreq.OriginID","tag":"OriginID","type":"*variable","value":"~*req.3"},{"mandatory":true,"path":"*cgreq.RequestType","tag":"RequestType","type":"*variable","value":"~*req.4"},{"mandatory":true,"path":"*cgreq.Tenant","tag":"Tenant","type":"*variable","value":"~*req.6"},{"mandatory":true,"path":"*cgreq.Category","tag":"Category","type":"*variable","value":"~*req.7"},{"mandatory":true,"path":"*cgreq.Account","tag":"Account","type":"*variable","value":"~*req.8"},{"mandatory":true,"path":"*cgreq.Subject","tag":"Subject","type":"*variable","value":"~*req.9"},{"mandatory":true,"path":"*cgreq.Destination","tag":"Destination","type":"*variable","value":"~*req.10"},{"mandatory":true,"path":"*cgreq.SetupTime","tag":"SetupTime","type":"*variable","value":"~*req.11"},{"mandatory":true,"path":"*cgreq.AnswerTime","tag":"AnswerTime","type":"*variable","value":"~*req.12"},{"mandatory":true,"path":"*cgreq.Usage","tag":"Usage","type":"*variable","value":"~*req.13"}],"filters":[],"flags":[],"id":"*default","opts":{"csvFieldSeparator":",","csvHeaderDefineChar":":","csvRowLength":0,"natsSubject":"cgrates_cdrs","partialCacheAction":"*none","partialOrderField":"~*req.AnswerTime"},"partial_commit_fields":[],"processed_path":"/var/spool/cgrates/ers/out","run_delay":"0","source_path":"/var/spool/cgrates/ers/in","tenant":"","timezone":"","type":"*none"}],"sessions_conns":["*internal"]},"filters":{"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","max_reconnect_interval":"0s","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,"max_reconnect_interval":"0","node_id":"ENGINE1","poster_attempts":3,"reconnects":-1,"reply_timeout":"2s","rounding_decimals":5,"rsr_separator":";","tpexport_dir":"/var/spool/cgrates/tpe"},"http":{"auth_users":{},"client_opts":{"dialFallbackDelay":"300ms","dialKeepAlive":"30s","dialTimeout":"30s","disableCompression":false,"disableKeepAlives":false,"expectContinueTimeout":"0s","forceAttemptHttp2":true,"idleConnTimeout":"1m30s","maxConnsPerHost":0,"maxIdleConns":100,"maxIdleConnsPerHost":2,"responseHeaderTimeout":"0s","skipTlsVerify":false,"tlsHandshakeTimeout":"10s"},"freeswitch_cdrs_url":"/freeswitch_json","http_cdrs":"/cdr_http","json_rpc_url":"/jsonrpc","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":"","max_reconnect_interval":"0s","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":"ConnectAttempts","tag":"ConnectAttempts","type":"*variable","value":"~*req.4"},{"path":"Reconnects","tag":"Reconnects","type":"*variable","value":"~*req.5"},{"path":"MaxReconnectInterval","tag":"MaxReconnectInterval","type":"*variable","value":"~*req.6"},{"path":"ConnectTimeout","tag":"ConnectTimeout","type":"*variable","value":"~*req.7"},{"path":"ReplyTimeout","tag":"ReplyTimeout","type":"*variable","value":"~*req.8"},{"path":"TLS","tag":"TLS","type":"*variable","value":"~*req.9"},{"path":"ClientKey","tag":"ClientKey","type":"*variable","value":"~*req.10"},{"path":"ClientCertificate","tag":"ClientCertificate","type":"*variable","value":"~*req.11"},{"path":"CaCertificate","tag":"CaCertificate","type":"*variable","value":"~*req.12"}],"file_name":"DispatcherHosts.csv","flags":null,"type":"*dispatcher_hosts"}],"dry_run":false,"enabled":false,"field_separator":",","id":"*default","lockfile_path":".cgr.lck","run_delay":"0","tenant":"","tp_in_dir":"/var/spool/cgrates/loader/in","tp_out_dir":"/var/spool/cgrates/loader/out"}],"mailer":{"auth_password":"CGRateS.org","auth_user":"cgrates","from_address":"cgr-mailer@localhost.localdomain","server":"localhost"},"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"mongoQueryTimeout":"0s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"out_datadb_password":"","out_datadb_port":"6379","out_datadb_type":"*redis","out_datadb_user":"cgrates","out_stordb_host":"127.0.0.1","out_stordb_name":"cgrates","out_stordb_opts":{"mongoQueryTimeout":"0s","mysqlDSNParams":null,"mysqlLocation":"","pgSSLMode":"","sqlConnMaxLifetime":"0s","sqlMaxIdleConns":0,"sqlMaxOpenConns":0},"out_stordb_password":"","out_stordb_port":"3306","out_stordb_type":"*mysql","out_stordb_user":"cgrates","users_filters":null},"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"},"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":[]},"registrarc":{"dispatchers":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]},"rpc":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]}},"resources":{"enabled":false,"indexed_selects":true,"nested_fields":false,"opts":{"*units":1,"*usageID":""},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[],"thresholds_conns":[]},"routes":{"attributes_conns":[],"default_ratio":1,"enabled":false,"indexed_selects":true,"nested_fields":false,"opts":{"*context":"*routes","*ignoreErrors":false,"*maxCost":""},"prefix_indexed_fields":[],"rals_conns":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"rpc_conns":{"*bijson_localhost":{"conns":[{"address":"127.0.0.1:2014","transport":"*birpc_json"}],"poolSize":0,"strategy":"*first"},"*birpc_internal":{"conns":[{"address":"*birpc_internal","transport":""}],"poolSize":0,"strategy":"*first"},"*internal":{"conns":[{"address":"*internal","transport":""}],"poolSize":0,"strategy":"*first"},"*localhost":{"conns":[{"address":"127.0.0.1:2012","transport":"*json"}],"poolSize":0,"strategy":"*first"}},"schedulers":{"cdrs_conns":[],"dynaprepaid_actionplans":[],"enabled":false,"filters":[],"stats_conns":[],"thresholds_conns":[]},"sentrypeer":{"Audience":"https://sentrypeer.com/api","ClientID":"","ClientSecret":"","GrantType":"client_credentials","IpUrl":"https://sentrypeer.com/api/ip-addresses","NumberUrl":"https://sentrypeer.com/api/phone-numbers","TokenURL":"https://authz.sentrypeer.com/oauth/token"},"sessions":{"alterable_fields":[],"attributes_conns":[],"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","stale_chan_max_extra_usage":"0","stats_conns":[],"stir":{"allowed_attest":["*any"],"default_attest":"A","payload_maxduration":"-1","privatekey_path":"","publickey_path":""},"store_session_costs":false,"terminate_attempts":5,"thresholds_conns":[]},"sip_agent":{"enabled":false,"listen":"127.0.0.1:5060","listen_net":"udp","request_processors":[],"retransmission_timer":1000000000,"sessions_conns":["*internal"],"timezone":""},"stats":{"enabled":false,"indexed_selects":true,"nested_fields":false,"opts":{"*profileIDs":[],"*profileIgnoreFilters":false},"prefix_indexed_fields":[],"store_interval":"","store_uncompressed_limit":0,"suffix_indexed_fields":[],"thresholds_conns":[]},"stor_db":{"db_host":"127.0.0.1","db_name":"cgrates","db_password":"CGRateS.org","db_port":3306,"db_type":"*mysql","db_user":"cgrates","items":{"*cdrs":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*session_costs":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_account_actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_action_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_action_triggers":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_attributes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_chargers":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_destination_rates":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_destinations":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_dispatcher_hosts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_dispatcher_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_filters":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_rates":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_rating_plans":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_rating_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_resources":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_routes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_shared_groups":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_stats":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_thresholds":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*tp_timings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*versions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"mongoQueryTimeout":"10s","mysqlDSNParams":{},"mysqlLocation":"Local","pgSSLMode":"disable","sqlConnMaxLifetime":"0s","sqlMaxIdleConns":10,"sqlMaxOpenConns":100},"prefix_indexed_fields":[],"remote_conns":null,"replication_conns":null,"string_indexed_fields":[]},"suretax":{"bill_to_number":"","business_unit":"","client_number":"","client_tracking":"~*req.CGRID","customer_number":"~*req.Subject","include_local_cost":false,"orig_number":"~*req.Subject","p2pplus4":"","p2pzipcode":"","plus4":"","regulatory_code":"03","response_group":"03","response_type":"D4","return_file_code":"0","sales_type_code":"R","tax_exemption_code_list":"","tax_included":"0","tax_situs_rule":"04","term_number":"~*req.Destination","timezone":"UTC","trans_type_code":"010101","unit_type":"00","units":"1","url":"","validation_key":"","zipcode":""},"templates":{"*asr":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"}],"*cca":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"path":"*rep.Result-Code","tag":"ResultCode","type":"*constant","value":"2001"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"},{"mandatory":true,"path":"*rep.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"mandatory":true,"path":"*rep.CC-Request-Type","tag":"CCRequestType","type":"*variable","value":"~*req.CC-Request-Type"},{"mandatory":true,"path":"*rep.CC-Request-Number","tag":"CCRequestNumber","type":"*variable","value":"~*req.CC-Request-Number"}],"*cdrLog":[{"mandatory":true,"path":"*cdr.ToR","tag":"ToR","type":"*variable","value":"~*req.BalanceType"},{"mandatory":true,"path":"*cdr.OriginHost","tag":"OriginHost","type":"*constant","value":"127.0.0.1"},{"mandatory":true,"path":"*cdr.RequestType","tag":"RequestType","type":"*constant","value":"*none"},{"mandatory":true,"path":"*cdr.Tenant","tag":"Tenant","type":"*variable","value":"~*req.Tenant"},{"mandatory":true,"path":"*cdr.Account","tag":"Account","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Subject","tag":"Subject","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Cost","tag":"Cost","type":"*variable","value":"~*req.Cost"},{"mandatory":true,"path":"*cdr.Source","tag":"Source","type":"*constant","value":"*cdrLog"},{"mandatory":true,"path":"*cdr.Usage","tag":"Usage","type":"*constant","value":"1"},{"mandatory":true,"path":"*cdr.RunID","tag":"RunID","type":"*variable","value":"~*req.ActionType"},{"mandatory":true,"path":"*cdr.SetupTime","tag":"SetupTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.AnswerTime","tag":"AnswerTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.PreRated","tag":"PreRated","type":"*constant","value":"true"}],"*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,"opts":{"*profileIDs":[],"*profileIgnoreFilters":false},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[]},"tls":{"ca_certificate":"","client_certificate":"","client_key":"","server_certificate":"","server_key":"","server_name":"","server_policy":4}}` if err != nil { t.Fatal(err) } diff --git a/config/configsanity.go b/config/configsanity.go index 7f2154f32..e3730be37 100644 --- a/config/configsanity.go +++ b/config/configsanity.go @@ -23,6 +23,7 @@ import ( "math" "os" "path" + "slices" "strings" "github.com/cgrates/cgrates/utils" @@ -482,10 +483,10 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> template with ID <%s> has connection with id: <%s> not defined", utils.HTTPAgent, httpAgentCfg.ID, connID) } } - if !utils.SliceHasMember([]string{utils.MetaUrl, utils.MetaXml}, httpAgentCfg.RequestPayload) { + if !slices.Contains([]string{utils.MetaUrl, utils.MetaXml}, httpAgentCfg.RequestPayload) { return fmt.Errorf("<%s> unsupported request payload %s", utils.HTTPAgent, httpAgentCfg.RequestPayload) } - if !utils.SliceHasMember([]string{utils.MetaTextPlain, utils.MetaXml}, httpAgentCfg.ReplyPayload) { + if !slices.Contains([]string{utils.MetaTextPlain, utils.MetaXml}, httpAgentCfg.ReplyPayload) { return fmt.Errorf("<%s> unsupported reply payload %s", utils.HTTPAgent, httpAgentCfg.ReplyPayload) } for _, req := range httpAgentCfg.RequestProcessors { @@ -814,7 +815,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { // The following sanity check prevents a "slice bounds out of range" panic. if rdr.Type == utils.MetaFileXML && len(field.Value) != 0 && - !utils.IsSliceMember([]string{utils.MetaNone, utils.MetaConstant}, field.Type) { + !slices.Contains([]string{utils.MetaNone, utils.MetaConstant}, field.Type) { // Find the minimum rule length for dynamic RSRParser within the field value. minRuleLength := math.MaxInt @@ -918,7 +919,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { } // StorDB sanity checks if cfg.storDbCfg.Type == utils.MetaPostgres { - if !utils.IsSliceMember([]string{utils.PostgresSSLModeDisable, utils.PostgressSSLModeAllow, + if !slices.Contains([]string{utils.PostgresSSLModeDisable, utils.PostgressSSLModeAllow, utils.PostgresSSLModePrefer, utils.PostgressSSLModeRequire, utils.PostgresSSLModeVerifyCa, utils.PostgresSSLModeVerifyFull}, cfg.storDbCfg.Opts.PgSSLMode) { return fmt.Errorf("<%s> unsupported sslmode for storDB", utils.StorDB) @@ -1055,7 +1056,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { } for tnt, hosts := range cfg.registrarCCfg.Dispatchers.Hosts { for _, host := range hosts { - if !utils.SliceHasMember([]string{utils.MetaGOB, rpcclient.HTTPjson, utils.MetaJSON, rpcclient.BiRPCJSON, rpcclient.BiRPCGOB}, host.Transport) { + if !slices.Contains([]string{utils.MetaGOB, rpcclient.HTTPjson, utils.MetaJSON, rpcclient.BiRPCJSON, rpcclient.BiRPCGOB}, host.Transport) { return fmt.Errorf("<%s> unsupported transport <%s> for host <%s>", utils.RegistrarC, host.Transport, utils.ConcatenatedKey(tnt, host.ID)) } } @@ -1086,7 +1087,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { } for tnt, hosts := range cfg.registrarCCfg.RPC.Hosts { for _, host := range hosts { - if !utils.SliceHasMember([]string{utils.MetaGOB, rpcclient.HTTPjson, utils.MetaJSON, rpcclient.BiRPCJSON, rpcclient.BiRPCGOB}, host.Transport) { + if !slices.Contains([]string{utils.MetaGOB, rpcclient.HTTPjson, utils.MetaJSON, rpcclient.BiRPCJSON, rpcclient.BiRPCGOB}, host.Transport) { return fmt.Errorf("<%s> unsupported transport <%s> for host <%s>", utils.RegistrarC, host.Transport, utils.ConcatenatedKey(tnt, host.ID)) } } diff --git a/config/fctemplate.go b/config/fctemplate.go index b07d16ac5..38fdfcc6d 100644 --- a/config/fctemplate.go +++ b/config/fctemplate.go @@ -20,6 +20,7 @@ package config import ( "fmt" + "slices" "time" "github.com/cgrates/cgrates/utils" @@ -186,10 +187,10 @@ func (fc FCTemplate) Clone() (cln *FCTemplate) { *cln.RoundingDecimals = *fc.RoundingDecimals } if fc.pathSlice != nil { - cln.pathSlice = utils.CloneStringSlice(fc.pathSlice) + cln.pathSlice = slices.Clone(fc.pathSlice) } if fc.Filters != nil { - cln.Filters = utils.CloneStringSlice(fc.Filters) + cln.Filters = slices.Clone(fc.Filters) } return } diff --git a/config/migratorcfg.go b/config/migratorcfg.go index 9ee21cd52..a5578e2cc 100644 --- a/config/migratorcfg.go +++ b/config/migratorcfg.go @@ -20,6 +20,7 @@ package config import ( "fmt" + "slices" "strings" "github.com/cgrates/cgrates/utils" @@ -154,7 +155,7 @@ func (mg *MigratorCgrCfg) AsMapInterface() (initialMP map[string]any) { utils.OutStorDBPasswordCfg: mg.OutStorDBPassword, utils.OutDataDBOptsCfg: outDataDBOpts, utils.OutStorDBOptsCfg: outStorDBOpts, - utils.UsersFiltersCfg: utils.CloneStringSlice(mg.UsersFilters), + utils.UsersFiltersCfg: slices.Clone(mg.UsersFilters), } } @@ -178,7 +179,7 @@ func (mg MigratorCgrCfg) Clone() (cln *MigratorCgrCfg) { OutStorDBOpts: mg.OutStorDBOpts.Clone(), } if mg.UsersFilters != nil { - cln.UsersFilters = utils.CloneStringSlice(mg.UsersFilters) + cln.UsersFilters = slices.Clone(mg.UsersFilters) } return } diff --git a/config/migratorcfg_test.go b/config/migratorcfg_test.go index 9a675e2b6..c9536ba35 100644 --- a/config/migratorcfg_test.go +++ b/config/migratorcfg_test.go @@ -238,7 +238,7 @@ func TestMigratorCgrCfgAsMapInterface2(t *testing.T) { utils.OutStorDBNameCfg: "cgrates", utils.OutStorDBUserCfg: "cgrates", utils.OutStorDBPasswordCfg: "", - utils.UsersFiltersCfg: []string{}, + utils.UsersFiltersCfg: []string(nil), utils.OutStorDBOptsCfg: map[string]any{ utils.MongoQueryTimeoutCfg: "0s", utils.MYSQLDSNParams: map[string]string(nil), diff --git a/config/statscfg.go b/config/statscfg.go index e6965d2e2..8b5e64446 100644 --- a/config/statscfg.go +++ b/config/statscfg.go @@ -19,6 +19,7 @@ along with this program. If not, see package config import ( + "slices" "time" "github.com/cgrates/cgrates/utils" @@ -169,7 +170,7 @@ func (st *StatSCfg) AsMapInterface() (initialMP map[string]any) { func (stOpts *StatsOpts) Clone() *StatsOpts { return &StatsOpts{ - ProfileIDs: utils.CloneStringSlice(stOpts.ProfileIDs), + ProfileIDs: slices.Clone(stOpts.ProfileIDs), ProfileIgnoreFilters: stOpts.ProfileIgnoreFilters, } } diff --git a/config/thresholdscfg.go b/config/thresholdscfg.go index 87141186c..fac78c71d 100644 --- a/config/thresholdscfg.go +++ b/config/thresholdscfg.go @@ -19,6 +19,7 @@ along with this program. If not, see package config import ( + "slices" "time" "github.com/cgrates/cgrates/utils" @@ -141,7 +142,7 @@ func (t *ThresholdSCfg) AsMapInterface() (initialMP map[string]any) { func (thdOpts *ThresholdsOpts) Clone() *ThresholdsOpts { return &ThresholdsOpts{ - ProfileIDs: utils.CloneStringSlice(thdOpts.ProfileIDs), + ProfileIDs: slices.Clone(thdOpts.ProfileIDs), ProfileIgnoreFilters: thdOpts.ProfileIgnoreFilters, } } diff --git a/console/command_executer.go b/console/command_executer.go index b518fdf57..ecf00639b 100644 --- a/console/command_executer.go +++ b/console/command_executer.go @@ -24,6 +24,7 @@ import ( "fmt" "reflect" "regexp" + "slices" "sort" "strings" "time" @@ -128,7 +129,7 @@ func FromJSON(jsn []byte, interestingFields []string) (line string) { } for _, group := range jsonR.FindAllSubmatch(jsn, -1) { if len(group) == 3 { - if utils.IsSliceMember(interestingFields, string(group[1])) { + if slices.Contains(interestingFields, string(group[1])) { line += fmt.Sprintf("%s=%s ", group[1], group[2]) } } diff --git a/dispatchers/dispatchers.go b/dispatchers/dispatchers.go index d41390c83..619bf8f93 100644 --- a/dispatchers/dispatchers.go +++ b/dispatchers/dispatchers.go @@ -21,6 +21,7 @@ package dispatchers import ( "fmt" "reflect" + "slices" "strings" "time" @@ -168,7 +169,7 @@ func (dS *DispatcherService) dispatcherProfilesForEvent(tnt string, ev *utils.CG } if ((len(prfl.Subsystems) != 1 || prfl.Subsystems[0] != utils.MetaAny) && - !utils.IsSliceMember(prfl.Subsystems, subsys)) || + !slices.Contains(prfl.Subsystems, subsys)) || (prfl.ActivationInterval != nil && ev.Time != nil && !prfl.ActivationInterval.IsActiveAtTime(*ev.Time)) { // not active continue diff --git a/engine/account.go b/engine/account.go index 3057a952c..dfdfa19de 100644 --- a/engine/account.go +++ b/engine/account.go @@ -22,6 +22,7 @@ import ( "encoding/json" "errors" "fmt" + "slices" "strconv" "strings" "time" @@ -1111,7 +1112,7 @@ func balancesValues(bals Balances) (init map[string]float64) { // NewAccountSummaryFromJSON creates a new AcccountSummary from a json string func NewAccountSummaryFromJSON(jsn string) (acntSummary *AccountSummary, err error) { - if !utils.SliceHasMember([]string{"", "null"}, jsn) { // Unmarshal only when content + if !slices.Contains([]string{"", "null"}, jsn) { // Unmarshal only when content err = json.Unmarshal([]byte(jsn), &acntSummary) } return diff --git a/engine/action.go b/engine/action.go index 02046ad05..b94ad7663 100644 --- a/engine/action.go +++ b/engine/action.go @@ -27,6 +27,7 @@ import ( "net/http" "net/smtp" "reflect" + "slices" "sort" "strconv" "strings" @@ -60,7 +61,7 @@ func (a *Action) Clone() (cln *Action) { } var fltrs []string if a.Filters != nil { - fltrs = utils.CloneStringSlice(a.Filters) + fltrs = slices.Clone(a.Filters) } return &Action{ Id: a.Id, @@ -171,7 +172,7 @@ func cdrLogAction(acc *Account, a *Action, acs Actions, _ *FilterS, extraData an // set stored cdr values var cdrs []*CDR for _, action := range acs { - if !utils.SliceHasMember([]string{utils.MetaDebit, utils.MetaDebitReset, utils.MetaSetBalance, utils.MetaTopUp, utils.MetaTopUpReset}, action.ActionType) || + if !slices.Contains([]string{utils.MetaDebit, utils.MetaDebitReset, utils.MetaSetBalance, utils.MetaTopUp, utils.MetaTopUpReset}, action.ActionType) || action.Balance == nil { continue // Only log specific actions } diff --git a/engine/argees.go b/engine/argees.go index 7b2be7172..444b8c70e 100644 --- a/engine/argees.go +++ b/engine/argees.go @@ -20,6 +20,7 @@ package engine import ( "encoding/json" + "slices" "github.com/cgrates/cgrates/utils" ) @@ -35,7 +36,7 @@ type CGREventWithEeIDs struct { func (attr *CGREventWithEeIDs) Clone() *CGREventWithEeIDs { return &CGREventWithEeIDs{ - EeIDs: utils.CloneStringSlice(attr.EeIDs), + EeIDs: slices.Clone(attr.EeIDs), CGREvent: attr.CGREvent.Clone(), } } diff --git a/engine/attributes.go b/engine/attributes.go index 5c42ad40b..b69701839 100644 --- a/engine/attributes.go +++ b/engine/attributes.go @@ -21,6 +21,7 @@ package engine import ( "fmt" "math" + "slices" "sort" "strconv" "strings" @@ -109,7 +110,7 @@ func (alS *AttributeService) attributeProfileForEvent(tnt string, ctx *string, a return nil, err } if !(len(aPrfl.Contexts) == 1 && aPrfl.Contexts[0] == utils.MetaAny) && - !utils.IsSliceMember(aPrfl.Contexts, contextVal) { + !slices.Contains(aPrfl.Contexts, contextVal) { continue } if aPrfl.ActivationInterval != nil && actTime != nil && @@ -210,7 +211,7 @@ func (alS *AttributeService) processEvent(tnt string, args *utils.CGREvent, evNm } substitute := utils.IfaceAsString(out) //add only once the Path in AlteredFields - if !utils.IsSliceMember(rply.AlteredFields, attribute.Path) { + if !slices.Contains(rply.AlteredFields, attribute.Path) { rply.AlteredFields = append(rply.AlteredFields, attribute.Path) } if attribute.Path == utils.MetaTenant { diff --git a/engine/cdrs.go b/engine/cdrs.go index d84c876c6..2a927cffc 100644 --- a/engine/cdrs.go +++ b/engine/cdrs.go @@ -22,6 +22,7 @@ import ( "fmt" "net/http" "reflect" + "slices" "strings" "time" @@ -170,7 +171,7 @@ func (cdrS *CDRServer) rateCDR(cdr *CDRWithAPIOpts) ([]*CDR, error) { cdr.ExtraInfo = "" // Clean previous ExtraInfo, useful when re-rating var cdrsRated []*CDR _, hasLastUsed := cdr.ExtraFields[utils.LastUsed] - if utils.SliceHasMember([]string{utils.MetaPrepaid, utils.Prepaid}, cdr.RequestType) && + if slices.Contains([]string{utils.MetaPrepaid, utils.Prepaid}, cdr.RequestType) && (cdr.Usage != 0 || hasLastUsed) && cdr.CostDetails == nil { // ToDo: Get rid of Prepaid as soon as we don't want to support it backwards // Should be previously calculated and stored in DB diff --git a/engine/datamanager.go b/engine/datamanager.go index 390391d17..b2c9db9ee 100644 --- a/engine/datamanager.go +++ b/engine/datamanager.go @@ -20,6 +20,7 @@ package engine import ( "fmt" + "slices" "strings" "github.com/cgrates/baningo" @@ -1224,7 +1225,7 @@ func (dm *DataManager) SetStatQueueProfile(sqp *StatQueueProfile, withIndex bool for _, metric := range sqp.Metrics { // add missing metrics and recreate the old metrics that changed cMetricIDs.Add(metric.MetricID) if oSqMetric, has := oSq.SQMetrics[metric.MetricID]; !has || - !utils.SliceStringEqual(oSqMetric.GetFilterIDs(), metric.FilterIDs) { // recreate it if the filter changed + !slices.Equal(oSqMetric.GetFilterIDs(), metric.FilterIDs) { // recreate it if the filter changed if oSq.SQMetrics[metric.MetricID], err = NewStatMetric(metric.MetricID, sqp.MinItems, metric.FilterIDs); err != nil { return @@ -2112,7 +2113,7 @@ func (dm *DataManager) SetAccountActionPlans(acntID string, aPlIDs []string, ove return } for _, oldAPid := range oldaPlIDs { - if !utils.IsSliceMember(aPlIDs, oldAPid) { + if !slices.Contains(aPlIDs, oldAPid) { aPlIDs = append(aPlIDs, oldAPid) } } @@ -2155,7 +2156,7 @@ func (dm *DataManager) RemAccountActionPlans(acntID string, apIDs []string) (err } remainAAP := make([]string, 0, len(oldAAP)) for _, ap := range oldAAP { - if !utils.IsSliceMember(apIDs, ap) { + if !slices.Contains(apIDs, ap) { remainAAP = append(remainAAP, ap) } } diff --git a/engine/datamanager_test.go b/engine/datamanager_test.go index ff4b19679..bce8dc628 100644 --- a/engine/datamanager_test.go +++ b/engine/datamanager_test.go @@ -21,6 +21,7 @@ import ( "errors" "fmt" "reflect" + "slices" "testing" "time" @@ -3249,7 +3250,7 @@ func TestComputeIndexes(t *testing.T) { if e != nil { return nil, e } - return utils.SliceStringPointer(utils.CloneStringSlice(th.FilterIDs)), nil + return utils.SliceStringPointer(slices.Clone(th.FilterIDs)), nil }, nil); err != nil { t.Error(err) } diff --git a/engine/destinations.go b/engine/destinations.go index ff6d7f0ab..616d84e0a 100644 --- a/engine/destinations.go +++ b/engine/destinations.go @@ -19,6 +19,7 @@ along with this program. If not, see package engine import ( + "slices" "strings" "github.com/cgrates/cgrates/utils" @@ -72,7 +73,7 @@ func (d *Destination) AddPrefix(pfx string) { // Reverse search in cache to see if prefix belongs to destination id func CachedDestHasPrefix(destId, prefix string) bool { if cached, err := dm.GetReverseDestination(prefix, true, true, utils.NonTransactional); err == nil { - return utils.IsSliceMember(cached, destId) + return slices.Contains(cached, destId) } return false } diff --git a/engine/eventcost.go b/engine/eventcost.go index 8be1ff09e..b6a6232c3 100644 --- a/engine/eventcost.go +++ b/engine/eventcost.go @@ -21,6 +21,7 @@ package engine import ( "errors" "fmt" + "slices" "time" "github.com/cgrates/cgrates/utils" @@ -470,7 +471,7 @@ func (ec *EventCost) newIntervalFromCharge(cInc *ChargingIncrement) (incr *Incre } } } - if utils.SliceHasMember([]string{utils.MetaData, utils.MetaVoice}, balanceType) && cBC.ExtraChargeID == "" { + if slices.Contains([]string{utils.MetaData, utils.MetaVoice}, balanceType) && cBC.ExtraChargeID == "" { cBC.ExtraChargeID = utils.MetaNone // mark the balance to be exported as Unit type } if cBC.ExtraChargeID != "" { // have both monetary and data diff --git a/engine/exportrequest.go b/engine/exportrequest.go index 8291a7d85..d824e7d6c 100644 --- a/engine/exportrequest.go +++ b/engine/exportrequest.go @@ -20,6 +20,7 @@ package engine import ( "fmt" + "slices" "strings" "github.com/cgrates/cgrates/config" @@ -125,7 +126,7 @@ func (eeR *ExportRequest) SetFields(tplFlds []*config.FCTemplate) (err error) { return } else if fullPath == nil { // no dynamic path fullPath = &utils.FullPath{ - PathSlice: utils.CloneStringSlice(tplFld.GetPathSlice()), // need to clone so me do not modify the template + PathSlice: slices.Clone(tplFld.GetPathSlice()), // need to clone so me do not modify the template Path: tplFld.Path, } } diff --git a/engine/libindex_health.go b/engine/libindex_health.go index c59c46910..16bfd290b 100644 --- a/engine/libindex_health.go +++ b/engine/libindex_health.go @@ -20,6 +20,7 @@ package engine import ( "fmt" + "slices" "strings" "time" @@ -155,7 +156,7 @@ func GetAccountActionPlansIndexHealth(dm *DataManager, objLimit, indexLimit int, missingIndex[acntID] = append(missingIndex[acntID], apID) continue } - if !utils.IsSliceMember(ids, apID) { // the index doesn't exits for this actionPlan + if !slices.Contains(ids, apID) { // the index doesn't exits for this actionPlan missingIndex[acntID] = append(missingIndex[acntID], apID) } } @@ -241,7 +242,7 @@ func GetReverseDestinationsIndexHealth(dm *DataManager, objLimit, indexLimit int brokenRef[dstID] = nil continue } - if !utils.IsSliceMember(dst.Prefixes, prefix) { // the action plan exists but doesn't point towards the account we have index + if !slices.Contains(dst.Prefixes, prefix) { // the action plan exists but doesn't point towards the account we have index brokenRef[dstID] = append(brokenRef[dstID], prefix) } } @@ -271,7 +272,7 @@ func GetReverseDestinationsIndexHealth(dm *DataManager, objLimit, indexLimit int missingIndex[prefix] = append(missingIndex[prefix], dstID) continue } - if !utils.IsSliceMember(ids, dstID) { // the index doesn't exits for this actionPlan + if !slices.Contains(ids, dstID) { // the index doesn't exits for this actionPlan missingIndex[prefix] = append(missingIndex[prefix], dstID) } } @@ -589,7 +590,7 @@ func GetFltrIdxHealth(dm *DataManager, fltrCache, fltrIdxCache, objCache *ltcach continue } if ctx != nil && - (obj.contexts == nil || !utils.IsSliceMember(*obj.contexts, *ctx)) { // check the contexts if present + (obj.contexts == nil || !slices.Contains(*obj.contexts, *ctx)) { // check the contexts if present key := utils.ConcatenatedKey(tntCtx, idxKey) rply.MissingIndexes[key] = append(rply.MissingIndexes[key], itmID) continue @@ -760,10 +761,10 @@ func getRevFltrIdxHealthFromReverse(dm *DataManager, fltrCache, revFltrIdxCache } return } - if !utils.IsSliceMember(obj.filterIDs, fltrID) { // check the filters + if !slices.Contains(obj.filterIDs, fltrID) { // check the filters key := utils.ConcatenatedKey(tnt, itemIDCtx) rply[indxType].BrokenReverseIndexes[key] = append(rply[indxType].BrokenReverseIndexes[key], fltrID) - } else if obj.contexts != nil && !utils.IsSliceMember(*obj.contexts, ctx) { // and the contexts + } else if obj.contexts != nil && !slices.Contains(*obj.contexts, ctx) { // and the contexts key := utils.ConcatenatedKey(tnt, itemIDCtx) rply[indxType].BrokenReverseIndexes[key] = append(rply[indxType].BrokenReverseIndexes[key], fltrID) } diff --git a/engine/libtest.go b/engine/libtest.go index f99910e8a..0c24f0a9c 100644 --- a/engine/libtest.go +++ b/engine/libtest.go @@ -26,6 +26,7 @@ import ( "os" "os/exec" "path" + "slices" "strings" "time" @@ -320,7 +321,7 @@ func InitStorDb(cfg *config.CGRConfig) error { dbPath)); err != nil { return err } - if utils.IsSliceMember([]string{utils.MetaMongo, utils.MetaMySQL, utils.MetaPostgres}, + if slices.Contains([]string{utils.MetaMongo, utils.MetaMySQL, utils.MetaPostgres}, cfg.StorDbCfg().Type) { if err := SetDBVersions(storDb); err != nil { return err diff --git a/engine/storage_internal_stordb.go b/engine/storage_internal_stordb.go index b2aac89e0..ef8e33efe 100644 --- a/engine/storage_internal_stordb.go +++ b/engine/storage_internal_stordb.go @@ -20,6 +20,7 @@ package engine import ( "fmt" + "slices" "sort" "strings" "time" @@ -1190,32 +1191,32 @@ func (iDB *InternalDB) GetCDRs(filter *utils.CDRsFilter, remove bool) (cdrs []*C cdr := x.(*CDR) // default indexed filters - if (len(filter.CGRIDs) > 0 && !utils.SliceHasMember(filter.CGRIDs, cdr.CGRID)) || - (len(filter.RunIDs) > 0 && !utils.SliceHasMember(filter.RunIDs, cdr.RunID)) || - (len(filter.OriginIDs) > 0 && !utils.SliceHasMember(filter.OriginIDs, cdr.OriginID)) || - (len(filter.OriginHosts) > 0 && !utils.SliceHasMember(filter.OriginHosts, cdr.OriginHost)) || - (len(filter.Sources) > 0 && !utils.SliceHasMember(filter.Sources, cdr.Source)) || - (len(filter.ToRs) > 0 && !utils.SliceHasMember(filter.ToRs, cdr.ToR)) || - (len(filter.RequestTypes) > 0 && !utils.SliceHasMember(filter.RequestTypes, cdr.RequestType)) || - (len(filter.Tenants) > 0 && !utils.SliceHasMember(filter.Tenants, cdr.Tenant)) || - (len(filter.Categories) > 0 && !utils.SliceHasMember(filter.Categories, cdr.Category)) || - (len(filter.Accounts) > 0 && !utils.SliceHasMember(filter.Accounts, cdr.Account)) || - (len(filter.Subjects) > 0 && !utils.SliceHasMember(filter.Subjects, cdr.Subject)) || + if (len(filter.CGRIDs) > 0 && !slices.Contains(filter.CGRIDs, cdr.CGRID)) || + (len(filter.RunIDs) > 0 && !slices.Contains(filter.RunIDs, cdr.RunID)) || + (len(filter.OriginIDs) > 0 && !slices.Contains(filter.OriginIDs, cdr.OriginID)) || + (len(filter.OriginHosts) > 0 && !slices.Contains(filter.OriginHosts, cdr.OriginHost)) || + (len(filter.Sources) > 0 && !slices.Contains(filter.Sources, cdr.Source)) || + (len(filter.ToRs) > 0 && !slices.Contains(filter.ToRs, cdr.ToR)) || + (len(filter.RequestTypes) > 0 && !slices.Contains(filter.RequestTypes, cdr.RequestType)) || + (len(filter.Tenants) > 0 && !slices.Contains(filter.Tenants, cdr.Tenant)) || + (len(filter.Categories) > 0 && !slices.Contains(filter.Categories, cdr.Category)) || + (len(filter.Accounts) > 0 && !slices.Contains(filter.Accounts, cdr.Account)) || + (len(filter.Subjects) > 0 && !slices.Contains(filter.Subjects, cdr.Subject)) || - (len(filter.NotCGRIDs) > 0 && utils.SliceHasMember(filter.NotCGRIDs, cdr.CGRID)) || - (len(filter.NotRunIDs) > 0 && utils.SliceHasMember(filter.NotRunIDs, cdr.RunID)) || - (len(filter.NotOriginIDs) > 0 && utils.SliceHasMember(filter.NotOriginIDs, cdr.OriginID)) || - (len(filter.NotOriginHosts) > 0 && utils.SliceHasMember(filter.NotOriginHosts, cdr.OriginHost)) || - (len(filter.NotSources) > 0 && utils.SliceHasMember(filter.NotSources, cdr.Source)) || - (len(filter.NotToRs) > 0 && utils.SliceHasMember(filter.NotToRs, cdr.ToR)) || - (len(filter.NotRequestTypes) > 0 && utils.SliceHasMember(filter.NotRequestTypes, cdr.RequestType)) || - (len(filter.NotTenants) > 0 && utils.SliceHasMember(filter.NotTenants, cdr.Tenant)) || - (len(filter.NotCategories) > 0 && utils.SliceHasMember(filter.NotCategories, cdr.Category)) || - (len(filter.NotAccounts) > 0 && utils.SliceHasMember(filter.NotAccounts, cdr.Account)) || - (len(filter.NotSubjects) > 0 && utils.SliceHasMember(filter.NotSubjects, cdr.Subject)) || + (len(filter.NotCGRIDs) > 0 && slices.Contains(filter.NotCGRIDs, cdr.CGRID)) || + (len(filter.NotRunIDs) > 0 && slices.Contains(filter.NotRunIDs, cdr.RunID)) || + (len(filter.NotOriginIDs) > 0 && slices.Contains(filter.NotOriginIDs, cdr.OriginID)) || + (len(filter.NotOriginHosts) > 0 && slices.Contains(filter.NotOriginHosts, cdr.OriginHost)) || + (len(filter.NotSources) > 0 && slices.Contains(filter.NotSources, cdr.Source)) || + (len(filter.NotToRs) > 0 && slices.Contains(filter.NotToRs, cdr.ToR)) || + (len(filter.NotRequestTypes) > 0 && slices.Contains(filter.NotRequestTypes, cdr.RequestType)) || + (len(filter.NotTenants) > 0 && slices.Contains(filter.NotTenants, cdr.Tenant)) || + (len(filter.NotCategories) > 0 && slices.Contains(filter.NotCategories, cdr.Category)) || + (len(filter.NotAccounts) > 0 && slices.Contains(filter.NotAccounts, cdr.Account)) || + (len(filter.NotSubjects) > 0 && slices.Contains(filter.NotSubjects, cdr.Subject)) || - (len(filter.Costs) > 0 && !utils.Float64SliceHasMember(filter.Costs, cdr.Cost)) || - (len(filter.NotCosts) > 0 && utils.Float64SliceHasMember(filter.NotCosts, cdr.Cost)) || + (len(filter.Costs) > 0 && !slices.Contains(filter.Costs, cdr.Cost)) || + (len(filter.NotCosts) > 0 && slices.Contains(filter.NotCosts, cdr.Cost)) || (len(filter.DestinationPrefixes) > 0 && !utils.HasPrefixSlice(filter.DestinationPrefixes, cdr.Destination)) || (len(filter.NotDestinationPrefixes) > 0 && utils.HasPrefixSlice(filter.NotDestinationPrefixes, cdr.Destination)) || diff --git a/engine/z_actions_it_test.go b/engine/z_actions_it_test.go index 26cdae77b..75275c8d4 100644 --- a/engine/z_actions_it_test.go +++ b/engine/z_actions_it_test.go @@ -26,6 +26,7 @@ import ( "net/http/httptest" "path" "reflect" + "slices" "strconv" "strings" "testing" @@ -736,7 +737,7 @@ func testActionsitSetSDestinations(t *testing.T) { utils.StringPointer("*ddc_test"), &dest); err != nil { t.Error(err.Error()) } else { - if len(dest.Prefixes) != 2 || !utils.IsSliceMember(dest.Prefixes, "111") || !utils.IsSliceMember(dest.Prefixes, "222") { + if len(dest.Prefixes) != 2 || !slices.Contains(dest.Prefixes, "111") || !slices.Contains(dest.Prefixes, "222") { t.Errorf("Unexpected destination : %+v", dest) } } @@ -816,7 +817,7 @@ func testActionsitSetSDestinations(t *testing.T) { utils.StringPointer("*ddc_test"), &dest); err != nil { t.Error(err.Error()) } else { - if len(dest.Prefixes) != 2 || !utils.IsSliceMember(dest.Prefixes, "333") || !utils.IsSliceMember(dest.Prefixes, "777") { + if len(dest.Prefixes) != 2 || !slices.Contains(dest.Prefixes, "333") || !slices.Contains(dest.Prefixes, "777") { t.Errorf("Unexpected destination : %+v", dest) } } diff --git a/engine/z_onstor_it_test.go b/engine/z_onstor_it_test.go index c0e3eef79..0f5effbda 100644 --- a/engine/z_onstor_it_test.go +++ b/engine/z_onstor_it_test.go @@ -1122,7 +1122,10 @@ func testOnStorITCRUDAccountActionPlans(t *testing.T) { } if rcv, err := onStor.GetAccountActionPlans(acntID, false, true, utils.NonTransactional); err != nil { t.Error(err) - } else if !reflect.DeepEqual(expect, rcv) { + } else if sort.Slice(rcv, func(i, j int) bool { + + return rcv[i] < rcv[j] + }); !reflect.DeepEqual(expect, rcv) { t.Errorf("Expecting: %v, received: %v", expect, rcv) } // FixMe @@ -1135,7 +1138,9 @@ func testOnStorITCRUDAccountActionPlans(t *testing.T) { // if rcv, err := onStor.GetAccountActionPlans(acntID, true, true, utils.NonTransactional); err != nil { t.Error(err) - } else if !reflect.DeepEqual(expect, rcv) { + } else if sort.Slice(rcv, func(i, j int) bool { + return rcv[i] < rcv[j] + }); !reflect.DeepEqual(expect, rcv) { t.Errorf("Expecting: %v, received: %v", expect, rcv) } // if err = onStor.DataDB().SelectDatabase(onStorCfg); err != nil { diff --git a/ers/ers.go b/ers/ers.go index 2e7b68d6a..3d9ff7ddc 100644 --- a/ers/ers.go +++ b/ers/ers.go @@ -24,6 +24,7 @@ import ( "fmt" "os" "path" + "slices" "sort" "strings" "sync" @@ -360,7 +361,7 @@ func (erS *ERService) processPartialEvent(ev *utils.CGREvent, rdrCfg *config.Eve erS.cfg.GeneralCfg().RSRSep); err != nil { return } - if partial := cgrEv.APIOpts[utils.PartialOpt]; !utils.IsSliceMember([]string{utils.FalseStr, utils.EmptyString}, + if partial := cgrEv.APIOpts[utils.PartialOpt]; !slices.Contains([]string{utils.FalseStr, utils.EmptyString}, utils.IfaceAsString(partial)) { // if is still partial set it back in cache erS.partialCache.Set(cgrID, cgrEvs, nil) return diff --git a/migrator/user.go b/migrator/user.go index 0fca69bee..def5af684 100644 --- a/migrator/user.go +++ b/migrator/user.go @@ -20,6 +20,7 @@ package migrator import ( "fmt" + "slices" "strings" "github.com/cgrates/cgrates/config" @@ -72,7 +73,7 @@ func userProfile2attributeProfile(user *v1UserProfile) (attr *engine.AttributePr if fieldName == "ReqType" { // old style fieldName = utils.RequestType } - if utils.IsSliceMember(usrFltr, fieldName) { + if slices.Contains(usrFltr, fieldName) { attr.FilterIDs = append(attr.FilterIDs, fmt.Sprintf("*string:~*req.%s:%s", fieldName, substitute)) continue } diff --git a/sessions/libsessions.go b/sessions/libsessions.go index d4e56e40e..9e34b18e4 100644 --- a/sessions/libsessions.go +++ b/sessions/libsessions.go @@ -20,6 +20,7 @@ package sessions import ( "errors" + "slices" "strings" "time" @@ -182,10 +183,10 @@ func (pi *ProcessedStirIdentity) VerifyPayload(originatorTn, originatorURI, dest return errors.New("wrong originatorTn") } if destinationURI != utils.EmptyString { - if !utils.SliceHasMember(pi.Payload.Dest.URI, destinationURI) { + if !slices.Contains(pi.Payload.Dest.URI, destinationURI) { return errors.New("wrong destinationURI") } - } else if !utils.SliceHasMember(pi.Payload.Dest.Tn, destinationTn) { + } else if !slices.Contains(pi.Payload.Dest.Tn, destinationTn) { return errors.New("wrong destinationTn") } return diff --git a/sessions/sessions.go b/sessions/sessions.go index 096a317d6..3c685468e 100644 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -23,6 +23,7 @@ import ( "fmt" "math/rand" "runtime" + "slices" "strings" "sync" "time" @@ -1681,7 +1682,7 @@ func (sS *SessionS) chargeEvent(cgrEv *utils.CGREvent, forceDuration bool) (maxU } ev := engine.MapEvent(cgrEv.Event) usage := maxUsage - if utils.SliceHasMember(utils.PostPaidRatedSlice, ev.GetStringIgnoreErrors(utils.RequestType)) { + if slices.Contains(utils.PostPaidRatedSlice, ev.GetStringIgnoreErrors(utils.RequestType)) { usage = ev.GetDurationIgnoreErrors(utils.Usage) } //in case of postpaid and rated maxUsage = usage from event diff --git a/utils/apitpdata.go b/utils/apitpdata.go index 8f9de78c2..37a25d20b 100644 --- a/utils/apitpdata.go +++ b/utils/apitpdata.go @@ -20,6 +20,7 @@ package utils import ( "fmt" + "slices" "sort" "strings" "time" @@ -66,7 +67,7 @@ func (pgnt *Paginator) PaginateStringSlice(in []string) (out []string) { if limit == 0 || limit > len(in) { limit = len(in) } - return CloneStringSlice(in[offset:limit]) + return slices.Clone(in[offset:limit]) } // Clone creates a clone of the object diff --git a/utils/coreutils.go b/utils/coreutils.go index 970619583..510ff8648 100644 --- a/utils/coreutils.go +++ b/utils/coreutils.go @@ -37,6 +37,7 @@ import ( "path/filepath" "reflect" "regexp" + "slices" "strconv" "strings" "sync" @@ -715,7 +716,7 @@ func (h HierarchyPath) Clone() (cln HierarchyPath) { if h == nil { return } - return CloneStringSlice(h) + return slices.Clone(h) } // Mask a number of characters in the suffix of the destination diff --git a/utils/map.go b/utils/map.go index 708c05e45..d476a987f 100644 --- a/utils/map.go +++ b/utils/map.go @@ -19,6 +19,7 @@ along with this program. If not, see package utils import ( + "slices" "strconv" "strings" ) @@ -216,7 +217,7 @@ func (fWp FlagParams) Clone() (cln FlagParams) { for flg, params := range fWp { var cprm []string if params != nil { - cprm = CloneStringSlice(params) + cprm = slices.Clone(params) } cln[flg] = cprm } diff --git a/utils/orderednavigablemap.go b/utils/orderednavigablemap.go index 1c7a022b8..f1b6eb3df 100644 --- a/utils/orderednavigablemap.go +++ b/utils/orderednavigablemap.go @@ -19,6 +19,7 @@ along with this program. If not, see package utils import ( + "slices" "strconv" "strings" ) @@ -85,7 +86,7 @@ func (onm *OrderedNavigableMap) Remove(fullPath *FullPath) (err error) { if fullPath.Path == EmptyString { return ErrWrongPath } - // fullPath.PathSlice = CloneStringSlice(fullPath.PathSlice) // clone the items to not modify the templates + // fullPath.PathSlice = slices.Clone(fullPath.PathSlice) // clone the items to not modify the templates if err = onm.nm.Remove(fullPath.PathSlice); err != nil { // remove them from DataNode return } @@ -130,7 +131,7 @@ func (onm *OrderedNavigableMap) SetAsSlice(fullPath *FullPath, vals []*DataNode) pathItmsSet := make([][]string, len(vals)) // prepare the path for order update for i := range vals { - pathItmsSet[i] = append(CloneStringSlice(fullPath.PathSlice), strconv.Itoa(i)) // clone the slice as we will append an index + pathItmsSet[i] = append(slices.Clone(fullPath.PathSlice), strconv.Itoa(i)) // clone the slice as we will append an index } path := stripIdxFromLastPathElm(fullPath.Path) if !addedNew { // cleanup old references since the value is being overwritten @@ -204,7 +205,7 @@ func (onm *OrderedNavigableMap) Append(fullPath *FullPath, val *DataLeaf) (err e // add the path to order onm.orderRef[fullPath.Path] = append(onm.orderRef[fullPath.Path], onm.orderIdx.PushBack( - append(CloneStringSlice(fullPath.PathSlice), // clone the slice as we will append an index + append(slices.Clone(fullPath.PathSlice), // clone the slice as we will append an index strconv.Itoa(idx)))) return } @@ -222,7 +223,7 @@ func (onm *OrderedNavigableMap) Compose(fullPath *FullPath, val *DataLeaf) (err if _, hasRef := onm.orderRef[fullPath.Path]; !hasRef { // the element is new so append to order onm.orderRef[fullPath.Path] = append(onm.orderRef[fullPath.Path], onm.orderIdx.PushBack( - append(CloneStringSlice(fullPath.PathSlice), // clone the slice as we will append an index + append(slices.Clone(fullPath.PathSlice), // clone the slice as we will append an index "0"))) } else { // move element in the back of order list onm.orderIdx.MoveToBack(onm.orderRef[fullPath.Path][len(onm.orderRef[fullPath.Path])-1]) diff --git a/utils/slice.go b/utils/slice.go index 4a82d4f61..c250eb8ac 100644 --- a/utils/slice.go +++ b/utils/slice.go @@ -19,23 +19,9 @@ along with this program. If not, see package utils import ( - "sort" "strings" ) -// Binary string search in slice -func IsSliceMember(ss []string, s string) bool { - sort.Strings(ss) - return SliceHasMember(ss, s) -} - -// SliceHasMember searches within a *sorted* slice -// useful to search in shared vars (no slice sort) -func SliceHasMember(ss []string, s string) bool { - i := sort.SearchStrings(ss, s) - return i < len(ss) && ss[i] == s -} - // PrefixSliceItems iterates through slice and add a prefix before every element func PrefixSliceItems(prfx string, slc []string) (out []string) { out = make([]string, 0, len(slc)) @@ -56,13 +42,6 @@ func SliceStringToIface(slc []string) (ifc []any) { return } -// Float64SliceHasMember searches within a *sorted* slice -// useful to search in shared vars (no slice sort) -func Float64SliceHasMember(ss []float64, s float64) bool { - i := sort.SearchFloat64s(ss, s) - return i < len(ss) && ss[i] == s -} - // HasPrefixSlice iterates over slice members and returns true if one the element has that prefix func HasPrefixSlice(prfxs []string, el string) bool { for _, prfx := range prfxs { @@ -72,21 +51,3 @@ func HasPrefixSlice(prfxs []string, el string) bool { } return false } - -func CloneStringSlice(in []string) (cl []string) { - cl = make([]string, len(in)) - copy(cl, in) - return -} - -func SliceStringEqual(v1, v2 []string) bool { - if len(v1) != len(v2) { - return false - } - for i := range v1 { - if v1[i] != v2[i] { - return false - } - } - return true -} diff --git a/utils/slice_test.go b/utils/slice_test.go index df29222c3..5a322baf4 100644 --- a/utils/slice_test.go +++ b/utils/slice_test.go @@ -23,33 +23,6 @@ import ( "testing" ) -func TestIsSliceMember(t *testing.T) { - if !IsSliceMember([]string{"1", "2", "3", "4", "5"}, "5") { - t.Error("Expecting: true, received: false") - } - if IsSliceMember([]string{"1", "2", "3", "4", "5"}, "6") { - t.Error("Expecting: true, received: false") - } -} - -func TestSliceHasMember(t *testing.T) { - if !SliceHasMember([]string{"1", "2", "3", "4", "5"}, "5") { - t.Error("Expecting: true, received: false") - } - if SliceHasMember([]string{"1", "2", "3", "4", "5"}, "6") { - t.Error("Expecting: true, received: false") - } -} - -func TestFlaot64SliceHasMember(t *testing.T) { - if !Float64SliceHasMember([]float64{1, 2, 3, 4, 5}, 5) { - t.Error("Expecting: true, received: false") - } - if Float64SliceHasMember([]float64{1, 2, 3, 4, 5}, 6) { - t.Error("Expecting: true, received: false") - } -} - func TestHasPrefixSlice(t *testing.T) { if !HasPrefixSlice([]string{"1", "2", "3", "4", "5"}, "123") { t.Error("Expecting: true, received: false") @@ -74,30 +47,3 @@ func TestSliceStringToIface(t *testing.T) { t.Errorf("Expected: %s ,received: %s", ToJSON(exp), ToJSON(rply)) } } - -func TestSliceStringEqualDiffLength(t *testing.T) { - v1 := []string{"foo", "bar"} - v2 := []string{"baz"} - if rcv := SliceStringEqual(v1, v2); rcv != false { - t.Errorf("expected false ,received : %v", rcv) - } - -} -func TestSliceStringEqualElementEqualFalse(t *testing.T) { - - v1 := []string{"foo", "bar"} - v2 := []string{"foo", "baz"} - if rcv := SliceStringEqual(v1, v2); rcv != false { - t.Errorf("expected false ,received : %v", rcv) - } - -} -func TestSliceStringEqualTrue(t *testing.T) { - - v1 := []string{"foo", "bar"} - v2 := []string{"foo", "bar"} - if rcv := SliceStringEqual(v1, v2); rcv != true { - t.Errorf("expected false ,received : %v", rcv) - } - -}