diff --git a/accounts/accounts.go b/accounts/accounts.go index 487a015f6..ee82a6f58 100644 --- a/accounts/accounts.go +++ b/accounts/accounts.go @@ -138,7 +138,7 @@ func (aS *AccountS) matchingAccountsForEvent(ctx *context.Context, tnt string, c func (aS *AccountS) accountsDebit(ctx *context.Context, acnts []*utils.AccountWithWeight, cgrEv *utils.CGREvent, concretes, store bool) (ec *utils.EventCharges, err error) { var usage *decimal.Big // total event usage - if usage, err = engine.GetDecimalBigOpts(ctx, cgrEv.Tenant, cgrEv, aS.fltrS, aS.cfg.AccountSCfg().Opts.Usage, + if usage, err = engine.GetDecimalBigOpts(ctx, cgrEv.Tenant, cgrEv.AsDataProvider(), aS.fltrS, aS.cfg.AccountSCfg().Opts.Usage, utils.OptsAccountsUsage, utils.MetaUsage); err != nil { return } diff --git a/accounts/apis.go b/accounts/apis.go index d549293d6..4740eb030 100644 --- a/accounts/apis.go +++ b/accounts/apis.go @@ -28,7 +28,7 @@ import ( // V1AccountsForEvent returns the matching Accounts for Event func (aS *AccountS) V1AccountsForEvent(ctx *context.Context, args *utils.CGREvent, aps *[]*utils.Account) (err error) { var accIDs []string - if accIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args, aS.fltrS, aS.cfg.AccountSCfg().Opts.ProfileIDs, + if accIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args.AsDataProvider(), aS.fltrS, aS.cfg.AccountSCfg().Opts.ProfileIDs, config.AccountsProfileIDsDftOpt, utils.OptsAccountsProfileIDs); err != nil { return } @@ -52,7 +52,7 @@ func (aS *AccountS) V1AccountsForEvent(ctx *context.Context, args *utils.CGREven // V1MaxAbstracts returns the maximum abstract units for the event, based on matching Accounts func (aS *AccountS) V1MaxAbstracts(ctx *context.Context, args *utils.CGREvent, eEc *utils.EventCharges) (err error) { var accIDs []string - if accIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args, aS.fltrS, aS.cfg.AccountSCfg().Opts.ProfileIDs, + if accIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args.AsDataProvider(), aS.fltrS, aS.cfg.AccountSCfg().Opts.ProfileIDs, config.AccountsProfileIDsDftOpt, utils.OptsAccountsProfileIDs); err != nil { return } @@ -82,7 +82,7 @@ func (aS *AccountS) V1MaxAbstracts(ctx *context.Context, args *utils.CGREvent, e // V1DebitAbstracts performs debit for the provided event func (aS *AccountS) V1DebitAbstracts(ctx *context.Context, args *utils.CGREvent, eEc *utils.EventCharges) (err error) { var accIDs []string - if accIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args, aS.fltrS, aS.cfg.AccountSCfg().Opts.ProfileIDs, + if accIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args.AsDataProvider(), aS.fltrS, aS.cfg.AccountSCfg().Opts.ProfileIDs, config.AccountsProfileIDsDftOpt, utils.OptsAccountsProfileIDs); err != nil { return } @@ -112,7 +112,7 @@ func (aS *AccountS) V1DebitAbstracts(ctx *context.Context, args *utils.CGREvent, // V1MaxConcretes returns the maximum concrete units for the event, based on matching Accounts func (aS *AccountS) V1MaxConcretes(ctx *context.Context, args *utils.CGREvent, eEc *utils.EventCharges) (err error) { var accIDs []string - if accIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args, aS.fltrS, aS.cfg.AccountSCfg().Opts.ProfileIDs, + if accIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args.AsDataProvider(), aS.fltrS, aS.cfg.AccountSCfg().Opts.ProfileIDs, config.AccountsProfileIDsDftOpt, utils.OptsAccountsProfileIDs); err != nil { return } @@ -142,7 +142,7 @@ func (aS *AccountS) V1MaxConcretes(ctx *context.Context, args *utils.CGREvent, e // V1DebitConcretes performs debit of concrete units for the provided event func (aS *AccountS) V1DebitConcretes(ctx *context.Context, args *utils.CGREvent, eEc *utils.EventCharges) (err error) { var accIDs []string - if accIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args, aS.fltrS, aS.cfg.AccountSCfg().Opts.ProfileIDs, + if accIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args.AsDataProvider(), aS.fltrS, aS.cfg.AccountSCfg().Opts.ProfileIDs, config.AccountsProfileIDsDftOpt, utils.OptsAccountsProfileIDs); err != nil { return } diff --git a/actions/apis.go b/actions/apis.go index 58bbfaa3f..bb7d902fe 100644 --- a/actions/apis.go +++ b/actions/apis.go @@ -28,7 +28,7 @@ import ( // V1ScheduleActions will be called to schedule actions matching the arguments func (aS *ActionS) V1ScheduleActions(ctx *context.Context, args *utils.CGREvent, rpl *string) (err error) { var actPrfIDs []string - if actPrfIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args, aS.fltrS, aS.cfg.ActionSCfg().Opts.ProfileIDs, + if actPrfIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args.AsDataProvider(), aS.fltrS, aS.cfg.ActionSCfg().Opts.ProfileIDs, config.ActionsProfileIDsDftOpt, utils.OptsActionsProfileIDs); err != nil { return } @@ -48,7 +48,7 @@ func (aS *ActionS) V1ScheduleActions(ctx *context.Context, args *utils.CGREvent, // V1ExecuteActions will be called to execute ASAP action profiles, ignoring their Schedule field func (aS *ActionS) V1ExecuteActions(ctx *context.Context, args *utils.CGREvent, rpl *string) (err error) { var actPrfIDs []string - if actPrfIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args, aS.fltrS, aS.cfg.ActionSCfg().Opts.ProfileIDs, + if actPrfIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args.AsDataProvider(), aS.fltrS, aS.cfg.ActionSCfg().Opts.ProfileIDs, config.ActionsProfileIDsDftOpt, utils.OptsActionsProfileIDs); err != nil { return } diff --git a/actions/export.go b/actions/export.go index e100ec729..57273e631 100644 --- a/actions/export.go +++ b/actions/export.go @@ -38,7 +38,7 @@ func newActHTTPPost(ctx *context.Context, tnt string, cgrEv *utils.CGREvent, pstrs: make([]*ees.HTTPjsonMapEE, len(aCfg.Diktats)), } for i, actD := range aL.cfg().Diktats { - attempts, err := engine.GetIntOpts(ctx, tnt, cgrEv, fltrS, cfg.ActionSCfg().Opts.PosterAttempts, + attempts, err := engine.GetIntOpts(ctx, tnt, cgrEv.AsDataProvider(), fltrS, cfg.ActionSCfg().Opts.PosterAttempts, utils.MetaPosterAttempts) if err != nil { return nil, err diff --git a/config/config.go b/config/config.go index 3194d70d4..6f62701c1 100644 --- a/config/config.go +++ b/config/config.go @@ -174,7 +174,7 @@ func newCGRConfig(config []byte) (cfg *CGRConfig, err error) { DebitInterval: []*DynamicDurationOpt{{value: SessionsDebitIntervalDftOpt}}, TTLMaxDelay: []*DynamicDurationOpt{{value: SessionsTTLMaxDelayDftOpt}}, TTLUsage: []*DynamicDurationPointerOpt{}, - SessionsOriginID: []*DynamicStringOpt{}, + OriginID: []*DynamicStringOpt{}, AccountsForceUsage: []*DynamicBoolOpt{}, }, }, diff --git a/config/config_defaults.go b/config/config_defaults.go index 113c7bc22..cd27c54a9 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -895,7 +895,7 @@ const CGRATES_CFG_JSON = ` // "Value": "" // } // ], - // "*sessionsOriginID": [ + // "*originID": [ // { // "Tenant": "*any", // "FilterIDs": [], diff --git a/config/config_it_test.go b/config/config_it_test.go index 7e074cbe3..250dfd3d2 100644 --- a/config/config_it_test.go +++ b/config/config_it_test.go @@ -848,6 +848,7 @@ func testCGRConfigReloadConfigFromJSONSessionS(t *testing.T) { RoutesDerivedReply: []*DynamicBoolOpt{{}}, StatsDerivedReply: []*DynamicBoolOpt{{}}, ThresholdsDerivedReply: []*DynamicBoolOpt{{}}, + OriginID: []*DynamicStringOpt{}, MaxUsage: []*DynamicBoolOpt{{}}, ForceUsage: []*DynamicBoolOpt{}, TTL: []*DynamicDurationOpt{{value: SessionsTTLDftOpt}}, @@ -857,6 +858,7 @@ func testCGRConfigReloadConfigFromJSONSessionS(t *testing.T) { DebitInterval: []*DynamicDurationOpt{{value: SessionsDebitIntervalDftOpt}}, TTLMaxDelay: []*DynamicDurationOpt{{value: SessionsTTLMaxDelayDftOpt}}, TTLUsage: []*DynamicDurationPointerOpt{}, + AccountsForceUsage: []*DynamicBoolOpt{}, }, } if !reflect.DeepEqual(expAttr, cfg.SessionSCfg()) { @@ -938,6 +940,7 @@ func testCGRConfigReloadConfigFromStringSessionS(t *testing.T) { ThresholdsDerivedReply: []*DynamicBoolOpt{{}}, MaxUsage: []*DynamicBoolOpt{{}}, ForceUsage: []*DynamicBoolOpt{}, + OriginID: []*DynamicStringOpt{}, TTL: []*DynamicDurationOpt{{value: SessionsTTLDftOpt}}, Chargeable: []*DynamicBoolOpt{{value: SessionsChargeableDftOpt}}, TTLLastUsage: []*DynamicDurationPointerOpt{}, @@ -945,6 +948,7 @@ func testCGRConfigReloadConfigFromStringSessionS(t *testing.T) { DebitInterval: []*DynamicDurationOpt{{value: SessionsDebitIntervalDftOpt}}, TTLMaxDelay: []*DynamicDurationOpt{{value: SessionsTTLMaxDelayDftOpt}}, TTLUsage: []*DynamicDurationPointerOpt{}, + AccountsForceUsage: []*DynamicBoolOpt{}, }, } if !reflect.DeepEqual(expAttr, cfg.SessionSCfg()) { @@ -952,7 +956,7 @@ func testCGRConfigReloadConfigFromStringSessionS(t *testing.T) { } var rcv string - expected := `{"sessions":{"accounts_conns":[],"actions_conns":[],"alterable_fields":[],"attributes_conns":["*localhost"],"cdrs_conns":["*internal"],"channel_sync_interval":"0","chargers_conns":["*localhost"],"client_protocol":1,"default_usage":{"*any":"3h0m0s","*data":"1048576","*sms":"1","*voice":"3h0m0s"},"enabled":true,"listen_bigob":"","listen_bijson":"127.0.0.1:2014","min_dur_low_balance":"0","opts":{"*accounts":[{"FilterIDs":null,"Tenant":""}],"*attributes":[{"FilterIDs":null,"Tenant":""}],"*attributesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*blockerError":[{"FilterIDs":null,"Tenant":""}],"*cdrs":[{"FilterIDs":null,"Tenant":""}],"*cdrsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*chargeable":[{"FilterIDs":null,"Tenant":""}],"*chargers":[{"FilterIDs":null,"Tenant":""}],"*debitInterval":[{"FilterIDs":null,"Tenant":""}],"*forceUsage":[],"*initiate":[{"FilterIDs":null,"Tenant":""}],"*maxUsage":[{"FilterIDs":null,"Tenant":""}],"*message":[{"FilterIDs":null,"Tenant":""}],"*resources":[{"FilterIDs":null,"Tenant":""}],"*resourcesAllocate":[{"FilterIDs":null,"Tenant":""}],"*resourcesAuthorize":[{"FilterIDs":null,"Tenant":""}],"*resourcesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*resourcesRelease":[{"FilterIDs":null,"Tenant":""}],"*routes":[{"FilterIDs":null,"Tenant":""}],"*routesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*stats":[{"FilterIDs":null,"Tenant":""}],"*statsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*terminate":[{"FilterIDs":null,"Tenant":""}],"*thresholds":[{"FilterIDs":null,"Tenant":""}],"*thresholdsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*ttl":[{"FilterIDs":null,"Tenant":""}],"*ttlLastUsage":[],"*ttlLastUsed":[],"*ttlMaxDelay":[{"FilterIDs":null,"Tenant":""}],"*ttlUsage":[],"*update":[{"FilterIDs":null,"Tenant":""}]},"rates_conns":[],"replication_conns":[],"resources_conns":["*localhost"],"routes_conns":["*localhost"],"session_indexes":[],"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":[]}}` + expected := `{"sessions":{"accounts_conns":[],"actions_conns":[],"alterable_fields":[],"attributes_conns":["*localhost"],"cdrs_conns":["*internal"],"channel_sync_interval":"0","chargers_conns":["*localhost"],"client_protocol":1,"default_usage":{"*any":"3h0m0s","*data":"1048576","*sms":"1","*voice":"3h0m0s"},"enabled":true,"listen_bigob":"","listen_bijson":"127.0.0.1:2014","min_dur_low_balance":"0","opts":{"*accounts":[{"FilterIDs":null,"Tenant":""}],"*accountsForceUsage":[],"*attributes":[{"FilterIDs":null,"Tenant":""}],"*attributesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*blockerError":[{"FilterIDs":null,"Tenant":""}],"*cdrs":[{"FilterIDs":null,"Tenant":""}],"*cdrsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*chargeable":[{"FilterIDs":null,"Tenant":""}],"*chargers":[{"FilterIDs":null,"Tenant":""}],"*debitInterval":[{"FilterIDs":null,"Tenant":""}],"*forceUsage":[],"*initiate":[{"FilterIDs":null,"Tenant":""}],"*maxUsage":[{"FilterIDs":null,"Tenant":""}],"*message":[{"FilterIDs":null,"Tenant":""}],"*originID":[],"*resources":[{"FilterIDs":null,"Tenant":""}],"*resourcesAllocate":[{"FilterIDs":null,"Tenant":""}],"*resourcesAuthorize":[{"FilterIDs":null,"Tenant":""}],"*resourcesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*resourcesRelease":[{"FilterIDs":null,"Tenant":""}],"*routes":[{"FilterIDs":null,"Tenant":""}],"*routesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*stats":[{"FilterIDs":null,"Tenant":""}],"*statsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*terminate":[{"FilterIDs":null,"Tenant":""}],"*thresholds":[{"FilterIDs":null,"Tenant":""}],"*thresholdsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*ttl":[{"FilterIDs":null,"Tenant":""}],"*ttlLastUsage":[],"*ttlLastUsed":[],"*ttlMaxDelay":[{"FilterIDs":null,"Tenant":""}],"*ttlUsage":[],"*update":[{"FilterIDs":null,"Tenant":""}]},"rates_conns":[],"replication_conns":[],"resources_conns":["*localhost"],"routes_conns":["*localhost"],"session_indexes":[],"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":[]}}` if err := cfg.V1GetConfigAsJSON(context.Background(), &SectionWithAPIOpts{Sections: []string{SessionSJSON}}, &rcv); err != nil { t.Error(err) } else if expected != rcv { @@ -1029,6 +1033,7 @@ func testCGRConfigReloadAll(t *testing.T) { ThresholdsDerivedReply: []*DynamicBoolOpt{{}}, MaxUsage: []*DynamicBoolOpt{{}}, ForceUsage: []*DynamicBoolOpt{}, + OriginID: []*DynamicStringOpt{}, TTL: []*DynamicDurationOpt{{value: SessionsTTLDftOpt}}, Chargeable: []*DynamicBoolOpt{{value: SessionsChargeableDftOpt}}, TTLLastUsage: []*DynamicDurationPointerOpt{}, @@ -1036,6 +1041,7 @@ func testCGRConfigReloadAll(t *testing.T) { DebitInterval: []*DynamicDurationOpt{{value: SessionsDebitIntervalDftOpt}}, TTLMaxDelay: []*DynamicDurationOpt{{value: SessionsTTLMaxDelayDftOpt}}, TTLUsage: []*DynamicDurationPointerOpt{}, + AccountsForceUsage: []*DynamicBoolOpt{}, }, } if !reflect.DeepEqual(expAttr, cfg.SessionSCfg()) { diff --git a/config/config_test.go b/config/config_test.go index 2c3ee9223..8234399b1 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -422,7 +422,7 @@ func TestCgrCfgJSONDefaultsSMGenericCfg(t *testing.T) { TTLMaxDelay: []*DynamicDurationOpt{{value: SessionsTTLMaxDelayDftOpt}}, TTLUsage: []*DynamicDurationPointerOpt{}, ForceUsage: []*DynamicBoolOpt{}, - SessionsOriginID: []*DynamicStringOpt{}, + OriginID: []*DynamicStringOpt{}, AccountsForceUsage: []*DynamicBoolOpt{}, }, } @@ -1755,7 +1755,7 @@ func TestSessionSConfig(t *testing.T) { TTLMaxDelay: []*DynamicDurationOpt{{value: SessionsTTLMaxDelayDftOpt}}, TTLUsage: []*DynamicDurationPointerOpt{}, ForceUsage: []*DynamicBoolOpt{}, - SessionsOriginID: []*DynamicStringOpt{}, + OriginID: []*DynamicStringOpt{}, AccountsForceUsage: []*DynamicBoolOpt{}, }, } @@ -3712,7 +3712,7 @@ func TestV1GetConfigSessionS(t *testing.T) { utils.MetaTTLMaxDelayCfg: []*DynamicDurationOpt{{value: SessionsTTLMaxDelayDftOpt}}, utils.MetaTTLUsageCfg: []*DynamicDurationPointerOpt{}, utils.MetaForceUsageCfg: []*DynamicBoolOpt{}, - utils.MetaSessionsOriginID: []*DynamicStringOpt{}, + utils.MetaOriginID: []*DynamicStringOpt{}, utils.MetaAccountsForceUsage: []*DynamicBoolOpt{}, }, }, @@ -4703,7 +4703,7 @@ func TestV1GetConfigAsJSONCdrs(t *testing.T) { func TestV1GetConfigAsJSONSessionS(t *testing.T) { var reply string - expected := `{"sessions":{"accounts_conns":[],"actions_conns":[],"alterable_fields":[],"attributes_conns":[],"cdrs_conns":[],"channel_sync_interval":"0","chargers_conns":[],"client_protocol":1,"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","opts":{"*accounts":[{"FilterIDs":null,"Tenant":""}],"*accountsForceUsage":[],"*attributes":[{"FilterIDs":null,"Tenant":""}],"*attributesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*blockerError":[{"FilterIDs":null,"Tenant":""}],"*cdrs":[{"FilterIDs":null,"Tenant":""}],"*cdrsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*chargeable":[{"FilterIDs":null,"Tenant":""}],"*chargers":[{"FilterIDs":null,"Tenant":""}],"*debitInterval":[{"FilterIDs":null,"Tenant":""}],"*forceUsage":[],"*initiate":[{"FilterIDs":null,"Tenant":""}],"*maxUsage":[{"FilterIDs":null,"Tenant":""}],"*message":[{"FilterIDs":null,"Tenant":""}],"*resources":[{"FilterIDs":null,"Tenant":""}],"*resourcesAllocate":[{"FilterIDs":null,"Tenant":""}],"*resourcesAuthorize":[{"FilterIDs":null,"Tenant":""}],"*resourcesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*resourcesRelease":[{"FilterIDs":null,"Tenant":""}],"*routes":[{"FilterIDs":null,"Tenant":""}],"*routesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*sessionsOriginID":[],"*stats":[{"FilterIDs":null,"Tenant":""}],"*statsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*terminate":[{"FilterIDs":null,"Tenant":""}],"*thresholds":[{"FilterIDs":null,"Tenant":""}],"*thresholdsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*ttl":[{"FilterIDs":null,"Tenant":""}],"*ttlLastUsage":[],"*ttlLastUsed":[],"*ttlMaxDelay":[{"FilterIDs":null,"Tenant":""}],"*ttlUsage":[],"*update":[{"FilterIDs":null,"Tenant":""}]},"rates_conns":[],"replication_conns":[],"resources_conns":[],"routes_conns":[],"session_indexes":[],"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":[]}}` + expected := `{"sessions":{"accounts_conns":[],"actions_conns":[],"alterable_fields":[],"attributes_conns":[],"cdrs_conns":[],"channel_sync_interval":"0","chargers_conns":[],"client_protocol":1,"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","opts":{"*accounts":[{"FilterIDs":null,"Tenant":""}],"*accountsForceUsage":[],"*attributes":[{"FilterIDs":null,"Tenant":""}],"*attributesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*blockerError":[{"FilterIDs":null,"Tenant":""}],"*cdrs":[{"FilterIDs":null,"Tenant":""}],"*cdrsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*chargeable":[{"FilterIDs":null,"Tenant":""}],"*chargers":[{"FilterIDs":null,"Tenant":""}],"*debitInterval":[{"FilterIDs":null,"Tenant":""}],"*forceUsage":[],"*initiate":[{"FilterIDs":null,"Tenant":""}],"*maxUsage":[{"FilterIDs":null,"Tenant":""}],"*message":[{"FilterIDs":null,"Tenant":""}],"*originID":[],"*resources":[{"FilterIDs":null,"Tenant":""}],"*resourcesAllocate":[{"FilterIDs":null,"Tenant":""}],"*resourcesAuthorize":[{"FilterIDs":null,"Tenant":""}],"*resourcesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*resourcesRelease":[{"FilterIDs":null,"Tenant":""}],"*routes":[{"FilterIDs":null,"Tenant":""}],"*routesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*stats":[{"FilterIDs":null,"Tenant":""}],"*statsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*terminate":[{"FilterIDs":null,"Tenant":""}],"*thresholds":[{"FilterIDs":null,"Tenant":""}],"*thresholdsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*ttl":[{"FilterIDs":null,"Tenant":""}],"*ttlLastUsage":[],"*ttlLastUsed":[],"*ttlMaxDelay":[{"FilterIDs":null,"Tenant":""}],"*ttlUsage":[],"*update":[{"FilterIDs":null,"Tenant":""}]},"rates_conns":[],"replication_conns":[],"resources_conns":[],"routes_conns":[],"session_indexes":[],"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":[]}}` cfgCgr := NewDefaultCGRConfig() if err := cfgCgr.V1GetConfigAsJSON(context.Background(), &SectionWithAPIOpts{Sections: []string{SessionSJSON}}, &reply); err != nil { t.Error(err) @@ -5076,7 +5076,7 @@ func TestV1GetConfigAsJSONAllConfig(t *testing.T) { } }` var reply string - expected := `{"accounts":{"attributes_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"max_iterations":1000,"max_usage":"259200000000000","nested_fields":false,"notexists_indexed_fields":[],"opts":{"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*usage":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"rates_conns":[],"suffix_indexed_fields":[],"thresholds_conns":[]},"actions":{"accounts_conns":[],"cdrs_conns":[],"dynaprepaid_actionprofile":[],"ees_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*posterAttempts":[{"FilterIDs":null,"Tenant":""}],"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"stats_conns":[],"suffix_indexed_fields":[],"tenants":[],"thresholds_conns":[]},"admins":{"actions_conns":[],"attributes_conns":[],"caches_conns":["*internal"],"ees_conns":[],"enabled":false},"analyzers":{"cleanup_interval":"1h0m0s","db_path":"/var/spool/cgrates/analyzers","ees_conns":[],"enabled":false,"index_type":"*scorch","opts":{"*exporterIDs":[]},"ttl":"24h0m0s"},"apiban":{"enabled":false,"keys":[]},"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":{"accounts_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*processRuns":[{"FilterIDs":null,"Tenant":""}],"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*profileRuns":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"caches":{"partitions":{"*account_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_profile_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_profiles":{"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"},"*diameter_messages":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*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},"*ranking_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_profile_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_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_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"},"*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},"*trend_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*uch":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"}},"remote_conns":[],"replication_conns":[]},"cdrs":{"accounts_conns":[],"actions_conns":[],"attributes_conns":[],"chargers_conns":[],"ees_conns":[],"enabled":false,"extra_fields":[],"online_cdr_exports":null,"opts":{"*accounts":[{"FilterIDs":null,"Tenant":""}],"*attributes":[{"FilterIDs":null,"Tenant":""}],"*chargers":[{"FilterIDs":null,"Tenant":""}],"*ees":[{"FilterIDs":null,"Tenant":""}],"*rates":[{"FilterIDs":null,"Tenant":""}],"*refund":[{"FilterIDs":null,"Tenant":""}],"*rerate":[{"FilterIDs":null,"Tenant":""}],"*stats":[{"FilterIDs":null,"Tenant":""}],"*store":[{"FilterIDs":null,"Tenant":""}],"*thresholds":[{"FilterIDs":null,"Tenant":""}]},"rates_conns":[],"session_cost_retries":5,"stats_conns":[],"thresholds_conns":[]},"chargers":{"attributes_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"prefix_indexed_fields":[],"suffix_indexed_fields":[]},"config_db":{"db_host":"","db_name":"","db_password":"","db_port":0,"db_type":"*internal","db_user":"","opts":{"mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"}},"configs":{"enabled":false,"root_dir":"/var/spool/cgrates/configs","url":"/configs/"},"cores":{"caps":0,"caps_stats_interval":"0","caps_strategy":"*busy","ees_conns":[],"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_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_profile_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_profiles":{"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},"*filters":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ranking_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_profile_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_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_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},"*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},"*trend_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*versions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisPoolPipelineLimit":0,"redisPoolPipelineWindow":"150µs","redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_filtered":false},"diameter_agent":{"asr_template":"","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},"dns_agent":{"enabled":false,"listeners":[{"address":"127.0.0.1:53","network":"udp"}],"request_processors":[],"sessions_conns":["*internal"],"timezone":""},"ees":{"attributes_conns":[],"cache":{"*fileCSV":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"enabled":false,"exporters":[{"attempts":1,"attribute_context":"","attribute_ids":[],"blocker":false,"concurrent_requests":0,"efs_conns":["*internal"],"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"}]},"efs":{"enabled":false,"failed_posts_dir":"/var/spool/cgrates/failed_posts","failed_posts_ttl":"5s","poster_attempts":3},"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","max_reconnect_interval":"5m0s","opts":{"csvFieldSeparator":",","csvHeaderDefineChar":":","csvRowLength":0,"natsSubject":"cgrates_cdrs","partialCacheAction":"*none","partialOrderField":"~*req.AnswerTime"},"partial_commit_fields":[],"processed_path":"/var/spool/cgrates/ers/out","reconnects":-1,"run_delay":"0","source_path":"/var/spool/cgrates/ers/in","start_delay":"0","tenant":"","timezone":"","type":"*none"}],"sessions_conns":["*internal"]},"filters":{"accounts_conns":[],"rankings_conns":[],"resources_conns":[],"stats_conns":[],"trends_conns":[]},"freeswitch_agent":{"active_session_delimiter":",","create_cdr":false,"empty_balance_ann_file":"","empty_balance_context":"","enabled":false,"event_socket_conns":[{"address":"127.0.0.1:8021","alias":"127.0.0.1:8021","max_reconnect_interval":"0s","password":"ClueCon","reconnects":5,"reply_timeout":"1m0s"}],"extra_fields":[],"low_balance_ann_file":"","max_wait_connection":"2s","sessions_conns":["*birpc_internal"],"subscribe_park":true},"general":{"caching_delay":"0","connect_attempts":5,"connect_timeout":"1s","dbdata_encoding":"*msgpack","decimal_max_scale":0,"decimal_min_scale":0,"decimal_precision":0,"decimal_rounding_mode":"*toNearestEven","default_caching":"*reload","default_category":"call","default_request_type":"*rated","default_tenant":"cgrates.org","default_timezone":"Local","digest_equal":":","digest_separator":",","locking_timeout":"0","max_parallel_conns":100,"max_reconnect_interval":"0","node_id":"ENGINE1","opts":{"*exporterIDs":[]},"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","skipTLSVerification":false,"tlsHandshakeTimeout":"10s"},"freeswitch_cdrs_url":"/freeswitch_json","http_cdrs":"/cdr_http","json_rpc_url":"/jsonrpc","pprof_path":"/debug/pprof/","prometheus_url":"/prometheus","registrars_url":"/registrar","use_basic_auth":false,"ws_url":"/ws"},"http_agent":[],"janus_agent":{"enabled":false,"janus_conns":[{"address":"127.0.0.1:8088","admin_address":"localhost:7188","admin_password":"","type":"*ws"}],"request_processors":[],"sessions_conns":["*internal"],"url":"/janus"},"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":{"actions_conns":["*localhost"],"caches_conns":["*localhost"],"data_path":"./","disable_reverse":false,"field_separator":",","gapi_credentials":".gapi/credentials.json","gapi_token":".gapi/token.json","tpid":""},"loaders":[{"action":"*store","cache":{"*accounts":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*action_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*attributes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*chargers":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*filters":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*rankings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*rate_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*routes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*stats":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*thresholds":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*trends":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"caches_conns":["*internal"],"data":[{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"new_branch":true,"path":"Rules.Type","tag":"Type","type":"*variable","value":"~*req.2"},{"path":"Rules.Element","tag":"Element","type":"*variable","value":"~*req.3"},{"path":"Rules.Values","tag":"Values","type":"*variable","value":"~*req.4"}],"file_name":"Filters.csv","flags":null,"type":"*filters"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"TenantID","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ProfileID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"new_branch":true,"path":"Attributes.FilterIDs","tag":"AttributeFilterIDs","type":"*variable","value":"~*req.5"},{"path":"Attributes.Blockers","tag":"AttributeBlockers","type":"*variable","value":"~*req.6"},{"path":"Attributes.Path","tag":"Path","type":"*variable","value":"~*req.7"},{"path":"Attributes.Type","tag":"Type","type":"*variable","value":"~*req.8"},{"path":"Attributes.Value","tag":"Value","type":"*variable","value":"~*req.9"}],"file_name":"Attributes.csv","flags":null,"type":"*attributes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"UsageTTL","tag":"TTL","type":"*variable","value":"~*req.4"},{"path":"Limit","tag":"Limit","type":"*variable","value":"~*req.5"},{"path":"AllocationMessage","tag":"AllocationMessage","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.9"}],"file_name":"Resources.csv","flags":null,"type":"*resources"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"QueueLength","tag":"QueueLength","type":"*variable","value":"~*req.5"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.6"},{"path":"MinItems","tag":"MinItems","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.9"},{"new_branch":true,"path":"Metrics.MetricID","tag":"MetricIDs","type":"*variable","value":"~*req.10"},{"path":"Metrics.FilterIDs","tag":"MetricFilterIDs","type":"*variable","value":"~*req.11"},{"path":"Metrics.Blockers","tag":"MetricBlockers","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":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"MaxHits","tag":"MaxHits","type":"*variable","value":"~*req.4"},{"path":"MinHits","tag":"MinHits","type":"*variable","value":"~*req.5"},{"path":"MinSleep","tag":"MinSleep","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"ActionProfileIDs","tag":"ActionProfileIDs","type":"*variable","value":"~*req.8"},{"path":"Async","tag":"Async","type":"*variable","value":"~*req.9"}],"file_name":"Thresholds.csv","flags":null,"type":"*thresholds"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.2"},{"path":"StatID","tag":"StatID","type":"*variable","value":"~*req.3"},{"path":"Metrics","tag":"Metrics","type":"*variable","value":"~*req.4"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.5"},{"path":"QueueLength","tag":"QueueLength","type":"*variable","value":"~*req.6"},{"path":"MinItems","tag":"MinItems","type":"*variable","value":"~*req.7"},{"path":"CorrelationType","tag":"CorrelationType","type":"*variable","value":"~*req.8"},{"path":"Tolerance","tag":"Tolerance","type":"*variable","value":"~*req.9"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.10"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.11"}],"file_name":"Trends.csv","flags":null,"type":"*trends"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.2"},{"path":"StatIDs","tag":"StatIDs","type":"*variable","value":"~*req.3"},{"path":"MetricIDs","tag":"MetricIDs","type":"*variable","value":"~*req.4"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.5"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.6"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.7"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.8"}],"file_name":"Rankings.csv","flags":null,"type":"*rankings"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.5"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.6"},{"new_branch":true,"path":"Routes.ID","tag":"RouteID","type":"*variable","value":"~*req.7"},{"path":"Routes.FilterIDs","tag":"RouteFilterIDs","type":"*variable","value":"~*req.8"},{"path":"Routes.AccountIDs","tag":"RouteAccountIDs","type":"*variable","value":"~*req.9"},{"path":"Routes.RateProfileIDs","tag":"RouteRateProfileIDs","type":"*variable","value":"~*req.10"},{"path":"Routes.ResourceIDs","tag":"RouteResourceIDs","type":"*variable","value":"~*req.11"},{"path":"Routes.StatIDs","tag":"RouteStatIDs","type":"*variable","value":"~*req.12"},{"path":"Routes.Weights","tag":"RouteWeights","type":"*variable","value":"~*req.13"},{"path":"Routes.Blockers","tag":"RouteBlockers","type":"*variable","value":"~*req.14"},{"path":"Routes.RouteParameters","tag":"RouteParameters","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":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"RunID","tag":"RunID","type":"*variable","value":"~*req.5"},{"path":"AttributeIDs","tag":"AttributeIDs","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":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"MinCost","tag":"MinCost","type":"*variable","value":"~*req.4"},{"path":"MaxCost","tag":"MaxCost","type":"*variable","value":"~*req.5"},{"path":"MaxCostStrategy","tag":"MaxCostStrategy","type":"*variable","value":"~*req.6"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].FilterIDs","tag":"RateFilterIDs","type":"*variable","value":"~*req.8"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].ActivationTimes","tag":"RateActivationTimes","type":"*variable","value":"~*req.9"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].Weights","tag":"RateWeights","type":"*variable","value":"~*req.10"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].Blocker","tag":"RateBlocker","type":"*variable","value":"~*req.11"},{"filters":["*notempty:~*req.7:"],"new_branch":true,"path":"Rates[\u003c~*req.7\u003e].IntervalRates.IntervalStart","tag":"RateIntervalStart","type":"*variable","value":"~*req.12"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.FixedFee","tag":"RateFixedFee","type":"*variable","value":"~*req.13"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.RecurrentFee","tag":"RateRecurrentFee","type":"*variable","value":"~*req.14"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.Unit","tag":"RateUnit","type":"*variable","value":"~*req.15"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.Increment","tag":"RateIncrement","type":"*variable","value":"~*req.16"}],"file_name":"Rates.csv","flags":null,"type":"*rate_profiles"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.5"},{"path":"Targets[\u003c~*req.6\u003e]","tag":"TargetIDs","type":"*variable","value":"~*req.7"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].FilterIDs","tag":"ActionFilterIDs","type":"*variable","value":"~*req.9"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].TTL","tag":"ActionTTL","type":"*variable","value":"~*req.10"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].Type","tag":"ActionType","type":"*variable","value":"~*req.11"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].Opts","tag":"ActionOpts","type":"*variable","value":"~*req.12"},{"filters":["*notempty:~*req.8:"],"new_branch":true,"path":"Actions[\u003c~*req.8\u003e].Diktats.Path","tag":"ActionPath","type":"*variable","value":"~*req.13"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].Diktats.Value","tag":"ActionValue","type":"*variable","value":"~*req.14"}],"file_name":"Actions.csv","flags":null,"type":"*action_profiles"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"Opts","tag":"Opts","type":"*variable","value":"~*req.5"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].FilterIDs","tag":"BalanceFilterIDs","type":"*variable","value":"~*req.7"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Weights","tag":"BalanceWeights","type":"*variable","value":"~*req.8"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Blockers","tag":"BalanceBlockers","type":"*variable","value":"~*req.9"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Type","tag":"BalanceType","type":"*variable","value":"~*req.10"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Units","tag":"BalanceUnits","type":"*variable","value":"~*req.11"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].UnitFactors","tag":"BalanceUnitFactors","type":"*variable","value":"~*req.12"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Opts","tag":"BalanceOpts","type":"*variable","value":"~*req.13"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].CostIncrements","tag":"BalanceCostIncrements","type":"*variable","value":"~*req.14"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].AttributeIDs","tag":"BalanceAttributeIDs","type":"*variable","value":"~*req.15"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].RateProfileIDs","tag":"BalanceRateProfileIDs","type":"*variable","value":"~*req.16"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.17"}],"file_name":"Accounts.csv","flags":null,"type":"*accounts"}],"enabled":false,"field_separator":",","id":"*default","lockfile_path":".cgr.lck","opts":{"*cache":"","*forceLock":false,"*stopOnError":false,"*withIndex":true},"run_delay":"0","tenant":"","tp_in_dir":"/var/spool/cgrates/loader/in","tp_out_dir":"/var/spool/cgrates/loader/out"}],"logger":{"efs_conns":["*internal"],"level":6,"opts":{"failed_posts_dir":"/var/spool/cgrates/failed_posts","kafka_attempts":1,"kafka_conn":"","kafka_topic":""},"type":"*syslog"},"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisPoolPipelineLimit":0,"redisPoolPipelineWindow":"150µs","redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"out_datadb_password":"","out_datadb_port":"6379","out_datadb_type":"*redis","out_datadb_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"]},"rankings":{"ees_conns":[],"ees_exporter_ids":null,"enabled":false,"scheduled_ids":{},"stats_conns":[],"store_interval":"","thresholds_conns":[]},"rates":{"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*intervalStart":[{"FilterIDs":null,"Tenant":""}],"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*startTime":[{"FilterIDs":null,"Tenant":""}],"*usage":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"rate_exists_indexed_fields":[],"rate_indexed_selects":true,"rate_nested_fields":false,"rate_notexists_indexed_fields":[],"rate_prefix_indexed_fields":[],"rate_suffix_indexed_fields":[],"suffix_indexed_fields":[],"verbosity":1000},"registrarc":{"rpc":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]}},"resources":{"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*units":[{"FilterIDs":null,"Tenant":""}],"*usageID":[{"FilterIDs":null,"Tenant":""}],"*usageTTL":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[],"thresholds_conns":[]},"routes":{"accounts_conns":[],"attributes_conns":[],"default_ratio":1,"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*context":[{"FilterIDs":null,"Tenant":""}],"*ignoreErrors":[{"FilterIDs":null,"Tenant":""}],"*limit":[],"*maxCost":[{"Tenant":"","Value":""}],"*maxItems":[],"*offset":[],"*profileCount":[{"FilterIDs":null,"Tenant":""}],"*usage":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"rates_conns":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"rpc_conns":{"*bijson_localhost":{"conns":[{"address":"127.0.0.1:2014","transport":"*birpc_json"}],"poolSize":0,"strategy":"*first"},"*birpc_internal":{"conns":[{"address":"*birpc_internal","transport":""}],"poolSize":0,"strategy":"*first"},"*internal":{"conns":[{"address":"*internal","transport":""}],"poolSize":0,"strategy":"*first"},"*localhost":{"conns":[{"address":"127.0.0.1:2012","transport":"*json"}],"poolSize":0,"strategy":"*first"}},"sentrypeer":{"audience":"https://sentrypeer.com/api","client_id":"","client_secret":"","grant_type":"client_credentials","ips_url":"https://sentrypeer.com/api/ip-addresses","numbers_url":"https://sentrypeer.com/api/phone-numbers","token_url":"https://authz.sentrypeer.com/oauth/token"},"sessions":{"accounts_conns":[],"actions_conns":[],"alterable_fields":[],"attributes_conns":[],"cdrs_conns":[],"channel_sync_interval":"0","chargers_conns":[],"client_protocol":1,"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","opts":{"*accounts":[{"FilterIDs":null,"Tenant":""}],"*accountsForceUsage":[],"*attributes":[{"FilterIDs":null,"Tenant":""}],"*attributesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*blockerError":[{"FilterIDs":null,"Tenant":""}],"*cdrs":[{"FilterIDs":null,"Tenant":""}],"*cdrsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*chargeable":[{"FilterIDs":null,"Tenant":""}],"*chargers":[{"FilterIDs":null,"Tenant":""}],"*debitInterval":[{"FilterIDs":null,"Tenant":""}],"*forceUsage":[],"*initiate":[{"FilterIDs":null,"Tenant":""}],"*maxUsage":[{"FilterIDs":null,"Tenant":""}],"*message":[{"FilterIDs":null,"Tenant":""}],"*resources":[{"FilterIDs":null,"Tenant":""}],"*resourcesAllocate":[{"FilterIDs":null,"Tenant":""}],"*resourcesAuthorize":[{"FilterIDs":null,"Tenant":""}],"*resourcesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*resourcesRelease":[{"FilterIDs":null,"Tenant":""}],"*routes":[{"FilterIDs":null,"Tenant":""}],"*routesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*sessionsOriginID":[],"*stats":[{"FilterIDs":null,"Tenant":""}],"*statsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*terminate":[{"FilterIDs":null,"Tenant":""}],"*thresholds":[{"FilterIDs":null,"Tenant":""}],"*thresholdsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*ttl":[{"FilterIDs":null,"Tenant":""}],"*ttlLastUsage":[],"*ttlLastUsed":[],"*ttlMaxDelay":[{"FilterIDs":null,"Tenant":""}],"*ttlUsage":[],"*update":[{"FilterIDs":null,"Tenant":""}]},"rates_conns":[],"replication_conns":[],"resources_conns":[],"routes_conns":[],"session_indexes":[],"stats_conns":[],"stir":{"allowed_attest":["*any"],"default_attest":"A","payload_maxduration":"-1","privatekey_path":"","publickey_path":""},"store_session_costs":false,"terminate_attempts":5,"thresholds_conns":[]},"sip_agent":{"enabled":false,"listen":"127.0.0.1:5060","listen_net":"udp","request_processors":[],"retransmission_timer":"1s","sessions_conns":["*internal"],"timezone":""},"stats":{"ees_conns":[],"ees_exporter_ids":null,"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*prometheusStatIDs":[],"*roundingDecimals":[]},"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}},"opts":{"mongoConnScheme":"mongodb","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":"~*opts.*originID","customer_number":"~*req.Subject","include_local_cost":false,"orig_number":"~*req.Subject","p2pplus4":"","p2pzipcode":"","plus4":"","regulatory_code":"03","response_group":"03","response_type":"D4","return_file_code":"0","sales_type_code":"R","tax_exemption_code_list":"","tax_included":"0","tax_situs_rule":"04","term_number":"~*req.Destination","timezone":"UTC","trans_type_code":"010101","unit_type":"00","units":"1","url":"","validation_key":"","zipcode":""},"templates":{"*asr":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"}],"*cca":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"path":"*rep.Result-Code","tag":"ResultCode","type":"*constant","value":"2001"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"},{"mandatory":true,"path":"*rep.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"mandatory":true,"path":"*rep.CC-Request-Type","tag":"CCRequestType","type":"*variable","value":"~*req.CC-Request-Type"},{"mandatory":true,"path":"*rep.CC-Request-Number","tag":"CCRequestNumber","type":"*variable","value":"~*req.CC-Request-Number"}],"*cdrLog":[{"mandatory":true,"path":"*cdr.ToR","tag":"ToR","type":"*variable","value":"~*req.BalanceType"},{"mandatory":true,"path":"*cdr.OriginHost","tag":"OriginHost","type":"*constant","value":"127.0.0.1"},{"mandatory":true,"path":"*cdr.RequestType","tag":"RequestType","type":"*constant","value":"*none"},{"mandatory":true,"path":"*cdr.Tenant","tag":"Tenant","type":"*variable","value":"~*req.Tenant"},{"mandatory":true,"path":"*cdr.Account","tag":"Account","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Subject","tag":"Subject","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Cost","tag":"Cost","type":"*variable","value":"~*req.Cost"},{"mandatory":true,"path":"*cdr.Source","tag":"Source","type":"*constant","value":"*cdrLog"},{"mandatory":true,"path":"*cdr.Usage","tag":"Usage","type":"*constant","value":"1"},{"mandatory":true,"path":"*cdr.RunID","tag":"RunID","type":"*variable","value":"~*req.ActionType"},{"mandatory":true,"path":"*cdr.SetupTime","tag":"SetupTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.AnswerTime","tag":"AnswerTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.PreRated","tag":"PreRated","type":"*constant","value":"true"}],"*err":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"}],"*errSip":[{"mandatory":true,"path":"*rep.Request","tag":"Request","type":"*constant","value":"SIP/2.0 500 Internal Server Error"}],"*rar":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"path":"*diamreq.Re-Auth-Request-Type","tag":"ReAuthRequestType","type":"*constant","value":"0"}]},"thresholds":{"actions_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[]},"tls":{"ca_certificate":"","client_certificate":"","client_key":"","server_certificate":"","server_key":"","server_name":"","server_policy":4},"tpes":{"enabled":false},"trends":{"ees_conns":[],"ees_exporter_ids":null,"enabled":false,"scheduled_ids":{},"stats_conns":[],"store_interval":"","store_uncompressed_limit":0,"thresholds_conns":[]}}` + expected := `{"accounts":{"attributes_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"max_iterations":1000,"max_usage":"259200000000000","nested_fields":false,"notexists_indexed_fields":[],"opts":{"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*usage":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"rates_conns":[],"suffix_indexed_fields":[],"thresholds_conns":[]},"actions":{"accounts_conns":[],"cdrs_conns":[],"dynaprepaid_actionprofile":[],"ees_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*posterAttempts":[{"FilterIDs":null,"Tenant":""}],"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"stats_conns":[],"suffix_indexed_fields":[],"tenants":[],"thresholds_conns":[]},"admins":{"actions_conns":[],"attributes_conns":[],"caches_conns":["*internal"],"ees_conns":[],"enabled":false},"analyzers":{"cleanup_interval":"1h0m0s","db_path":"/var/spool/cgrates/analyzers","ees_conns":[],"enabled":false,"index_type":"*scorch","opts":{"*exporterIDs":[]},"ttl":"24h0m0s"},"apiban":{"enabled":false,"keys":[]},"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":{"accounts_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*processRuns":[{"FilterIDs":null,"Tenant":""}],"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*profileRuns":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"caches":{"partitions":{"*account_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_profile_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_profiles":{"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"},"*diameter_messages":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*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},"*ranking_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_profile_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_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_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"},"*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},"*trend_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*uch":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"}},"remote_conns":[],"replication_conns":[]},"cdrs":{"accounts_conns":[],"actions_conns":[],"attributes_conns":[],"chargers_conns":[],"ees_conns":[],"enabled":false,"extra_fields":[],"online_cdr_exports":null,"opts":{"*accounts":[{"FilterIDs":null,"Tenant":""}],"*attributes":[{"FilterIDs":null,"Tenant":""}],"*chargers":[{"FilterIDs":null,"Tenant":""}],"*ees":[{"FilterIDs":null,"Tenant":""}],"*rates":[{"FilterIDs":null,"Tenant":""}],"*refund":[{"FilterIDs":null,"Tenant":""}],"*rerate":[{"FilterIDs":null,"Tenant":""}],"*stats":[{"FilterIDs":null,"Tenant":""}],"*store":[{"FilterIDs":null,"Tenant":""}],"*thresholds":[{"FilterIDs":null,"Tenant":""}]},"rates_conns":[],"session_cost_retries":5,"stats_conns":[],"thresholds_conns":[]},"chargers":{"attributes_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"prefix_indexed_fields":[],"suffix_indexed_fields":[]},"config_db":{"db_host":"","db_name":"","db_password":"","db_port":0,"db_type":"*internal","db_user":"","opts":{"mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"}},"configs":{"enabled":false,"root_dir":"/var/spool/cgrates/configs","url":"/configs/"},"cores":{"caps":0,"caps_stats_interval":"0","caps_strategy":"*busy","ees_conns":[],"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_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_profile_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_profiles":{"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},"*filters":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ranking_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_profile_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_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_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},"*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},"*trend_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*versions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisPoolPipelineLimit":0,"redisPoolPipelineWindow":"150µs","redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_filtered":false},"diameter_agent":{"asr_template":"","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},"dns_agent":{"enabled":false,"listeners":[{"address":"127.0.0.1:53","network":"udp"}],"request_processors":[],"sessions_conns":["*internal"],"timezone":""},"ees":{"attributes_conns":[],"cache":{"*fileCSV":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"enabled":false,"exporters":[{"attempts":1,"attribute_context":"","attribute_ids":[],"blocker":false,"concurrent_requests":0,"efs_conns":["*internal"],"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"}]},"efs":{"enabled":false,"failed_posts_dir":"/var/spool/cgrates/failed_posts","failed_posts_ttl":"5s","poster_attempts":3},"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","max_reconnect_interval":"5m0s","opts":{"csvFieldSeparator":",","csvHeaderDefineChar":":","csvRowLength":0,"natsSubject":"cgrates_cdrs","partialCacheAction":"*none","partialOrderField":"~*req.AnswerTime"},"partial_commit_fields":[],"processed_path":"/var/spool/cgrates/ers/out","reconnects":-1,"run_delay":"0","source_path":"/var/spool/cgrates/ers/in","start_delay":"0","tenant":"","timezone":"","type":"*none"}],"sessions_conns":["*internal"]},"filters":{"accounts_conns":[],"rankings_conns":[],"resources_conns":[],"stats_conns":[],"trends_conns":[]},"freeswitch_agent":{"active_session_delimiter":",","create_cdr":false,"empty_balance_ann_file":"","empty_balance_context":"","enabled":false,"event_socket_conns":[{"address":"127.0.0.1:8021","alias":"127.0.0.1:8021","max_reconnect_interval":"0s","password":"ClueCon","reconnects":5,"reply_timeout":"1m0s"}],"extra_fields":[],"low_balance_ann_file":"","max_wait_connection":"2s","sessions_conns":["*birpc_internal"],"subscribe_park":true},"general":{"caching_delay":"0","connect_attempts":5,"connect_timeout":"1s","dbdata_encoding":"*msgpack","decimal_max_scale":0,"decimal_min_scale":0,"decimal_precision":0,"decimal_rounding_mode":"*toNearestEven","default_caching":"*reload","default_category":"call","default_request_type":"*rated","default_tenant":"cgrates.org","default_timezone":"Local","digest_equal":":","digest_separator":",","locking_timeout":"0","max_parallel_conns":100,"max_reconnect_interval":"0","node_id":"ENGINE1","opts":{"*exporterIDs":[]},"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","skipTLSVerification":false,"tlsHandshakeTimeout":"10s"},"freeswitch_cdrs_url":"/freeswitch_json","http_cdrs":"/cdr_http","json_rpc_url":"/jsonrpc","pprof_path":"/debug/pprof/","prometheus_url":"/prometheus","registrars_url":"/registrar","use_basic_auth":false,"ws_url":"/ws"},"http_agent":[],"janus_agent":{"enabled":false,"janus_conns":[{"address":"127.0.0.1:8088","admin_address":"localhost:7188","admin_password":"","type":"*ws"}],"request_processors":[],"sessions_conns":["*internal"],"url":"/janus"},"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":{"actions_conns":["*localhost"],"caches_conns":["*localhost"],"data_path":"./","disable_reverse":false,"field_separator":",","gapi_credentials":".gapi/credentials.json","gapi_token":".gapi/token.json","tpid":""},"loaders":[{"action":"*store","cache":{"*accounts":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*action_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*attributes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*chargers":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*filters":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*rankings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*rate_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*routes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*stats":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*thresholds":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*trends":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"caches_conns":["*internal"],"data":[{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"new_branch":true,"path":"Rules.Type","tag":"Type","type":"*variable","value":"~*req.2"},{"path":"Rules.Element","tag":"Element","type":"*variable","value":"~*req.3"},{"path":"Rules.Values","tag":"Values","type":"*variable","value":"~*req.4"}],"file_name":"Filters.csv","flags":null,"type":"*filters"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"TenantID","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ProfileID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"new_branch":true,"path":"Attributes.FilterIDs","tag":"AttributeFilterIDs","type":"*variable","value":"~*req.5"},{"path":"Attributes.Blockers","tag":"AttributeBlockers","type":"*variable","value":"~*req.6"},{"path":"Attributes.Path","tag":"Path","type":"*variable","value":"~*req.7"},{"path":"Attributes.Type","tag":"Type","type":"*variable","value":"~*req.8"},{"path":"Attributes.Value","tag":"Value","type":"*variable","value":"~*req.9"}],"file_name":"Attributes.csv","flags":null,"type":"*attributes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"UsageTTL","tag":"TTL","type":"*variable","value":"~*req.4"},{"path":"Limit","tag":"Limit","type":"*variable","value":"~*req.5"},{"path":"AllocationMessage","tag":"AllocationMessage","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.9"}],"file_name":"Resources.csv","flags":null,"type":"*resources"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"QueueLength","tag":"QueueLength","type":"*variable","value":"~*req.5"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.6"},{"path":"MinItems","tag":"MinItems","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.9"},{"new_branch":true,"path":"Metrics.MetricID","tag":"MetricIDs","type":"*variable","value":"~*req.10"},{"path":"Metrics.FilterIDs","tag":"MetricFilterIDs","type":"*variable","value":"~*req.11"},{"path":"Metrics.Blockers","tag":"MetricBlockers","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":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"MaxHits","tag":"MaxHits","type":"*variable","value":"~*req.4"},{"path":"MinHits","tag":"MinHits","type":"*variable","value":"~*req.5"},{"path":"MinSleep","tag":"MinSleep","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"ActionProfileIDs","tag":"ActionProfileIDs","type":"*variable","value":"~*req.8"},{"path":"Async","tag":"Async","type":"*variable","value":"~*req.9"}],"file_name":"Thresholds.csv","flags":null,"type":"*thresholds"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.2"},{"path":"StatID","tag":"StatID","type":"*variable","value":"~*req.3"},{"path":"Metrics","tag":"Metrics","type":"*variable","value":"~*req.4"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.5"},{"path":"QueueLength","tag":"QueueLength","type":"*variable","value":"~*req.6"},{"path":"MinItems","tag":"MinItems","type":"*variable","value":"~*req.7"},{"path":"CorrelationType","tag":"CorrelationType","type":"*variable","value":"~*req.8"},{"path":"Tolerance","tag":"Tolerance","type":"*variable","value":"~*req.9"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.10"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.11"}],"file_name":"Trends.csv","flags":null,"type":"*trends"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.2"},{"path":"StatIDs","tag":"StatIDs","type":"*variable","value":"~*req.3"},{"path":"MetricIDs","tag":"MetricIDs","type":"*variable","value":"~*req.4"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.5"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.6"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.7"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.8"}],"file_name":"Rankings.csv","flags":null,"type":"*rankings"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.5"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.6"},{"new_branch":true,"path":"Routes.ID","tag":"RouteID","type":"*variable","value":"~*req.7"},{"path":"Routes.FilterIDs","tag":"RouteFilterIDs","type":"*variable","value":"~*req.8"},{"path":"Routes.AccountIDs","tag":"RouteAccountIDs","type":"*variable","value":"~*req.9"},{"path":"Routes.RateProfileIDs","tag":"RouteRateProfileIDs","type":"*variable","value":"~*req.10"},{"path":"Routes.ResourceIDs","tag":"RouteResourceIDs","type":"*variable","value":"~*req.11"},{"path":"Routes.StatIDs","tag":"RouteStatIDs","type":"*variable","value":"~*req.12"},{"path":"Routes.Weights","tag":"RouteWeights","type":"*variable","value":"~*req.13"},{"path":"Routes.Blockers","tag":"RouteBlockers","type":"*variable","value":"~*req.14"},{"path":"Routes.RouteParameters","tag":"RouteParameters","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":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"RunID","tag":"RunID","type":"*variable","value":"~*req.5"},{"path":"AttributeIDs","tag":"AttributeIDs","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":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"MinCost","tag":"MinCost","type":"*variable","value":"~*req.4"},{"path":"MaxCost","tag":"MaxCost","type":"*variable","value":"~*req.5"},{"path":"MaxCostStrategy","tag":"MaxCostStrategy","type":"*variable","value":"~*req.6"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].FilterIDs","tag":"RateFilterIDs","type":"*variable","value":"~*req.8"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].ActivationTimes","tag":"RateActivationTimes","type":"*variable","value":"~*req.9"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].Weights","tag":"RateWeights","type":"*variable","value":"~*req.10"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].Blocker","tag":"RateBlocker","type":"*variable","value":"~*req.11"},{"filters":["*notempty:~*req.7:"],"new_branch":true,"path":"Rates[\u003c~*req.7\u003e].IntervalRates.IntervalStart","tag":"RateIntervalStart","type":"*variable","value":"~*req.12"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.FixedFee","tag":"RateFixedFee","type":"*variable","value":"~*req.13"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.RecurrentFee","tag":"RateRecurrentFee","type":"*variable","value":"~*req.14"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.Unit","tag":"RateUnit","type":"*variable","value":"~*req.15"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.Increment","tag":"RateIncrement","type":"*variable","value":"~*req.16"}],"file_name":"Rates.csv","flags":null,"type":"*rate_profiles"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.5"},{"path":"Targets[\u003c~*req.6\u003e]","tag":"TargetIDs","type":"*variable","value":"~*req.7"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].FilterIDs","tag":"ActionFilterIDs","type":"*variable","value":"~*req.9"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].TTL","tag":"ActionTTL","type":"*variable","value":"~*req.10"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].Type","tag":"ActionType","type":"*variable","value":"~*req.11"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].Opts","tag":"ActionOpts","type":"*variable","value":"~*req.12"},{"filters":["*notempty:~*req.8:"],"new_branch":true,"path":"Actions[\u003c~*req.8\u003e].Diktats.Path","tag":"ActionPath","type":"*variable","value":"~*req.13"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].Diktats.Value","tag":"ActionValue","type":"*variable","value":"~*req.14"}],"file_name":"Actions.csv","flags":null,"type":"*action_profiles"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"Opts","tag":"Opts","type":"*variable","value":"~*req.5"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].FilterIDs","tag":"BalanceFilterIDs","type":"*variable","value":"~*req.7"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Weights","tag":"BalanceWeights","type":"*variable","value":"~*req.8"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Blockers","tag":"BalanceBlockers","type":"*variable","value":"~*req.9"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Type","tag":"BalanceType","type":"*variable","value":"~*req.10"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Units","tag":"BalanceUnits","type":"*variable","value":"~*req.11"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].UnitFactors","tag":"BalanceUnitFactors","type":"*variable","value":"~*req.12"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Opts","tag":"BalanceOpts","type":"*variable","value":"~*req.13"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].CostIncrements","tag":"BalanceCostIncrements","type":"*variable","value":"~*req.14"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].AttributeIDs","tag":"BalanceAttributeIDs","type":"*variable","value":"~*req.15"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].RateProfileIDs","tag":"BalanceRateProfileIDs","type":"*variable","value":"~*req.16"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.17"}],"file_name":"Accounts.csv","flags":null,"type":"*accounts"}],"enabled":false,"field_separator":",","id":"*default","lockfile_path":".cgr.lck","opts":{"*cache":"","*forceLock":false,"*stopOnError":false,"*withIndex":true},"run_delay":"0","tenant":"","tp_in_dir":"/var/spool/cgrates/loader/in","tp_out_dir":"/var/spool/cgrates/loader/out"}],"logger":{"efs_conns":["*internal"],"level":6,"opts":{"failed_posts_dir":"/var/spool/cgrates/failed_posts","kafka_attempts":1,"kafka_conn":"","kafka_topic":""},"type":"*syslog"},"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisPoolPipelineLimit":0,"redisPoolPipelineWindow":"150µs","redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"out_datadb_password":"","out_datadb_port":"6379","out_datadb_type":"*redis","out_datadb_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"]},"rankings":{"ees_conns":[],"ees_exporter_ids":null,"enabled":false,"scheduled_ids":{},"stats_conns":[],"store_interval":"","thresholds_conns":[]},"rates":{"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*intervalStart":[{"FilterIDs":null,"Tenant":""}],"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*startTime":[{"FilterIDs":null,"Tenant":""}],"*usage":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"rate_exists_indexed_fields":[],"rate_indexed_selects":true,"rate_nested_fields":false,"rate_notexists_indexed_fields":[],"rate_prefix_indexed_fields":[],"rate_suffix_indexed_fields":[],"suffix_indexed_fields":[],"verbosity":1000},"registrarc":{"rpc":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]}},"resources":{"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*units":[{"FilterIDs":null,"Tenant":""}],"*usageID":[{"FilterIDs":null,"Tenant":""}],"*usageTTL":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[],"thresholds_conns":[]},"routes":{"accounts_conns":[],"attributes_conns":[],"default_ratio":1,"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*context":[{"FilterIDs":null,"Tenant":""}],"*ignoreErrors":[{"FilterIDs":null,"Tenant":""}],"*limit":[],"*maxCost":[{"Tenant":"","Value":""}],"*maxItems":[],"*offset":[],"*profileCount":[{"FilterIDs":null,"Tenant":""}],"*usage":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"rates_conns":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"rpc_conns":{"*bijson_localhost":{"conns":[{"address":"127.0.0.1:2014","transport":"*birpc_json"}],"poolSize":0,"strategy":"*first"},"*birpc_internal":{"conns":[{"address":"*birpc_internal","transport":""}],"poolSize":0,"strategy":"*first"},"*internal":{"conns":[{"address":"*internal","transport":""}],"poolSize":0,"strategy":"*first"},"*localhost":{"conns":[{"address":"127.0.0.1:2012","transport":"*json"}],"poolSize":0,"strategy":"*first"}},"sentrypeer":{"audience":"https://sentrypeer.com/api","client_id":"","client_secret":"","grant_type":"client_credentials","ips_url":"https://sentrypeer.com/api/ip-addresses","numbers_url":"https://sentrypeer.com/api/phone-numbers","token_url":"https://authz.sentrypeer.com/oauth/token"},"sessions":{"accounts_conns":[],"actions_conns":[],"alterable_fields":[],"attributes_conns":[],"cdrs_conns":[],"channel_sync_interval":"0","chargers_conns":[],"client_protocol":1,"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","opts":{"*accounts":[{"FilterIDs":null,"Tenant":""}],"*accountsForceUsage":[],"*attributes":[{"FilterIDs":null,"Tenant":""}],"*attributesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*blockerError":[{"FilterIDs":null,"Tenant":""}],"*cdrs":[{"FilterIDs":null,"Tenant":""}],"*cdrsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*chargeable":[{"FilterIDs":null,"Tenant":""}],"*chargers":[{"FilterIDs":null,"Tenant":""}],"*debitInterval":[{"FilterIDs":null,"Tenant":""}],"*forceUsage":[],"*initiate":[{"FilterIDs":null,"Tenant":""}],"*maxUsage":[{"FilterIDs":null,"Tenant":""}],"*message":[{"FilterIDs":null,"Tenant":""}],"*originID":[],"*resources":[{"FilterIDs":null,"Tenant":""}],"*resourcesAllocate":[{"FilterIDs":null,"Tenant":""}],"*resourcesAuthorize":[{"FilterIDs":null,"Tenant":""}],"*resourcesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*resourcesRelease":[{"FilterIDs":null,"Tenant":""}],"*routes":[{"FilterIDs":null,"Tenant":""}],"*routesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*stats":[{"FilterIDs":null,"Tenant":""}],"*statsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*terminate":[{"FilterIDs":null,"Tenant":""}],"*thresholds":[{"FilterIDs":null,"Tenant":""}],"*thresholdsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*ttl":[{"FilterIDs":null,"Tenant":""}],"*ttlLastUsage":[],"*ttlLastUsed":[],"*ttlMaxDelay":[{"FilterIDs":null,"Tenant":""}],"*ttlUsage":[],"*update":[{"FilterIDs":null,"Tenant":""}]},"rates_conns":[],"replication_conns":[],"resources_conns":[],"routes_conns":[],"session_indexes":[],"stats_conns":[],"stir":{"allowed_attest":["*any"],"default_attest":"A","payload_maxduration":"-1","privatekey_path":"","publickey_path":""},"store_session_costs":false,"terminate_attempts":5,"thresholds_conns":[]},"sip_agent":{"enabled":false,"listen":"127.0.0.1:5060","listen_net":"udp","request_processors":[],"retransmission_timer":"1s","sessions_conns":["*internal"],"timezone":""},"stats":{"ees_conns":[],"ees_exporter_ids":null,"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*prometheusStatIDs":[],"*roundingDecimals":[]},"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}},"opts":{"mongoConnScheme":"mongodb","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":"~*opts.*originID","customer_number":"~*req.Subject","include_local_cost":false,"orig_number":"~*req.Subject","p2pplus4":"","p2pzipcode":"","plus4":"","regulatory_code":"03","response_group":"03","response_type":"D4","return_file_code":"0","sales_type_code":"R","tax_exemption_code_list":"","tax_included":"0","tax_situs_rule":"04","term_number":"~*req.Destination","timezone":"UTC","trans_type_code":"010101","unit_type":"00","units":"1","url":"","validation_key":"","zipcode":""},"templates":{"*asr":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"}],"*cca":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"path":"*rep.Result-Code","tag":"ResultCode","type":"*constant","value":"2001"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"},{"mandatory":true,"path":"*rep.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"mandatory":true,"path":"*rep.CC-Request-Type","tag":"CCRequestType","type":"*variable","value":"~*req.CC-Request-Type"},{"mandatory":true,"path":"*rep.CC-Request-Number","tag":"CCRequestNumber","type":"*variable","value":"~*req.CC-Request-Number"}],"*cdrLog":[{"mandatory":true,"path":"*cdr.ToR","tag":"ToR","type":"*variable","value":"~*req.BalanceType"},{"mandatory":true,"path":"*cdr.OriginHost","tag":"OriginHost","type":"*constant","value":"127.0.0.1"},{"mandatory":true,"path":"*cdr.RequestType","tag":"RequestType","type":"*constant","value":"*none"},{"mandatory":true,"path":"*cdr.Tenant","tag":"Tenant","type":"*variable","value":"~*req.Tenant"},{"mandatory":true,"path":"*cdr.Account","tag":"Account","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Subject","tag":"Subject","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Cost","tag":"Cost","type":"*variable","value":"~*req.Cost"},{"mandatory":true,"path":"*cdr.Source","tag":"Source","type":"*constant","value":"*cdrLog"},{"mandatory":true,"path":"*cdr.Usage","tag":"Usage","type":"*constant","value":"1"},{"mandatory":true,"path":"*cdr.RunID","tag":"RunID","type":"*variable","value":"~*req.ActionType"},{"mandatory":true,"path":"*cdr.SetupTime","tag":"SetupTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.AnswerTime","tag":"AnswerTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.PreRated","tag":"PreRated","type":"*constant","value":"true"}],"*err":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"}],"*errSip":[{"mandatory":true,"path":"*rep.Request","tag":"Request","type":"*constant","value":"SIP/2.0 500 Internal Server Error"}],"*rar":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"path":"*diamreq.Re-Auth-Request-Type","tag":"ReAuthRequestType","type":"*constant","value":"0"}]},"thresholds":{"actions_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[]},"tls":{"ca_certificate":"","client_certificate":"","client_key":"","server_certificate":"","server_key":"","server_name":"","server_policy":4},"tpes":{"enabled":false},"trends":{"ees_conns":[],"ees_exporter_ids":null,"enabled":false,"scheduled_ids":{},"stats_conns":[],"store_interval":"","store_uncompressed_limit":0,"thresholds_conns":[]}}` cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSON) if err != nil { diff --git a/config/sessionscfg.go b/config/sessionscfg.go index d3773df69..c3f870022 100644 --- a/config/sessionscfg.go +++ b/config/sessionscfg.go @@ -90,7 +90,7 @@ type SessionsOpts struct { DebitInterval []*DynamicDurationOpt TTLMaxDelay []*DynamicDurationOpt TTLUsage []*DynamicDurationPointerOpt - SessionsOriginID []*DynamicStringOpt + OriginID []*DynamicStringOpt AccountsForceUsage []*DynamicBoolOpt } @@ -303,13 +303,13 @@ func (sesOpts *SessionsOpts) loadFromJSONCfg(jsnCfg *SessionsOptsJson) (err erro } sesOpts.TTLUsage = append(usage, sesOpts.TTLUsage...) } - if jsnCfg.SessionsOriginID != nil { - var sessionsOriginID []*DynamicStringOpt - sessionsOriginID, err = InterfaceToDynamicStringOpts(jsnCfg.SessionsOriginID) + if jsnCfg.OriginID != nil { + var originID []*DynamicStringOpt + originID, err = InterfaceToDynamicStringOpts(jsnCfg.OriginID) if err != nil { return } - sesOpts.SessionsOriginID = append(sessionsOriginID, sesOpts.SessionsOriginID...) + sesOpts.OriginID = append(originID, sesOpts.OriginID...) } if jsnCfg.AccountsForceUsage != nil { var accountsForceUsage []*DynamicBoolOpt @@ -465,7 +465,7 @@ func (scfg SessionSCfg) AsMapInterface(string) any { utils.MetaTTLLastUsedCfg: scfg.Opts.TTLLastUsed, utils.MetaTTLMaxDelayCfg: scfg.Opts.TTLMaxDelay, utils.MetaTTLUsageCfg: scfg.Opts.TTLUsage, - utils.MetaSessionsOriginID: scfg.Opts.SessionsOriginID, + utils.MetaOriginID: scfg.Opts.OriginID, utils.MetaAccountsForceUsage: scfg.Opts.AccountsForceUsage, } mp := map[string]any{ @@ -652,8 +652,8 @@ func (sesOpts *SessionsOpts) Clone() (cln *SessionsOpts) { usg = CloneDynamicDurationPointerOpt(sesOpts.TTLUsage) } var sID []*DynamicStringOpt - if sesOpts.SessionsOriginID != nil { - sID = CloneDynamicStringOpt(sesOpts.SessionsOriginID) + if sesOpts.OriginID != nil { + sID = CloneDynamicStringOpt(sesOpts.OriginID) } var accForceUsage []*DynamicBoolOpt if sesOpts.AccountsForceUsage != nil { @@ -691,7 +691,7 @@ func (sesOpts *SessionsOpts) Clone() (cln *SessionsOpts) { TTLLastUsed: lastUsed, TTLMaxDelay: maxDelay, TTLUsage: usg, - SessionsOriginID: sID, + OriginID: sID, AccountsForceUsage: accForceUsage, } } @@ -879,7 +879,7 @@ type SessionsOptsJson struct { TTLLastUsed []*DynamicInterfaceOpt `json:"*ttlLastUsed"` TTLMaxDelay []*DynamicInterfaceOpt `json:"*ttlMaxDelay"` TTLUsage []*DynamicInterfaceOpt `json:"*ttlUsage"` - SessionsOriginID []*DynamicInterfaceOpt `json:"*sessionsOriginID"` + OriginID []*DynamicInterfaceOpt `json:"*originID"` AccountsForceUsage []*DynamicInterfaceOpt `json:"*accountsForceUsage"` } @@ -1008,8 +1008,8 @@ func diffSessionsOptsJsonCfg(d *SessionsOptsJson, v1, v2 *SessionsOpts) *Session if !DynamicDurationPointerOptEqual(v1.TTLUsage, v2.TTLUsage) { d.TTLUsage = DurationPointerToIfaceDynamicOpts(v2.TTLUsage) } - if !DynamicStringOptEqual(v1.SessionsOriginID, v2.SessionsOriginID) { - d.SessionsOriginID = DynamicStringToInterfaceOpts(v2.SessionsOriginID) + if !DynamicStringOptEqual(v1.OriginID, v2.OriginID) { + d.OriginID = DynamicStringToInterfaceOpts(v2.OriginID) } if !DynamicBoolOptEqual(v1.AccountsForceUsage, v2.AccountsForceUsage) { d.AccountsForceUsage = BoolToIfaceDynamicOpts(v2.AccountsForceUsage) diff --git a/config/sessionscfg_test.go b/config/sessionscfg_test.go index fbd7441a8..6193fa5cb 100644 --- a/config/sessionscfg_test.go +++ b/config/sessionscfg_test.go @@ -172,7 +172,7 @@ func TestSessionSCfgloadFromJsonCfgCase1(t *testing.T) { TTLLastUsed: []*DynamicDurationPointerOpt{}, TTLMaxDelay: []*DynamicDurationOpt{{value: SessionsTTLMaxDelayDftOpt}}, TTLUsage: []*DynamicDurationPointerOpt{}, - SessionsOriginID: []*DynamicStringOpt{}, + OriginID: []*DynamicStringOpt{}, AccountsForceUsage: []*DynamicBoolOpt{}, }, } @@ -395,7 +395,7 @@ func TestSessionSCfgloadFromJsonCfgCase10(t *testing.T) { Chargeable: []*DynamicBoolOpt{{value: SessionsChargeableDftOpt}}, DebitInterval: []*DynamicDurationOpt{{value: SessionsDebitIntervalDftOpt}}, ForceUsage: []*DynamicBoolOpt{}, - SessionsOriginID: []*DynamicStringOpt{}, + OriginID: []*DynamicStringOpt{}, AccountsForceUsage: []*DynamicBoolOpt{}, TTLLastUsage: []*DynamicDurationPointerOpt{ { @@ -558,7 +558,7 @@ func TestSessionSCfgAsMapInterfaceCase1(t *testing.T) { utils.MetaTTLMaxDelayCfg: []*DynamicDurationOpt{{value: SessionsTTLMaxDelayDftOpt}}, utils.MetaTTLUsageCfg: []*DynamicDurationPointerOpt{}, utils.MetaForceUsageCfg: []*DynamicBoolOpt{}, - utils.MetaSessionsOriginID: []*DynamicStringOpt{}, + utils.MetaOriginID: []*DynamicStringOpt{}, utils.MetaAccountsForceUsage: []*DynamicBoolOpt{}, }, } @@ -691,7 +691,7 @@ func TestSessionSCfgAsMapInterfaceCase2(t *testing.T) { utils.MetaTTLMaxDelayCfg: []*DynamicDurationOpt{{value: SessionsTTLMaxDelayDftOpt}}, utils.MetaTTLUsageCfg: []*DynamicDurationPointerOpt{}, utils.MetaForceUsageCfg: []*DynamicBoolOpt{}, - utils.MetaSessionsOriginID: []*DynamicStringOpt{}, + utils.MetaOriginID: []*DynamicStringOpt{}, utils.MetaAccountsForceUsage: []*DynamicBoolOpt{}, }, } diff --git a/engine/attributes.go b/engine/attributes.go index d52b7221c..14d67a04c 100644 --- a/engine/attributes.go +++ b/engine/attributes.go @@ -153,7 +153,7 @@ func (attrReply *AttrSProcessEventReply) Digest() (rplyDigest string) { func (alS *AttributeS) processEvent(ctx *context.Context, tnt string, args *utils.CGREvent, evNm utils.MapStorage, dynDP utils.DataProvider, lastID string, processedPrfNo map[string]int, profileRuns int) (rply *AttrSProcessEventReply, err error) { var attrIDs []string - if attrIDs, err = GetStringSliceOpts(ctx, args.Tenant, args, alS.fltrS, alS.cfg.AttributeSCfg().Opts.ProfileIDs, + if attrIDs, err = GetStringSliceOpts(ctx, args.Tenant, args.AsDataProvider(), alS.fltrS, alS.cfg.AttributeSCfg().Opts.ProfileIDs, config.AttributesProfileIDsDftOpt, utils.OptsAttributesProfileIDs); err != nil { return } @@ -247,11 +247,6 @@ func (alS *AttributeS) V1GetAttributeForEvent(ctx *context.Context, args *utils. if tnt == utils.EmptyString { tnt = alS.cfg.GeneralCfg().DefaultTenant } - var attrIDs []string - if attrIDs, err = GetStringSliceOpts(ctx, args.Tenant, args, alS.fltrS, alS.cfg.AttributeSCfg().Opts.ProfileIDs, - config.AttributesProfileIDsDftOpt, utils.OptsAttributesProfileIDs); err != nil { - return - } evNM := utils.MapStorage{ utils.MetaReq: args.Event, utils.MetaOpts: args.APIOpts, @@ -259,6 +254,11 @@ func (alS *AttributeS) V1GetAttributeForEvent(ctx *context.Context, args *utils. utils.OptsAttributesProcessRuns: 0, }, } + var attrIDs []string + if attrIDs, err = GetStringSliceOpts(ctx, args.Tenant, evNM, alS.fltrS, alS.cfg.AttributeSCfg().Opts.ProfileIDs, + config.AttributesProfileIDsDftOpt, utils.OptsAttributesProfileIDs); err != nil { + return + } var ignFilters bool if ignFilters, err = GetBoolOpts(ctx, tnt, evNM, alS.fltrS, alS.cfg.AttributeSCfg().Opts.ProfileIgnoreFilters, utils.MetaProfileIgnoreFilters); err != nil { @@ -285,13 +285,13 @@ func (alS *AttributeS) V1ProcessEvent(ctx *context.Context, args *utils.CGREvent } var processRuns int - if processRuns, err = GetIntOpts(ctx, tnt, args, alS.fltrS, alS.cfg.AttributeSCfg().Opts.ProcessRuns, + if processRuns, err = GetIntOpts(ctx, tnt, args.AsDataProvider(), alS.fltrS, alS.cfg.AttributeSCfg().Opts.ProcessRuns, utils.OptsAttributesProcessRuns); err != nil { return } var profileRuns int - if profileRuns, err = GetIntOpts(ctx, tnt, args, alS.fltrS, alS.cfg.AttributeSCfg().Opts.ProfileRuns, + if profileRuns, err = GetIntOpts(ctx, tnt, args.AsDataProvider(), alS.fltrS, alS.cfg.AttributeSCfg().Opts.ProfileRuns, utils.OptsAttributesProfileRuns); err != nil { return } diff --git a/engine/libdynopts.go b/engine/libdynopts.go index 9e58afd20..e0af89df3 100644 --- a/engine/libdynopts.go +++ b/engine/libdynopts.go @@ -31,22 +31,29 @@ import ( // GetFloat64Opts checks the specified option names in order among the keys in APIOpts returning the first value it finds as float64, otherwise it // returns the config option if at least one filter passes or the default value if none of them do -func GetFloat64Opts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS *FilterS, dynOpts []*config.DynamicFloat64Opt, +func GetFloat64Opts(ctx *context.Context, tnt string, dP utils.DataProvider, fS *FilterS, dynOpts []*config.DynamicFloat64Opt, optNames ...string) (cfgOpt float64, err error) { + values, err := dP.FieldAsInterface([]string{utils.MetaOpts}) + if err != nil { + return 0, err + } + opts, err := ConvertOptsToMapStringAny(values) + if err != nil { + return + } for _, optName := range optNames { - if opt, has := ev.APIOpts[optName]; has { + if opt, has := opts[optName]; has { return utils.IfaceAsFloat64(opt) } } - evDP := ev.AsDataProvider() for _, opt := range dynOpts { // iterate through the options if !slices.Contains([]string{utils.EmptyString, utils.MetaAny, tnt}, opt.Tenant) { continue } - if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, evDP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does + if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, dP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does return 0, err } else if pass { - return opt.Value(evDP) + return opt.Value(dP) } } return @@ -54,22 +61,29 @@ func GetFloat64Opts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS *Fi // GetDurationOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as time.Duration, otherwise it // returns the config option if at least one filter passes or the default value if none of them do -func GetDurationOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS *FilterS, dynOpts []*config.DynamicDurationOpt, +func GetDurationOpts(ctx *context.Context, tnt string, dP utils.DataProvider, fS *FilterS, dynOpts []*config.DynamicDurationOpt, optNames ...string) (cfgOpt time.Duration, err error) { + values, err := dP.FieldAsInterface([]string{utils.MetaOpts}) + if err != nil { + return 0, err + } + opts, err := ConvertOptsToMapStringAny(values) + if err != nil { + return + } for _, optName := range optNames { - if opt, has := ev.APIOpts[optName]; has { + if opt, has := opts[optName]; has { return utils.IfaceAsDuration(opt) } } - evDP := ev.AsDataProvider() for _, opt := range dynOpts { // iterate through the options if !slices.Contains([]string{utils.EmptyString, utils.MetaAny, tnt}, opt.Tenant) { continue } - if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, evDP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does + if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, dP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does return 0, err } else if pass { - return opt.Value(evDP) + return opt.Value(dP) } } return @@ -77,22 +91,29 @@ func GetDurationOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS *F // GetStringOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as string, otherwise it // returns the config option if at least one filter passes or the default value if none of them do -func GetStringOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS *FilterS, dynOpts []*config.DynamicStringOpt, +func GetStringOpts(ctx *context.Context, tnt string, dP utils.DataProvider, fS *FilterS, dynOpts []*config.DynamicStringOpt, optNames ...string) (cfgOpt string, err error) { + values, err := dP.FieldAsInterface([]string{utils.MetaOpts}) + if err != nil { + return "", err + } + opts, err := ConvertOptsToMapStringAny(values) + if err != nil { + return + } for _, optName := range optNames { - if opt, has := ev.APIOpts[optName]; has { + if opt, has := opts[optName]; has { return utils.IfaceAsString(opt), nil } } - evDP := ev.AsDataProvider() for _, opt := range dynOpts { // iterate through the options if !slices.Contains([]string{utils.EmptyString, utils.MetaAny, tnt}, opt.Tenant) { continue } - if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, evDP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does + if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, dP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does return utils.EmptyString, err } else if pass { - return opt.Value(evDP) + return opt.Value(dP) } } return @@ -100,24 +121,31 @@ func GetStringOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS *Fil // GetTimeOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as time.Time, otherwise it // returns the config option if at least one filter passes or the default value if none of them do -func GetTimeOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS *FilterS, dynOpts []*config.DynamicStringOpt, +func GetTimeOpts(ctx *context.Context, tnt string, dP utils.DataProvider, fS *FilterS, dynOpts []*config.DynamicStringOpt, tmz string, optNames ...string) (_ time.Time, err error) { + values, err := dP.FieldAsInterface([]string{utils.MetaOpts}) + if err != nil { + return + } + opts, err := ConvertOptsToMapStringAny(values) + if err != nil { + return + } for _, optName := range optNames { - if opt, has := ev.APIOpts[optName]; has { + if opt, has := opts[optName]; has { return utils.IfaceAsTime(opt, tmz) } } - evDP := ev.AsDataProvider() for _, opt := range dynOpts { // iterate through the options if !slices.Contains([]string{utils.EmptyString, utils.MetaAny, tnt}, opt.Tenant) { continue } var pass bool - if pass, err = fS.Pass(ctx, tnt, opt.FilterIDs, evDP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does + if pass, err = fS.Pass(ctx, tnt, opt.FilterIDs, dP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does return } else if pass { var dur string - dur, err = opt.Value(evDP) + dur, err = opt.Value(dP) if err != nil { return } @@ -129,19 +157,26 @@ func GetTimeOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS *Filte // GetStringSliceOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as []string, otherwise it // returns the config option if at least one filter passes or the default value if none of them do -func GetStringSliceOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS *FilterS, dynOpts []*config.DynamicStringSliceOpt, +func GetStringSliceOpts(ctx *context.Context, tnt string, dP utils.DataProvider, fS *FilterS, dynOpts []*config.DynamicStringSliceOpt, dftOpt []string, optNames ...string) (cfgOpt []string, err error) { + values, err := dP.FieldAsInterface([]string{utils.MetaOpts}) + if err != nil { + return nil, err + } + opts, err := ConvertOptsToMapStringAny(values) + if err != nil { + return + } for _, optName := range optNames { - if opt, has := ev.APIOpts[optName]; has { + if opt, has := opts[optName]; has { return utils.IfaceAsStringSlice(opt) } } - evDP := ev.AsDataProvider() for _, opt := range dynOpts { // iterate through the options if !slices.Contains([]string{utils.EmptyString, utils.MetaAny, tnt}, opt.Tenant) { continue } - if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, evDP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does + if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, dP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does return nil, err } else if pass { return opt.Values, nil @@ -152,26 +187,29 @@ func GetStringSliceOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS // GetIntOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as int, otherwise it // returns the config option if at least one filter passes or the default value if none of them do -func GetIntOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS *FilterS, dynOpts []*config.DynamicIntOpt, +func GetIntOpts(ctx *context.Context, tnt string, dP utils.DataProvider, fS *FilterS, dynOpts []*config.DynamicIntOpt, optNames ...string) (cfgOpt int, err error) { + values, err := dP.FieldAsInterface([]string{utils.MetaOpts}) + if err != nil { + return 0, err + } + opts, err := ConvertOptsToMapStringAny(values) + if err != nil { + return + } for _, optName := range optNames { - if opt, has := ev.APIOpts[optName]; has { - var value int64 - if value, err = utils.IfaceAsTInt64(opt); err != nil { - return 0, err - } - return int(value), nil + if opt, has := opts[optName]; has { + return utils.IfaceAsInt(opt) } } - evDP := ev.AsDataProvider() for _, opt := range dynOpts { // iterate through the options if !slices.Contains([]string{utils.EmptyString, utils.MetaAny, tnt}, opt.Tenant) { continue } - if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, evDP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does + if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, dP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does return 0, err } else if pass { - return opt.Value(evDP) + return opt.Value(dP) } } return @@ -209,22 +247,29 @@ func GetBoolOpts(ctx *context.Context, tnt string, dP utils.DataProvider, fS *Fi // GetDecimalBigOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as *decimal.Big, otherwise it // returns the config option if at least one filter passes or the default value if none of them do -func GetDecimalBigOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS *FilterS, dynOpts []*config.DynamicDecimalOpt, +func GetDecimalBigOpts(ctx *context.Context, tnt string, dP utils.DataProvider, fS *FilterS, dynOpts []*config.DynamicDecimalOpt, optNames ...string) (cfgOpt *decimal.Big, err error) { + values, err := dP.FieldAsInterface([]string{utils.MetaOpts}) + if err != nil { + return nil, err + } + opts, err := ConvertOptsToMapStringAny(values) + if err != nil { + return + } for _, optName := range optNames { - if opt, has := ev.APIOpts[optName]; has { + if opt, has := opts[optName]; has { return utils.IfaceAsBig(opt) } } - evDP := ev.AsDataProvider() for _, opt := range dynOpts { // iterate through the options if !slices.Contains([]string{utils.EmptyString, utils.MetaAny, tnt}, opt.Tenant) { continue } - if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, evDP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does + if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, dP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does return nil, err } else if pass { - return opt.Value(evDP) + return opt.Value(dP) } } return @@ -232,19 +277,26 @@ func GetDecimalBigOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS // GetInterfaceOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as any, otherwise it // returns the config option if at least one filter passes or the default value if none of them do -func GetInterfaceOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS *FilterS, dynOpts []*config.DynamicInterfaceOpt, +func GetInterfaceOpts(ctx *context.Context, tnt string, dP utils.DataProvider, fS *FilterS, dynOpts []*config.DynamicInterfaceOpt, optNames ...string) (cfgOpt any, err error) { + values, err := dP.FieldAsInterface([]string{utils.MetaOpts}) + if err != nil { + return nil, err + } + opts, err := ConvertOptsToMapStringAny(values) + if err != nil { + return + } for _, optName := range optNames { - if opt, has := ev.APIOpts[optName]; has { + if opt, has := opts[optName]; has { return opt, nil } } - evDP := ev.AsDataProvider() for _, opt := range dynOpts { // iterate through the options if !slices.Contains([]string{utils.EmptyString, utils.MetaAny, tnt}, opt.Tenant) { continue } - if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, evDP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does + if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, dP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does return false, err } else if pass { return opt.Value, nil @@ -255,10 +307,18 @@ func GetInterfaceOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS * // GetIntPointerOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as *int, otherwise it // returns the config option if at least one filter passes or NOT_FOUND if none of them do -func GetIntPointerOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS *FilterS, dynOpts []*config.DynamicIntPointerOpt, +func GetIntPointerOpts(ctx *context.Context, tnt string, dP utils.DataProvider, fS *FilterS, dynOpts []*config.DynamicIntPointerOpt, optNames ...string) (cfgOpt *int, err error) { + values, err := dP.FieldAsInterface([]string{utils.MetaOpts}) + if err != nil { + return nil, err + } + opts, err := ConvertOptsToMapStringAny(values) + if err != nil { + return + } for _, optName := range optNames { - if opt, has := ev.APIOpts[optName]; has { + if opt, has := opts[optName]; has { var value int64 if value, err = utils.IfaceAsTInt64(opt); err != nil { return nil, err @@ -266,15 +326,14 @@ func GetIntPointerOpts(ctx *context.Context, tnt string, ev *utils.CGREvent, fS return utils.IntPointer(int(value)), nil } } - evDP := ev.AsDataProvider() for _, opt := range dynOpts { // iterate through the options if !slices.Contains([]string{utils.EmptyString, utils.MetaAny, tnt}, opt.Tenant) { continue } - if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, evDP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does + if pass, err := fS.Pass(ctx, tnt, opt.FilterIDs, dP); err != nil { // check if the filter is passing for the DataProvider and return the option if it does return nil, err } else if pass { - return opt.Value(evDP) + return opt.Value(dP) } } return nil, nil diff --git a/engine/libdynopts_test.go b/engine/libdynopts_test.go index b04773cad..32620475b 100644 --- a/engine/libdynopts_test.go +++ b/engine/libdynopts_test.go @@ -52,7 +52,7 @@ func TestLibFiltersGetFloat64OptsReturnConfigOpt(t *testing.T) { } expected := 5. - if rcv, err := GetFloat64Opts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetFloat64Opts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsResourcesUnits); err != nil { t.Error(err) } else if rcv != expected { @@ -80,7 +80,7 @@ func TestLibFiltersGetFloat64OptsFilterCheckErr(t *testing.T) { } experr := `inline parse error for string: <*string.invalid:filter>` - if _, err := GetFloat64Opts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if _, err := GetFloat64Opts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsResourcesUnits); err == nil || err.Error() != experr { t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err) @@ -106,7 +106,7 @@ func TestLibFiltersGetFloat64OptsReturnDefaultOpt(t *testing.T) { config.NewDynamicFloat64Opt(nil, utils.EmptyString, config.ResourcesUnitsDftOpt, nil), } - if rcv, err := GetFloat64Opts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetFloat64Opts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsResourcesUnits); err != nil { t.Error(err) } else if rcv != config.ResourcesUnitsDftOpt { @@ -136,7 +136,7 @@ func TestLibFiltersGetFloat64OptsReturnOptFromAPIOpts(t *testing.T) { } expected := 6. - if rcv, err := GetFloat64Opts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetFloat64Opts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, "nonExistingAPIOpt", utils.OptsResourcesUnits); err != nil { t.Error(err) } else if rcv != expected { @@ -167,7 +167,7 @@ func TestLibFiltersGetStringOptsReturnConfigOpt(t *testing.T) { } expected := "value3" - if rcv, err := GetStringOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetStringOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, config.ResourcesUsageIDDftOpt, utils.OptsResourcesUsageID); err != nil { t.Error(err) } else if rcv != expected { @@ -194,7 +194,7 @@ func TestLibFiltersGetStringOptsFilterCheckErr(t *testing.T) { } experr := `inline parse error for string: <*string.invalid:filter>` - if _, err := GetStringOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if _, err := GetStringOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, config.ResourcesUsageIDDftOpt, utils.OptsResourcesUsageID); err == nil || err.Error() != experr { t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err) @@ -219,7 +219,7 @@ func TestLibFiltersGetStringOptsReturnDefaultOpt(t *testing.T) { config.NewDynamicStringOpt([]string{"*string:~*req.Account:1002"}, "cgrates.org", "value2", nil), } - if rcv, err := GetStringOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetStringOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, config.ResourcesUsageIDDftOpt, utils.OptsResourcesUsageID); err != nil { t.Error(err) } else if rcv != config.ResourcesUsageIDDftOpt { @@ -249,7 +249,7 @@ func TestLibFiltersGetStringOptsReturnOptFromAPIOpts(t *testing.T) { } expected := "value4" - if rcv, err := GetStringOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetStringOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, config.ResourcesUsageIDDftOpt, "nonExistingAPIOpt", utils.OptsResourcesUsageID); err != nil { t.Error(err) } else if rcv != expected { @@ -279,7 +279,7 @@ func TestLibFiltersGetDurationOptsReturnConfigOpt(t *testing.T) { } expected := time.Minute - if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsResourcesUsageTTL); err != nil { t.Error(err) } else if rcv != expected { @@ -306,7 +306,7 @@ func TestLibFiltersGetDurationOptsFilterCheckErr(t *testing.T) { } experr := `inline parse error for string: <*string.invalid:filter>` - if _, err := GetDurationOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if _, err := GetDurationOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsResourcesUsageTTL); err == nil || err.Error() != experr { t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err) @@ -332,7 +332,7 @@ func TestLibFiltersGetDurationOptsReturnDefaultOpt(t *testing.T) { config.NewDynamicDurationOpt(nil, "", config.ResourcesUsageTTLDftOpt, nil), } - if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsResourcesUsageTTL); err != nil { t.Error(err) } else if rcv != config.ResourcesUsageTTLDftOpt { @@ -362,7 +362,7 @@ func TestLibFiltersGetDurationOptsReturnOptFromAPIOpts(t *testing.T) { } expected := time.Hour - if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, "nonExistingAPIOpt", utils.OptsResourcesUsageTTL); err != nil { t.Error(err) } else if rcv != expected { @@ -392,7 +392,7 @@ func TestLibFiltersGetIntOptsReturnConfigOpt(t *testing.T) { } expected := 5 - if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsAttributesProcessRuns); err != nil { t.Error(err) } else if rcv != expected { @@ -419,7 +419,7 @@ func TestLibFiltersGetIntOptsFilterCheckErr(t *testing.T) { } experr := `inline parse error for string: <*string.invalid:filter>` - if _, err := GetIntOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if _, err := GetIntOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsAttributesProcessRuns); err == nil || err.Error() != experr { t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err) @@ -445,7 +445,7 @@ func TestLibFiltersGetIntOptsReturnDefaultOpt(t *testing.T) { config.NewDynamicIntOpt(nil, utils.EmptyString, config.AttributesProcessRunsDftOpt, nil), } - if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsAttributesProcessRuns); err != nil { t.Error(err) } else if rcv != config.AttributesProcessRunsDftOpt { @@ -475,7 +475,7 @@ func TestLibFiltersGetIntOptsReturnOptFromAPIOptsOK(t *testing.T) { } expected := 6 - if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, "nonExistingAPIOpt", utils.OptsAttributesProcessRuns); err != nil { t.Error(err) } else if rcv != expected { @@ -505,7 +505,7 @@ func TestLibFiltersGetIntOptsReturnOptFromAPIOptsErr(t *testing.T) { } experr := `cannot convert field: true to int` - if _, err := GetIntOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if _, err := GetIntOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, "nonExistingAPIOpt", utils.OptsAttributesProcessRuns); err == nil || err.Error() != experr { t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err) } @@ -533,7 +533,7 @@ func TestLibFiltersGetTimeOptsReturnConfigOpt(t *testing.T) { } expected := time.Now().AddDate(0, 1, 0) - if rcv, err := GetTimeOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetTimeOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, cfg.GeneralCfg().DefaultTimezone, config.RatesStartTimeDftOpt, utils.OptsRatesStartTime); err != nil { t.Error(err) } else if !dateEqual(rcv, expected) { @@ -560,7 +560,7 @@ func TestLibFiltersGetTimeOptsFilterCheckErr(t *testing.T) { } experr := `inline parse error for string: <*string.invalid:filter>` - if _, err := GetTimeOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if _, err := GetTimeOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, cfg.GeneralCfg().DefaultTimezone, config.RatesStartTimeDftOpt, utils.OptsRatesStartTime); err == nil || err.Error() != experr { t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err) @@ -590,7 +590,7 @@ func TestLibFiltersGetTimeOptsReturnDefaultOpt(t *testing.T) { config.NewDynamicStringOpt(nil, "", config.RatesStartTimeDftOpt, nil), } - if rcv, err := GetTimeOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetTimeOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, cfg.GeneralCfg().DefaultTimezone, config.RatesStartTimeDftOpt, utils.OptsRatesStartTime); err != nil { t.Error(err) } else if !dateEqual(rcv, expected) { @@ -620,7 +620,7 @@ func TestLibFiltersGetTimeOptsReturnOptFromAPIOpts(t *testing.T) { } expected := time.Now().AddDate(1, 0, 0) - if rcv, err := GetTimeOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetTimeOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, cfg.GeneralCfg().DefaultTimezone, config.RatesStartTimeDftOpt, "nonExistingAPIOpt", utils.OptsRatesStartTime); err != nil { t.Error(err) } else if !dateEqual(rcv, expected) { @@ -780,7 +780,7 @@ func TestLibFiltersGetInterfaceOptsReturnConfigOpt(t *testing.T) { } expected := "value3" - if rcv, err := GetInterfaceOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetInterfaceOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, config.RoutesMaxCostDftOpt, utils.OptsRoutesMaxCost); err != nil { t.Error(err) } else if rcv != expected { @@ -811,7 +811,7 @@ func TestLibFiltersGetInterfaceOptsFilterCheckErr(t *testing.T) { } experr := `inline parse error for string: <*string.invalid:filter>` - if _, err := GetInterfaceOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if _, err := GetInterfaceOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, config.RoutesMaxCostDftOpt, utils.OptsRoutesMaxCost); err == nil || err.Error() != experr { t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err) @@ -843,7 +843,7 @@ func TestLibFiltersGetInterfaceOptsReturnDefaultOpt(t *testing.T) { }, } - if rcv, err := GetInterfaceOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetInterfaceOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsRoutesMaxCost); err != nil { t.Error(err) } else if rcv != config.RoutesMaxCostDftOpt { @@ -877,7 +877,7 @@ func TestLibFiltersGetInterfaceOptsReturnOptFromAPIOpts(t *testing.T) { } expected := 4 - if rcv, err := GetInterfaceOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetInterfaceOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, config.RoutesMaxCostDftOpt, "nonExistingAPIOpt", utils.OptsRoutesMaxCost); err != nil { t.Error(err) } else if rcv != expected { @@ -919,7 +919,7 @@ func TestLibFiltersGetStringSliceOptsReturnConfigOpt(t *testing.T) { } expected := []string{"value3"} - if rcv, err := GetStringSliceOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetStringSliceOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, config.AttributesProfileIDsDftOpt, utils.OptsAttributesProfileIDs); err != nil { t.Error(err) } else if !reflect.DeepEqual(rcv, expected) { @@ -950,7 +950,7 @@ func TestLibFiltersGetStringSliceOptsFilterCheckErr(t *testing.T) { } experr := `inline parse error for string: <*string.invalid:filter>` - if _, err := GetStringSliceOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if _, err := GetStringSliceOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, config.AttributesProfileIDsDftOpt, utils.OptsAttributesProfileIDs); err == nil || err.Error() != experr { t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err) @@ -979,7 +979,7 @@ func TestLibFiltersGetStringSliceOptsReturnDefaultOpt(t *testing.T) { }, } - if rcv, err := GetStringSliceOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetStringSliceOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, config.AttributesProfileIDsDftOpt, utils.OptsAttributesProfileIDs); err != nil { t.Error(err) } else if !reflect.DeepEqual(rcv, config.AttributesProfileIDsDftOpt) { @@ -1013,7 +1013,7 @@ func TestLibFiltersGetStringSliceOptsReturnOptFromAPIOpts(t *testing.T) { } expected := []string{"value4"} - if rcv, err := GetStringSliceOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetStringSliceOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, config.AttributesProfileIDsDftOpt, "nonExistingAPIOpt", utils.OptsAttributesProfileIDs); err != nil { t.Error(err) } else if !reflect.DeepEqual(rcv, expected) { @@ -1055,7 +1055,7 @@ func TestLibFiltersGetDecimalBigOptsReturnConfigOpt(t *testing.T) { dynOpts, _ := config.IfaceToDecimalBigDynamicOpts(strOpts) expected := decimal.New(1234, 0) - if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsRatesUsage); err != nil { t.Error(err) } else if rcv.Cmp(expected) != 0 { @@ -1143,7 +1143,7 @@ func TestDynamicDecimalBigOptsDynVal(t *testing.T) { t.Error(err) return } - out, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev, fs, dynOpts, utils.OptsRatesUsage) + out, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fs, dynOpts, utils.OptsRatesUsage) if tt.expErr != nil { if err == nil { t.Error("expected err,received nil") @@ -1243,7 +1243,7 @@ func TestDynamicIntOptsDynVal(t *testing.T) { t.Error(err) return } - out, err := GetIntOpts(context.Background(), "cgrates.org", ev, fs, dynOpts, utils.OptsRatesUsage) + out, err := GetIntOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fs, dynOpts, utils.OptsRatesUsage) if tt.expErr != nil { if err == nil { t.Error("expected err,received nil") @@ -1343,7 +1343,7 @@ func TestDynamicFloat64OptsDynVal(t *testing.T) { t.Error(err) return } - out, err := GetFloat64Opts(context.Background(), "cgrates.org", ev, fs, dynOpts, utils.OptsRatesUsage) + out, err := GetFloat64Opts(context.Background(), "cgrates.org", ev.AsDataProvider(), fs, dynOpts, utils.OptsRatesUsage) if tt.expErr != nil { if err == nil { t.Error("expected err,received nil") @@ -1543,7 +1543,7 @@ func TestDynamicDurationOptsDynVal(t *testing.T) { t.Error(err) return } - out, err := GetDurationOpts(context.Background(), "cgrates.org", ev, fs, dynOpts, utils.OptsRatesUsage) + out, err := GetDurationOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fs, dynOpts, utils.OptsRatesUsage) if tt.expErr != nil { if err == nil { t.Error("expected err,received nil") @@ -1622,7 +1622,7 @@ func TestDynamicStringOptsDynVal(t *testing.T) { t.Error(err) return } - out, err := GetStringOpts(context.Background(), "cgrates.org", ev, fs, dynOpts) + out, err := GetStringOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fs, dynOpts) if tt.expErr != nil { if err == nil { t.Error("expected err,received nil") @@ -1717,28 +1717,28 @@ func TestAttrDynamicOptsFromJson(t *testing.T) { APIOpts: map[string]any{}, } fltrs := NewFilterS(cgrCfg, nil, nil) - if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev, fltrs, cgrCfg.AttributeSCfg().Opts.ProcessRuns); err != nil { + if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fltrs, cgrCfg.AttributeSCfg().Opts.ProcessRuns); err != nil { t.Error(err) } else if rcv != 4 { t.Errorf("expected %d,received %d", 4, rcv) } - if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev3, fltrs, cgrCfg.AttributeSCfg().Opts.ProcessRuns); err != nil { + if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev3.AsDataProvider(), fltrs, cgrCfg.AttributeSCfg().Opts.ProcessRuns); err != nil { t.Error(err) } else if rcv != 11 { t.Errorf("expected %d,received %d", 11, rcv) } - if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev2, fltrs, cgrCfg.AttributeSCfg().Opts.ProcessRuns); err != nil { + if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev2.AsDataProvider(), fltrs, cgrCfg.AttributeSCfg().Opts.ProcessRuns); err != nil { t.Error(err) } else if rcv != config.AttributesProcessRunsDftOpt { t.Errorf("expected %d,received %d", config.AttributesProcessRunsDftOpt, rcv) } - if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev, fltrs, cgrCfg.AttributeSCfg().Opts.ProfileRuns); err != nil { + if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fltrs, cgrCfg.AttributeSCfg().Opts.ProfileRuns); err != nil { t.Error(err) } else if rcv != 5 { t.Errorf("expected %d,received %d", 5, rcv) } - if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev2, fltrs, cgrCfg.AttributeSCfg().Opts.ProfileRuns); err != nil { + if rcv, err := GetIntOpts(context.Background(), "cgrates.org", ev2.AsDataProvider(), fltrs, cgrCfg.AttributeSCfg().Opts.ProfileRuns); err != nil { t.Error(err) } else if rcv != config.AttributesProfileRunsDftOpt { t.Errorf("expected %d,received %d", config.AttributesProcessRunsDftOpt, rcv) @@ -1848,23 +1848,23 @@ func TestSessionDynamicOptsFromJson(t *testing.T) { t.Errorf("expected %v,received %v", config.SessionsAttributesDftOpt, rcv) } - if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev, fltrs, cgrCfg.SessionSCfg().Opts.TTL); err != nil { + if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fltrs, cgrCfg.SessionSCfg().Opts.TTL); err != nil { t.Error(err) } else if rcv != time.Second { t.Errorf("expected %v,received %v", time.Second, rcv) } - if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev2, fltrs, cgrCfg.SessionSCfg().Opts.TTL); err != nil { + if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev2.AsDataProvider(), fltrs, cgrCfg.SessionSCfg().Opts.TTL); err != nil { t.Error(err) } else if rcv != config.SessionsTTLDftOpt { t.Errorf("expected %v,received %v", config.SessionsTTLDftOpt, rcv) } - if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev, fltrs, cgrCfg.SessionSCfg().Opts.DebitInterval); err != nil { + if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fltrs, cgrCfg.SessionSCfg().Opts.DebitInterval); err != nil { t.Error(err) } else if rcv != (8 * time.Second) { t.Errorf("expected %v,received %v", 8*time.Second, rcv) } - if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev2, fltrs, cgrCfg.SessionSCfg().Opts.DebitInterval); err != nil { + if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev2.AsDataProvider(), fltrs, cgrCfg.SessionSCfg().Opts.DebitInterval); err != nil { t.Error(err) } else if rcv != config.SessionsDebitIntervalDftOpt { t.Errorf("expected %v,received %v", config.SessionsDebitIntervalDftOpt, rcv) @@ -1931,34 +1931,34 @@ func TestResDynamicOptsFromJson(t *testing.T) { }, } fltrs := NewFilterS(cgrCfg, nil, nil) - if rcv, err := GetStringOpts(context.Background(), "cgrates.org", ev, fltrs, cgrCfg.ResourceSCfg().Opts.UsageID); err != nil { + if rcv, err := GetStringOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fltrs, cgrCfg.ResourceSCfg().Opts.UsageID); err != nil { t.Error(err) } else if rcv != "UsgID3232" { t.Errorf("expected %s,received %s", "UsgID3232", rcv) } - if rcv, err := GetStringOpts(context.Background(), "cgrates.org", ev2, fltrs, cgrCfg.ResourceSCfg().Opts.UsageID); err != nil { + if rcv, err := GetStringOpts(context.Background(), "cgrates.org", ev2.AsDataProvider(), fltrs, cgrCfg.ResourceSCfg().Opts.UsageID); err != nil { t.Error(err) } else if rcv != config.ResourcesUsageIDDftOpt { t.Errorf("expected %s,received %s", config.ResourcesUsageTTLDftOpt, rcv) } - if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev, fltrs, cgrCfg.ResourceSCfg().Opts.UsageTTL); err != nil { + if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fltrs, cgrCfg.ResourceSCfg().Opts.UsageTTL); err != nil { t.Error(err) } else if rcv != 3*time.Second { t.Errorf("expected %v,received %d", 3*time.Second, rcv) } - if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev2, fltrs, cgrCfg.ResourceSCfg().Opts.UsageTTL); err != nil { + if rcv, err := GetDurationOpts(context.Background(), "cgrates.org", ev2.AsDataProvider(), fltrs, cgrCfg.ResourceSCfg().Opts.UsageTTL); err != nil { t.Error(err) } else if rcv != config.ResourcesUsageTTLDftOpt { t.Errorf("expected %d,received %d", config.ResourcesUsageTTLDftOpt, rcv) } - if rcv, err := GetFloat64Opts(context.Background(), "cgrates.org", ev, fltrs, cgrCfg.ResourceSCfg().Opts.Units); err != nil { + if rcv, err := GetFloat64Opts(context.Background(), "cgrates.org", ev.AsDataProvider(), fltrs, cgrCfg.ResourceSCfg().Opts.Units); err != nil { t.Error(err) } else if rcv != 23.22 { t.Errorf("expected %f,received %f", 23.22, rcv) } - if rcv, err := GetFloat64Opts(context.Background(), "cgrates.org", ev2, fltrs, cgrCfg.ResourceSCfg().Opts.Units); err != nil { + if rcv, err := GetFloat64Opts(context.Background(), "cgrates.org", ev2.AsDataProvider(), fltrs, cgrCfg.ResourceSCfg().Opts.Units); err != nil { t.Error(err) } else if rcv != config.ResourcesUnitsDftOpt { t.Errorf("expected %v,received %v", config.ResourcesUnitsDftOpt, rcv) @@ -2012,34 +2012,34 @@ func TestRoutesDynamicOptsFromJson(t *testing.T) { dec.SetFloat64(43364.4) fltrs := NewFilterS(cgrCfg, nil, nil) - if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev, fltrs, cgrCfg.RouteSCfg().Opts.Usage); err != nil { + if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fltrs, cgrCfg.RouteSCfg().Opts.Usage); err != nil { t.Error(err) } else if rcv.Cmp(&dec) != 0 { t.Errorf("expected %v,received %v", dec.String(), rcv.String()) } ev.Event[utils.AccountField] = 1002 dec.SetUint64(15555) - if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev, fltrs, cgrCfg.RouteSCfg().Opts.Usage); err != nil { + if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fltrs, cgrCfg.RouteSCfg().Opts.Usage); err != nil { t.Error(err) } else if rcv.Cmp(&dec) != 0 { t.Errorf("expected %v,received %v", dec.String(), rcv.String()) } ev.Event[utils.AccountField] = 1003 dec = *decimal.New(int64(5*time.Minute), 0) - if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev, fltrs, cgrCfg.RouteSCfg().Opts.Usage); err != nil { + if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fltrs, cgrCfg.RouteSCfg().Opts.Usage); err != nil { t.Error(err) } else if rcv.Cmp(&dec) != 0 { t.Errorf("expected %v,received %v", dec.String(), rcv.String()) } ev.Event[utils.AccountField] = 1004 dec = *decimal.New(int64(12*time.Minute), 0) - if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev, fltrs, cgrCfg.RouteSCfg().Opts.Usage); err != nil { + if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fltrs, cgrCfg.RouteSCfg().Opts.Usage); err != nil { t.Error(err) } else if rcv.Cmp(&dec) != 0 { t.Errorf("expected %v,received %v", dec.String(), rcv.String()) } ev.Event[utils.AccountField] = 1005 - if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev, fltrs, cgrCfg.RouteSCfg().Opts.Usage); err != nil { + if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fltrs, cgrCfg.RouteSCfg().Opts.Usage); err != nil { t.Error(err) } else if rcv.Cmp(config.RatesUsageDftOpt) != 0 { t.Errorf("expected %v,received %v", config.RatesUsageDftOpt.String(), rcv.String()) @@ -2069,7 +2069,7 @@ func TestLibFiltersGetDecimalBigOptsFilterCheckErr(t *testing.T) { } dynOpts, _ := config.IfaceToDecimalBigDynamicOpts(strOpts) experr := `inline parse error for string: <*string.invalid:filter>` - if _, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if _, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsRatesUsage); err == nil || err.Error() != experr { t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err) @@ -2101,7 +2101,7 @@ func TestLibFiltersGetDecimalBigOptsReturnDefaultOpt(t *testing.T) { if err != nil { t.Fatal(err) } - if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsRatesUsage); err != nil { t.Error(err) } else if rcv.Cmp(config.RatesUsageDftOpt) != 0 { @@ -2137,7 +2137,7 @@ func TestLibFiltersGetDecimalBigOptsReturnOptFromAPIOpts(t *testing.T) { dynOpts, _ := config.IfaceToDecimalBigDynamicOpts(strOpts) expected := decimal.New(4321, 5) - if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetDecimalBigOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, "nonExistingAPIOpt", utils.OptsRatesUsage); err != nil { t.Error(err) } else if rcv.Cmp(expected) != 0 { @@ -2167,7 +2167,7 @@ func TestLibFiltersGetIntPointerOptsReturnConfigOpt(t *testing.T) { } expected := 5 - if rcv, err := GetIntPointerOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetIntPointerOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsRoutesProfilesCount); err != nil { t.Error(err) } else if *rcv != expected { @@ -2194,7 +2194,7 @@ func TestLibFiltersGetIntPointerOptsFilterCheckErr(t *testing.T) { } experr := `inline parse error for string: <*string.invalid:filter>` - if _, err := GetIntPointerOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if _, err := GetIntPointerOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsRoutesProfilesCount); err == nil || err.Error() != experr { t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err) @@ -2219,7 +2219,7 @@ func TestLibFiltersGetIntPointerOptsReturnDft(t *testing.T) { config.NewDynamicIntPointerOpt([]string{"*string:~*req.Account:1002"}, "cgrates.org", utils.IntPointer(4), nil), } - if rcv, err := GetIntPointerOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetIntPointerOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, utils.OptsRoutesProfilesCount); err != nil { t.Error(err) } else if rcv != nil { @@ -2249,7 +2249,7 @@ func TestLibFiltersGetIntPointerOptsReturnOptFromAPIOptsOK(t *testing.T) { } expected := 6 - if rcv, err := GetIntPointerOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if rcv, err := GetIntPointerOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, "nonExistingAPIOpt", utils.OptsRoutesProfilesCount); err != nil { t.Error(err) } else if *rcv != expected { @@ -2279,7 +2279,7 @@ func TestLibFiltersGetIntPointerOptsReturnOptFromAPIOptsErr(t *testing.T) { } experr := `cannot convert field: true to int` - if _, err := GetIntPointerOpts(context.Background(), "cgrates.org", ev, fS, dynOpts, + if _, err := GetIntPointerOpts(context.Background(), "cgrates.org", ev.AsDataProvider(), fS, dynOpts, "nonExistingAPIOpt", utils.OptsRoutesProfilesCount); err == nil || err.Error() != experr { t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err) } diff --git a/engine/resources.go b/engine/resources.go index eca88ed60..24175648f 100644 --- a/engine/resources.go +++ b/engine/resources.go @@ -673,13 +673,13 @@ func (rS *ResourceS) V1GetResourcesForEvent(ctx *context.Context, args *utils.CG } var usageID string - if usageID, err = GetStringOpts(ctx, args.Tenant, args, rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageID, + if usageID, err = GetStringOpts(ctx, args.Tenant, args.AsDataProvider(), rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageID, utils.OptsResourcesUsageID); err != nil { return } var ttl time.Duration - if ttl, err = GetDurationOpts(ctx, args.Tenant, args, rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageTTL, + if ttl, err = GetDurationOpts(ctx, args.Tenant, args.AsDataProvider(), rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageTTL, utils.OptsResourcesUsageTTL); err != nil { return } @@ -731,19 +731,19 @@ func (rS *ResourceS) V1AuthorizeResources(ctx *context.Context, args *utils.CGRE } var usageID string - if usageID, err = GetStringOpts(ctx, args.Tenant, args, rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageID, + if usageID, err = GetStringOpts(ctx, args.Tenant, args.AsDataProvider(), rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageID, utils.OptsResourcesUsageID); err != nil { return } var units float64 - if units, err = GetFloat64Opts(ctx, args.Tenant, args, rS.fltrS, rS.cfg.ResourceSCfg().Opts.Units, + if units, err = GetFloat64Opts(ctx, args.Tenant, args.AsDataProvider(), rS.fltrS, rS.cfg.ResourceSCfg().Opts.Units, utils.OptsResourcesUnits); err != nil { return } var ttl time.Duration - if ttl, err = GetDurationOpts(ctx, args.Tenant, args, rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageTTL, + if ttl, err = GetDurationOpts(ctx, args.Tenant, args.AsDataProvider(), rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageTTL, utils.OptsResourcesUsageTTL); err != nil { return } @@ -807,19 +807,19 @@ func (rS *ResourceS) V1AllocateResources(ctx *context.Context, args *utils.CGREv } var usageID string - if usageID, err = GetStringOpts(ctx, args.Tenant, args, rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageID, + if usageID, err = GetStringOpts(ctx, args.Tenant, args.AsDataProvider(), rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageID, utils.OptsResourcesUsageID); err != nil { return } var units float64 - if units, err = GetFloat64Opts(ctx, args.Tenant, args, rS.fltrS, rS.cfg.ResourceSCfg().Opts.Units, + if units, err = GetFloat64Opts(ctx, args.Tenant, args.AsDataProvider(), rS.fltrS, rS.cfg.ResourceSCfg().Opts.Units, utils.OptsResourcesUnits); err != nil { return } var ttl time.Duration - if ttl, err = GetDurationOpts(ctx, args.Tenant, args, rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageTTL, + if ttl, err = GetDurationOpts(ctx, args.Tenant, args.AsDataProvider(), rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageTTL, utils.OptsResourcesUsageTTL); err != nil { return } @@ -887,13 +887,13 @@ func (rS *ResourceS) V1ReleaseResources(ctx *context.Context, args *utils.CGREve } var usageID string - if usageID, err = GetStringOpts(ctx, args.Tenant, args, rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageID, + if usageID, err = GetStringOpts(ctx, args.Tenant, args.AsDataProvider(), rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageID, utils.OptsResourcesUsageID); err != nil { return } var ttl time.Duration - if ttl, err = GetDurationOpts(ctx, args.Tenant, args, rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageTTL, + if ttl, err = GetDurationOpts(ctx, args.Tenant, args.AsDataProvider(), rS.fltrS, rS.cfg.ResourceSCfg().Opts.UsageTTL, utils.OptsResourcesUsageTTL); err != nil { return } diff --git a/engine/route_cost_sort.go b/engine/route_cost_sort.go index f8ba77454..0579df890 100644 --- a/engine/route_cost_sort.go +++ b/engine/route_cost_sort.go @@ -36,7 +36,7 @@ func populateCostForRoutes(ctx *context.Context, cfg *config.CGRConfig, connMgr return nil, utils.NewErrMandatoryIeMissing("connIDs") } var usage *decimal.Big - if usage, err = GetDecimalBigOpts(ctx, ev.Tenant, ev, fltrS, cfg.RouteSCfg().Opts.Usage, + if usage, err = GetDecimalBigOpts(ctx, ev.Tenant, ev.AsDataProvider(), fltrS, cfg.RouteSCfg().Opts.Usage, utils.OptsRoutesUsage, utils.MetaUsage); err != nil { return } diff --git a/engine/routes.go b/engine/routes.go index f1d4a2773..77824dd17 100644 --- a/engine/routes.go +++ b/engine/routes.go @@ -192,7 +192,8 @@ func (rpS *RouteS) matchingRouteProfilesForEvent(ctx *context.Context, tnt strin func newOptsGetRoutes(ctx *context.Context, ev *utils.CGREvent, fS *FilterS, cfgOpts *config.RoutesOpts) (opts *optsGetRoutes, err error) { var ignoreErrors bool - if ignoreErrors, err = GetBoolOpts(ctx, ev.Tenant, ev.AsDataProvider(), fS, cfgOpts.IgnoreErrors, + evNM := ev.AsDataProvider() + if ignoreErrors, err = GetBoolOpts(ctx, ev.Tenant, evNM, fS, cfgOpts.IgnoreErrors, utils.OptsRoutesIgnoreErrors); err != nil { return } @@ -201,21 +202,21 @@ func newOptsGetRoutes(ctx *context.Context, ev *utils.CGREvent, fS *FilterS, cfg paginator: &utils.Paginator{}, } var limit *int - if limit, err = GetIntPointerOpts(ctx, ev.Tenant, ev, fS, cfgOpts.Limit, + if limit, err = GetIntPointerOpts(ctx, ev.Tenant, evNM, fS, cfgOpts.Limit, utils.OptsRoutesLimit); err != nil { return } else { opts.paginator.Limit = limit } var offset *int - if offset, err = GetIntPointerOpts(ctx, ev.Tenant, ev, fS, cfgOpts.Offset, + if offset, err = GetIntPointerOpts(ctx, ev.Tenant, evNM, fS, cfgOpts.Offset, utils.OptsRoutesOffset); err != nil { return } else { opts.paginator.Offset = offset } var maxItems *int - if maxItems, err = GetIntPointerOpts(ctx, ev.Tenant, ev, fS, cfgOpts.MaxItems, + if maxItems, err = GetIntPointerOpts(ctx, ev.Tenant, evNM, fS, cfgOpts.MaxItems, utils.OptsRoutesMaxItems); err != nil { return } else { @@ -223,7 +224,7 @@ func newOptsGetRoutes(ctx *context.Context, ev *utils.CGREvent, fS *FilterS, cfg } var maxCost any - if maxCost, err = GetInterfaceOpts(ctx, ev.Tenant, ev, fS, cfgOpts.MaxCost, config.RoutesMaxCostDftOpt, + if maxCost, err = GetInterfaceOpts(ctx, ev.Tenant, evNM, fS, cfgOpts.MaxCost, config.RoutesMaxCostDftOpt, utils.OptsRoutesMaxCost); err != nil { return } @@ -280,7 +281,7 @@ func (rpS *RouteS) V1GetRoutes(ctx *context.Context, args *utils.CGREvent, reply if len(rpS.cfg.RouteSCfg().AttributeSConns) != 0 { args.APIOpts[utils.MetaSubsys] = utils.MetaRoutes var context string - if context, err = GetStringOpts(ctx, tnt, args, rpS.fltrS, rpS.cfg.RouteSCfg().Opts.Context, + if context, err = GetStringOpts(ctx, tnt, args.AsDataProvider(), rpS.fltrS, rpS.cfg.RouteSCfg().Opts.Context, utils.OptsContext); err != nil { return } @@ -408,7 +409,7 @@ func (rpS *RouteS) sortedRoutesForEvent(ctx *context.Context, tnt string, args * } prfCount := len(rPrfs) // if the option is not present return for all profiles var prfCountOpt *int - if prfCountOpt, err = GetIntPointerOpts(ctx, tnt, args, rpS.fltrS, rpS.cfg.RouteSCfg().Opts.ProfileCount, + if prfCountOpt, err = GetIntPointerOpts(ctx, tnt, args.AsDataProvider(), rpS.fltrS, rpS.cfg.RouteSCfg().Opts.ProfileCount, utils.OptsRoutesProfilesCount); err != nil && err != utils.ErrNotFound { // if the error is NOT_FOUND, it means that in opts or config, countProfiles field is not defined return diff --git a/engine/stats.go b/engine/stats.go index d627e2f95..e24bf880c 100644 --- a/engine/stats.go +++ b/engine/stats.go @@ -373,7 +373,7 @@ func (sS *StatS) processEEs(ctx *context.Context, sQs StatQueues, opts map[strin func (sS *StatS) processEvent(ctx *context.Context, tnt string, args *utils.CGREvent) (statQueueIDs []string, err error) { evNm := args.AsDataProvider() var sqIDs []string - if sqIDs, err = GetStringSliceOpts(ctx, tnt, args, sS.fltrS, sS.cfg.StatSCfg().Opts.ProfileIDs, + if sqIDs, err = GetStringSliceOpts(ctx, tnt, evNm, sS.fltrS, sS.cfg.StatSCfg().Opts.ProfileIDs, config.StatsProfileIDsDftOpt, utils.OptsStatsProfileIDs); err != nil { return } @@ -415,7 +415,7 @@ func (sS *StatS) processEvent(ctx *context.Context, tnt string, args *utils.CGRE } var promIDs []string - if promIDs, err = GetStringSliceOpts(ctx, tnt, args, sS.fltrS, sS.cfg.StatSCfg().Opts.PrometheusStatIDs, + if promIDs, err = GetStringSliceOpts(ctx, tnt, evNm, sS.fltrS, sS.cfg.StatSCfg().Opts.PrometheusStatIDs, []string{}, utils.OptsPrometheusStatIDs); err != nil { return } @@ -467,7 +467,8 @@ func (sS *StatS) V1GetStatQueuesForEvent(ctx *context.Context, args *utils.CGREv tnt = sS.cfg.GeneralCfg().DefaultTenant } var sqIDs []string - if sqIDs, err = GetStringSliceOpts(ctx, tnt, args, sS.fltrS, sS.cfg.StatSCfg().Opts.ProfileIDs, + dP := args.AsDataProvider() + if sqIDs, err = GetStringSliceOpts(ctx, tnt, dP, sS.fltrS, sS.cfg.StatSCfg().Opts.ProfileIDs, config.StatsProfileIDsDftOpt, utils.OptsStatsProfileIDs); err != nil { return } @@ -531,7 +532,7 @@ func (sS *StatS) V1GetQueueStringMetrics(ctx *context.Context, args *utils.Tenan return err } var rnd int - if rnd, err = GetIntOpts(ctx, tnt, &utils.CGREvent{Tenant: tnt}, sS.fltrS, + if rnd, err = GetIntOpts(ctx, tnt, MapEvent{utils.Tenant: tnt, "*opts": map[string]any{}}, sS.fltrS, sS.cfg.StatSCfg().Opts.RoundingDecimals, utils.OptsRoundingDecimals); err != nil { return diff --git a/engine/thresholds.go b/engine/thresholds.go index f6df4586c..6cf989d53 100644 --- a/engine/thresholds.go +++ b/engine/thresholds.go @@ -333,7 +333,7 @@ func (tS *ThresholdS) matchingThresholdsForEvent(ctx *context.Context, tnt strin utils.MetaOpts: args.APIOpts, } var thIDs []string - if thIDs, err = GetStringSliceOpts(ctx, tnt, args, tS.fltrS, tS.cfg.ThresholdSCfg().Opts.ProfileIDs, + if thIDs, err = GetStringSliceOpts(ctx, tnt, evNm, tS.fltrS, tS.cfg.ThresholdSCfg().Opts.ProfileIDs, config.ThresholdsProfileIDsDftOpt, utils.OptsThresholdsProfileIDs); err != nil { return } diff --git a/engine/z_attributes_test.go b/engine/z_attributes_test.go index 2e81badde..059f195fc 100644 --- a/engine/z_attributes_test.go +++ b/engine/z_attributes_test.go @@ -5301,7 +5301,7 @@ func TestAttributesAttributeServiceV1PrcssEvPrcssRunsGetIntOptsErr(t *testing.T) } reply := &AttrSProcessEventReply{} - exrErr := `strconv.ParseInt: parsing "errVal": invalid syntax` + exrErr := `strconv.Atoi: parsing "errVal": invalid syntax` if err := alS.V1ProcessEvent(context.Background(), ev, reply); err == nil || err.Error() != exrErr { t.Errorf("\nExpected <%+v>, \nReceived <%+v>", exrErr, err) } @@ -5353,7 +5353,7 @@ func TestAttributesAttributeServiceV1PrcssEvProfRunsGetIntOptsErr(t *testing.T) } reply := &AttrSProcessEventReply{} - exrErr := `strconv.ParseInt: parsing "errVal": invalid syntax` + exrErr := `strconv.Atoi: parsing "errVal": invalid syntax` if err := alS.V1ProcessEvent(context.Background(), ev, reply); err == nil || err.Error() != exrErr { t.Errorf("\nExpected <%+v>, \nReceived <%+v>", exrErr, err) } diff --git a/rates/apis.go b/rates/apis.go index d8cfa7a37..70f6bb245 100644 --- a/rates/apis.go +++ b/rates/apis.go @@ -133,7 +133,7 @@ func (rS *RateS) V1RateProfileRatesForEvent(ctx *context.Context, args *utils.CG // it will loop through all matching profiles for the event in the eventuality the ones with higher priority are erroring func (rS *RateS) V1CostForEvent(ctx *context.Context, args *utils.CGREvent, rpCost *utils.RateProfileCost) (err error) { var rPfIDs []string - if rPfIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args, rS.fltrS, rS.cfg.RateSCfg().Opts.ProfileIDs, + if rPfIDs, err = engine.GetStringSliceOpts(ctx, args.Tenant, args.AsDataProvider(), rS.fltrS, rS.cfg.RateSCfg().Opts.ProfileIDs, config.RatesProfileIDsDftOpt, utils.OptsRatesProfileIDs); err != nil { return } diff --git a/rates/rates.go b/rates/rates.go index f55cc32c9..0060adae2 100644 --- a/rates/rates.go +++ b/rates/rates.go @@ -169,13 +169,14 @@ func (rS *RateS) rateProfileCostForEvent(ctx *context.Context, rtPfl *utils.Rate return } } + dP := args.AsDataProvider() var sTime time.Time - if sTime, err = engine.GetTimeOpts(ctx, args.Tenant, args, rS.fltrS, rS.cfg.RateSCfg().Opts.StartTime, + if sTime, err = engine.GetTimeOpts(ctx, args.Tenant, dP, rS.fltrS, rS.cfg.RateSCfg().Opts.StartTime, rS.cfg.GeneralCfg().DefaultTimezone, utils.OptsRatesStartTime, utils.MetaStartTime); err != nil { return } var usage *decimal.Big - if usage, err = engine.GetDecimalBigOpts(ctx, args.Tenant, args, rS.fltrS, rS.cfg.RateSCfg().Opts.Usage, + if usage, err = engine.GetDecimalBigOpts(ctx, args.Tenant, dP, rS.fltrS, rS.cfg.RateSCfg().Opts.Usage, utils.OptsRatesUsage, utils.MetaUsage); err != nil { return } @@ -194,7 +195,7 @@ func (rS *RateS) rateProfileCostForEvent(ctx *context.Context, rtPfl *utils.Rate rpCost.MaxCost = rtPfl.MaxCost } var ivalStart *decimal.Big - if ivalStart, err = engine.GetDecimalBigOpts(ctx, args.Tenant, args, rS.fltrS, rS.cfg.RateSCfg().Opts.IntervalStart, + if ivalStart, err = engine.GetDecimalBigOpts(ctx, args.Tenant, dP, rS.fltrS, rS.cfg.RateSCfg().Opts.IntervalStart, utils.OptsRatesIntervalStart); err != nil { return } diff --git a/sessions/apis.go b/sessions/apis.go index 68f7bfc63..f8b4f732c 100644 --- a/sessions/apis.go +++ b/sessions/apis.go @@ -263,7 +263,8 @@ func (sS *SessionS) BiRPCv1InitiateSession(ctx *context.Context, // end of RPC caching var originID string - if originID, err = engine.GetStringOpts(ctx, args.Tenant, args, sS.fltrS, nil, + dP := args.AsDataProvider() + if originID, err = engine.GetStringOpts(ctx, args.Tenant, dP, sS.fltrS, nil, utils.MetaOriginID); err != nil { return } else if originID == utils.EmptyString { @@ -274,7 +275,6 @@ func (sS *SessionS) BiRPCv1InitiateSession(ctx *context.Context, } rply.MaxUsage = utils.DurationPointer(time.Duration(utils.InvalidUsage)) // temp - dP := args.AsDataProvider() var acntS bool if acntS, err = engine.GetBoolOpts(ctx, args.Tenant, dP, sS.fltrS, sS.cfg.SessionSCfg().Opts.MaxUsage, @@ -362,7 +362,7 @@ func (sS *SessionS) BiRPCv1InitiateSession(ctx *context.Context, return } var dbtItvl time.Duration - if dbtItvl, err = engine.GetDurationOpts(ctx, args.Tenant, args, sS.fltrS, sS.cfg.SessionSCfg().Opts.DebitInterval, + if dbtItvl, err = engine.GetDurationOpts(ctx, args.Tenant, args.AsDataProvider(), sS.fltrS, sS.cfg.SessionSCfg().Opts.DebitInterval, utils.OptsSesDebitInterval); err != nil { return } diff --git a/utils/consts.go b/utils/consts.go index 6ce23d74a..b12f1a5ad 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -2212,7 +2212,6 @@ const ( MetaTTLLastUsedCfg = "*ttlLastUsed" MetaTTLMaxDelayCfg = "*ttlMaxDelay" MetaTTLUsageCfg = "*ttlUsage" - MetaSessionsOriginID = "*sessionsOriginID" MetaAccountsForceUsage = "*accountsForceUsage" // AnalyzerSCfg