diff --git a/dispatchers/thresholds_it_test.go b/dispatchers/thresholds_it_test.go index 48c29f02c..b9ff5e562 100644 --- a/dispatchers/thresholds_it_test.go +++ b/dispatchers/thresholds_it_test.go @@ -154,17 +154,15 @@ func testDspThPing(t *testing.T) { func testDspThTestAuthKey(t *testing.T) { var ids []string nowTime := time.Now() - args := &engine.ThresholdsArgsProcessEvent{ - CGREvent: &utils.CGREvent{ - Tenant: "cgrates.org", - ID: utils.UUIDSha1Prefix(), - Time: &nowTime, - Event: map[string]interface{}{ - utils.AccountField: "1002"}, + args := &utils.CGREvent{ + Tenant: "cgrates.org", + ID: utils.UUIDSha1Prefix(), + Time: &nowTime, + Event: map[string]interface{}{ + utils.AccountField: "1002"}, - APIOpts: map[string]interface{}{ - utils.OptsAPIKey: "12345", - }, + APIOpts: map[string]interface{}{ + utils.OptsAPIKey: "12345", }, } @@ -183,17 +181,15 @@ func testDspThTestAuthKey2(t *testing.T) { var ids []string eIDs := []string{"THD_ACNT_1002"} nowTime := time.Now() - args := &engine.ThresholdsArgsProcessEvent{ - CGREvent: &utils.CGREvent{ - Tenant: "cgrates.org", - ID: utils.UUIDSha1Prefix(), - Time: &nowTime, - Event: map[string]interface{}{ - utils.AccountField: "1002"}, + args := &utils.CGREvent{ + Tenant: "cgrates.org", + ID: utils.UUIDSha1Prefix(), + Time: &nowTime, + Event: map[string]interface{}{ + utils.AccountField: "1002"}, - APIOpts: map[string]interface{}{ - utils.OptsAPIKey: "thr12345", - }, + APIOpts: map[string]interface{}{ + utils.OptsAPIKey: "thr12345", }, } diff --git a/engine/thresholds.go b/engine/thresholds.go index e9d19b3cf..9e368be2d 100644 --- a/engine/thresholds.go +++ b/engine/thresholds.go @@ -335,8 +335,15 @@ func (tS *ThresholdService) matchingThresholdsForEvent(tnt string, args *utils.C return } } + ignFilters := tS.cgrcfg.ThresholdSCfg().Opts.ProfileIgnoreFilters + if opt, has := args.APIOpts[utils.OptsThresholdsProfileIgnoreFilters]; has { + if ignFilters, err = utils.IfaceAsBool(opt); err != nil { + return + } + } tIDs := utils.NewStringSet(thdIDs) if len(tIDs) == 0 { + ignFilters = false tIDs, err = MatchingItemIDsForEvent(evNm, tS.cgrcfg.ThresholdSCfg().StringIndexedFields, tS.cgrcfg.ThresholdSCfg().PrefixIndexedFields, @@ -370,15 +377,17 @@ func (tS *ThresholdService) matchingThresholdsForEvent(tnt string, args *utils.C tPrfl.unlock() continue } - var pass bool - if pass, err = tS.filterS.Pass(tnt, tPrfl.FilterIDs, - evNm); err != nil { - tPrfl.unlock() - ts.unlock() - return nil, err - } else if !pass { - tPrfl.unlock() - continue + if !ignFilters { + var pass bool + if pass, err = tS.filterS.Pass(tnt, tPrfl.FilterIDs, + evNm); err != nil { + tPrfl.unlock() + ts.unlock() + return nil, err + } else if !pass { + tPrfl.unlock() + continue + } } lkID := guardian.Guardian.GuardIDs(utils.EmptyString, config.CgrConfig().GeneralCfg().LockingTimeout,