string manipulation

A.L.M.Buxey at lboro.ac.uk A.L.M.Buxey at lboro.ac.uk
Tue Sep 6 20:44:43 CEST 2016


Hi,

> If the string is fairly constant in format, i.e. it's always 'SIP/<numbers>@SIPProvider', then I'd try:
> 
> if (&request:Asterisk-Last-Data =~ /\/([0-9]+)\@/) {    # a series of digits preceded by a / and followed by an @
>     update reply {
>         Called-Station-Id := "%{1}"
>     }
> }

+1 = there are similar examples in the provided policy files of recent versions (eg for breaking up usernames...

on recent versions you could also look at the explode xlat module


alan


More information about the Freeradius-Users mailing list