Passing regexps from SQL to unlang

Alan DeKok aland at deployingradius.com
Mon Feb 18 16:53:59 CET 2013


Maxim S. Denisov wrote:
> I need to translate calling-station-id to E.164. NAS can send these numbers in several formats, for example number +74951234567 can come as 1234567, 04951234567 or 0074951234567. I think about adding a field in nas table and specify several regexps with delimiter. Can I fetch this field, parse it to several regexps and use them in unlang as regexps?

  Not really.  And it's probably not a good idea, either.  Databases are
 for storing bulk data, not policies.

  This is the kind of thing you'd do in unlang.  Just write 5-6 rules
with regexes.  They should catch the weird formats, and standardize
them.  Then, insert the standardized form into the database.

  Alan DeKok.


More information about the Freeradius-Users mailing list