30 Mar
2010
30 Mar
'10
5:05 p.m.
I am receiving certain accounting attributes as hex encoded strings, and I would like to convert them back to cleartext ASCII before sending them to MySQL. I can't simply update the SQL with UNHEX() functions, as not all of the requests are hex encoded this way. If I could use perl, I would do something like this: preacct { if ("%{SomeAtribute}" =~ /^MATCHING\:(.+)\:MATCHING$/) { update request { Calling-Station-Id := s/([a-fA-F0-9]{2})/chr(hex(%{1}))/eg } } ... } Maybe I can simply flag these attributes somehow by prefixing them with "FLAG::", and use the MySQL IF() function to "post process" them with the UNHEX() function? Any help would be appreciated. Thanks! --Aaron