Help on adding value to mysql
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
No ideas to help me a little? At least to know if what described is possible. Thank's Simon Simone Felici ha scritto in data 16/10/2009 11.26:
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 - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-- Simone Felici E-Mail: s.felici@alpikom.it Divisione Tecnica Tel: 0461 030 111 Alpikom S.p.A. Fax: 0461 030 112 v.Fersina, 23 - 38123 Trento URL: http://www.alpikom.it
participants (1)
-
Simone Felici