VSA Processing embedded values

Arran Cudbard-Bell a.cudbardb at freeradius.org
Tue Jan 6 03:19:29 CET 2015


> On 5 Jan 2015, at 09:32, Ben Gatewood <Ben.Gatewood at essensys.co.uk> wrote:
> 
> Thanks, Arran. I have to confess I’ve hit a wall in my expertise and can’t figure out how to make your regex model work for cases where there are more than one Attr-255 in the request.

Foreach... operates the same as any other programming language.

Iterator is hard coded to the level of nesting.

foreach &Broadsoft-Attr-255 {
	# values of Broadsoft-Attr-255 are available as %{Foreach-Variable-0}
	if ("%{Foreach-Variable-0}" =~ /^([0-9]+)=(.*)$/) {
		# %{1} attr %{2} value
	}
}

If you're doing presence checks you can also use: 

if (&Broadsoft-Attr-255[*] == '<attr>=<value>') {
	# evaluates to true if any instance of Broadsoft-Attr-255 has the value <attr>=<value>
}

but that's >= 3.0.6 only.

-Arran


More information about the Freeradius-Users mailing list