Пример #1
0
// Follows the implementation in the StorCdr
func passesFieldFilter(m *diam.Message, fieldFilter *utils.RSRField) (bool, int) {
	if fieldFilter == nil {
		return true, 0
	}
	avps, err := avpsWithPath(m, fieldFilter)
	if err != nil {
		return false, 0
	} else if len(avps) == 0 {
		return false, 0 // No AVPs with field filter ID
	}
	for avpIdx, avpVal := range avps { // First match wins due to index
		if fieldFilter.FilterPasses(avpValAsString(avpVal)) {
			return true, avpIdx
		}
	}
	return false, 0
}
Пример #2
0
func passesFieldFilter(m *diam.Message, fieldFilter *utils.RSRField, processorVars map[string]string) (bool, int) {
	if fieldFilter == nil {
		return true, 0
	}
	if val, hasIt := processorVars[fieldFilter.Id]; hasIt { // ProcessorVars have priority
		if fieldFilter.FilterPasses(val) {
			return true, 0
		}
		return false, 0
	}
	avps, err := avpsWithPath(m, fieldFilter)
	if err != nil {
		return false, 0
	}
	if len(avps) == 0 { // No AVP found in request, treat it same as empty
		if fieldFilter.FilterPasses("") {
			return true, -1
		}
	}
	for avpIdx, avpVal := range avps { // First match wins due to index
		if fieldFilter.FilterPasses(avpValAsString(avpVal)) {
			return true, avpIdx
		}
	}
	return false, 0
}
Пример #3
0
// Follows the implementation in the StorCdr
func (self *CCR) passesFieldFilter(fieldFilter *utils.RSRField) bool {
	if fieldFilter == nil {
		return true
	}
	return fieldFilter.FilterPasses(self.eventFieldValue(utils.RSRFields{fieldFilter}))
}