[RADIATOR] Local Variable

Andrea Coppini (AIR Networks) andrea at air.com.mt
Mon Jul 6 13:34:03 CDT 2009


Hi,

I'm trying to do a seemingly simple thing in the config file.

I have a setup which relies heavily on CSV files.  Without going into the
merits of doing this, I need to generate a CSV file with the current time
down to the millisecond, then I need to write the accounting record to it.
Something like this...

<Handler Request-Type=Accounting-Request>
    <AuthBy SQL>
    	HandleAcctStatusTypes Stop
	DBSource dbi:CSV:f_dir=C:\hotspot-gateway;

	AcctSQLStatement CREATE TABLE %Y%m%d-%H%M%S-%s (rmnum INTEGER,
time_session CHAR(64), time_in CHAR(64), time_out CHAR(64), endreason
CHAR(64))

	AccountingTable	%Y%m%d-%H%M%S-%s
	AcctColumnDef	rmnum,User-Name
	AcctColumnDef	time_session,Acct-Session-Time,integer
	AcctColumnDef	time_out,Timestamp,integer-date
	AcctColumnDef	endreason,Acct-Terminate-Cause
    </AuthBy>
</Handler>


With this, the file gets generated correctly, but since there is a very
slight lag between the creation of the file and RADIATOR opening it to
process it, the millisecond variable would have changed by the time it gets
to the AccountingTable line.

So I was wondering if it would be possible to define a local variable (eg.
$thisfile) with the current time assigned to it, then have a
"AcctSQLStatement CREATE TABLE $thisfile....etc" and "AccountingTable
$thisfile" on the following line.

But I can't find a way to define a variable... can I? how?

I'm a bit green on this.. so please bear with me!


Thanks & Regards
Andrea Coppini
AIR Networks Co. Ltd.
Malta



More information about the radiator mailing list