Dear freeradius friends, I have the following in the accounting section of my sites-enabled/default file: <snip> if ( request:Asterisk-Unique-ID ) { update request { Acct-Session-Time := &Asterisk-Bill-Sec Called-Station-Id := &Asterisk-Last-Data Calling-Station-Id := &Asterisk-Src Connect-Info := &Asterisk-Disposition # NAS-Port-Type := "Asterisk CDR" } } </snip> The data in Asterisk-Last-Data is something like SIP/7874338439@SIPprovider. I would like to save only the 7874338439 data in Called-Station-Id. So I need something like a sed or awk command to strip out the right data. Something equivalent as `echo 'SIP/7874338439@SIPProv' | sed 's/[a-Z/@]//g'` How can this be achieved within freeradius? -- Met vriendelijke groeten, With kind regards, Mit freundlichen Gruessen, De jrus wah, Will ************************************* W.K. Offermans Powered by .... (__) \\\'',) \/ \ ^ .\._/_) www.FreeBSD.org
The data in Asterisk-Last-Data is something like SIP/7874338439@SIPprovider.
I would like to save only the 7874338439 data in Called-Station-Id.
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}" } } Does that work for you? :-) Stefan Paetow Moonshot Industry & Research Liaison Coordinator t: +44 (0)1235 822 125 gpg: 0x3FCE5142 xmpp: stefanp@jabber.dev.ja.net skype: stefan.paetow.janet jisc.ac.uk Jisc is a registered charity (number 1149740) and a company limited by guarantee which is registered in England under Company No. 5747339, VAT No. GB 197 0632 86. Jisc’s registered office is: One Castlepark, Tower Hill, Bristol, BS2 0JA. T 0203 697 5800.
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
participants (3)
-
A.L.M.Buxey@lboro.ac.uk -
Stefan Paetow -
Willy Offermans