Help on adding value to mysql
Simone Felici
s.felici at alpikom.it
Fri Oct 16 11:26:10 CEST 2009
Hello to all,
I've freeradius installed on a CentOS 4.5: freeradius-1.1.5-0.
I would like to add a new field to my radacct table to log a new value taken from sip/ser accounting. Until here ok,
It's sufficient to alter the table, add the value into proper dictionary and alter the sql inserts to add the value.
What I would like to do is to modify the value BEFORE insert it into mysql.
The detail-file logs the following value:
(...)
Sip-Translated-Request-ID = "sip:<PHONE-NUMBER>@<IP-ADDRESS>:<PORT>;transport=udp"
(...)
Also I would like to add to MySQL (radacct) the Sip-Translated-Request-ID field, BUT ONLY the <IP-ADDRESS>.
I should execute a sort of regexp or something that gives me the following result, for example:
Sip-Translated-Request-ID = `echo "sip:<PHONE-NUMBER>@<IP-ADDRESS>:<PORT>;transport=udp" | awk -F@ '{ print $2 }' | awk
-F: '{ print $1 }'`
This would return me only the IP-ADDRESS to add within '%{Sip-Translated-Request-ID}'.
Can someone help me a little bit?
Thank's
Simon
More information about the Freeradius-Users
mailing list