[OpenSER-Users] How to set a fixed string as acc "extra" field?

Jesus Rodriguez jesusr at voztele.com
Fri Feb 8 00:10:54 CET 2008


Hola Iñaki,


> Hi, imagine I need to log two extra fields in accounting:
>
>  - Source-IP
>  - Proxy-IP
>
> "Source-IP" will be dynamic containing the value of $si.
> "Proxy-IP" is a fixed string value = "88.88.88.88", but... how to  
> log this
> value?:
>
> * modparam("acc", "radius_extra", "Source-IP=$si; Proxy- 
> IP=88.88.88.88")
> Of course the above line fails since the IP string should be a text  
> so should
> be between " ":
>
> * modparam("acc", "radius_extra", "Source-IP=$si; Proxy- 
> IP="88.88.88.88"")
> This fails obviously.
>
> * modparam("acc", "radius_extra", "Source-IP=$si; Proxy-IP= 
> \"88.88.88.88\"")
> This fails too.
>
> * modparam("acc", "radius_extra", "Source-IP=$si; Proxy- 
> IP='88.88.88.88' ")
> This fails too.
>
> Is it impossible? any suggestion?
>
>
> PD: Yes, I know I can do a bit "dirty" trick:
>  modparam("acc", "radius_extra", "Source-IP=$si; Proxy-IP=$var(proxy- 
> ip)")
>  ...
>  $var(proxy-ip) = "88.88.88.88";
>
> but I'd prefer not to do it.


Try something like:


modparam("acc", "radius_extra", "SrcIP=$avp(srcip); ProxyIP= 
$avp(proxyip)")
...
if is_method("INVITE") { /* or the logic you need */
	$avp(srcip) = $si;
	$avp(proxyip)= "whatever_string_you_want";
}

After that just define both SrcIP and ProxyIP attributes in your  
radius dictionaries (both client and server).


Saludos
JesusR.

------------------------------------
Jesus Rodriguez
VozTelecom Sistemas, S.L.
jesusr at voztele.com
http://www.voztele.com
Tel. 902360305
-------------------------------------








More information about the Users mailing list