Thanks Tim.
I'm using oracle database trigger to calculate the credit amount and add it to radreply:
 
at the conclusion of each call,  i use trigger to calculate the amount left according to calledstationid and username, the unit price is also in the table. the formular is "amount left = amount left - amount used" .
 
your fomular : "time left=time left-call duration"  can not be used at the conclusion of a call. To different destination country code or area code, unit price is different. thus time calculation should be used after user dial the destination phone number and i'll check the unit  price table in database to  calculate the time that use can use.  the formular is: "time left = amount left / unit price", thus I think this calculation can only be used after authorization request and before authorization response.
am i right?  or you can explain to me in more detail if i misunderstood your solution.
 
regards
Alex Zhang
----- Original Message -----
Sent: Thursday, January 16, 2003 11:51 AM
Subject: RE: Authorization

Here is a best guess.
 
FR is only going to issue queries as defined in the config file for oracle. 
The only queries that are going to work for auths are going to be selects, since you must retreive data for an auth.
 
I think you need to calculate the credit time based on a DB trigger in the Accounting table at the conclusion of each call, and use that to update radreply and or radcheck as may be necessary.  Each trigger execution should probably be something like "time left=time left-call duration" so that if you purge the accounting tables, the lost records won't matter.
 
This will likely perform better for auths also, since you aren't executing a potentially long running trigger at auth time.
 
I dont think ExecProgramWait is going to do what you want at all.
 
Tim
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Alex Zhang
Sent: Wednesday, January 15, 2003 9:28 PM
To: [EMAIL PROTECTED]
Subject: Authorization

Hi,
I'm trying to use freeradius0.8.1 and oracle with quintum box to build a prepaid voip system.
currently, i have a problem:
 
i can not modify or insert the h323-credit-time in radreply when authorizing. If I can insert the calledsessionid and username into oracle, i think i can write a database trigger to calcute the credit-time and insert it into radreply. but the problem is i don't know how to interact with oracle in authorizaion stage. 
 
I checked this list to find "Exec-Program-Wait" can be used. One of the method is to write a c programm. Is it possible to use sqlplus and sql script file? have anyone tried this way?
 
Thanks in advanced.
 
Alex Zhang

Reply via email to