(RADIATOR) Re: how to reject START

Hugh Irvine hugh at open.com.au
Wed Aug 25 20:58:37 CDT 2004


Hello Mohammad -

Here is one way to do what you want:

<Handler ....>
	
	PreAuthHook %D/addTimestampStart

	<AuthBy SQL>
		.....
		AcctColumnDef   TIME_STAMP,Timestamp,formatted-date,to_date\
			('%d %m         %Y %H:%M:%S', 'DD MM YYYY HH24:MI:SS')

		AcctColumnDef   START_TIME,Timestamp-Start,formatted-date,to_date\
			('%d %m         %Y %H:%M:%S', 'DD MM YYYY HH24:MI:SS')

	</AuthBy>

</Handler>


The hook code would look like this (in the file "addTimestampStart" in 
the directory referenced by %D):

# addTimestampStart

sub
{
     my $p = ${$_[0]};

     my $status = $p->get_attr('Acct-Status-Type'};

     return unless $status eq 'Stop';

     my $timestamp = $p->get_attr('Timestamp');

     my $duration = $p->get_attr('Acct-Session-Time');

     $p->add_attr('Timestamp-Start', $timestamp-$duration);

     return;
}


Note that I have not tested the above, but it should give you an idea 
of how to do it.

There are also some example hooks in the file "goodies/hooks.txt".

regards

Hugh



On 25 Aug 2004, at 22:41, Mohammad Junaid wrote:

> Hi Hugh,
> Below are two lines from my cfg files, now I am getting start time in 
> the
> accounting but it is coming as integer, I want to have it as date and 
> time,
> I tried to make it similar to the TIME_STAMP (stop) which is appearing 
> as
> date format but since it has subtraction it didn't work. Any idea?
>
>         AcctColumnDef   TIME_STAMP,Timestamp,formatted-date,to_date\
>         ('%d %m         %Y %H:%M:%S', 'DD MM YYYY HH24:MI:SS')
>
>         AcctColumnDef   START_TIME,%b-0%{Acct-Session-Time},literal
>
> ----- Original Message -----
> From: "Hugh Irvine" <hugh at open.com.au>
> To: "Mohammad Junaid" <mjunaid at cyberia.net.sa>
> Cc: <radiator at open.com.au>
> Sent: Wednesday, August 25, 2004 12:04 PM
> Subject: Re: how to reject START
>
>
>>
>> Hello -
>>
>> What I described is what you should do when you insert the data into
>> the database.
>>
>> regards
>>
>> Hugh
>>
>>
>> On 25 Aug 2004, at 18:53, Mohammad Junaid wrote:
>>
>>> Hi,
>>> Yes we can do some thing like this at the billing system level , but 
>>> I
>>> want
>>> to do this at the radius leve before we insert the data into the
>>> database.
>>> Is it possible?
>>>
>>> Mohammad Junaid
>>> ----- Original Message -----
>>> From: "Hugh Irvine" <hugh at open.com.au>
>>> To: "Mohammad Junaid" <mjunaid at cyberia.net.sa>
>>> Cc: <radiator at open.com.au>
>>> Sent: Wednesday, August 25, 2004 11:46 AM
>>> Subject: Re: how to reject START
>>>
>>>
>>>>
>>>> Hello -
>>>>
>>>> You can simply subtract the Acct-Session-Time from the Timestamp 
>>>> which
>>>> will give you the start time.
>>>>
>>>> regards
>>>>
>>>> Hugh
>>>>
>>>>
>>>> On 25 Aug 2004, at 18:13, Mohammad Junaid wrote:
>>>>
>>>>> Hi Hugh,
>>>>>
>>>>> I used "HandleAcctStatusTypes Stop" in my <AuthBy SQL> and it 
>>>>> worked
>>>>> great.
>>>>> Thanks for your help. One more question, presently I am getting
>>>>> disconnect
>>>>> time as timestamp which make sense as it is coming with stop record
>>>>> but is
>>>>> there any way we can get start time as timestamp with stop record. 
>>>>> It
>>>>> will
>>>>> be more user freindly for our support staff to have connect time in
>>>>> the
>>>>> CDRs.
>>>>>
>>>>> Mohammad Junaid.
>>>>>
>>>>> ----- Original Message -----
>>>>> From: "Hugh Irvine" <hugh at open.com.au>
>>>>> To: "Mohammad Junaid" <mjunaid at cyberia.net.sa>
>>>>> Cc: <radiator at open.com.au>
>>>>> Sent: Wednesday, August 25, 2004 1:00 AM
>>>>> Subject: Re: how to reject START
>>>>>
>>>>>
>>>>>
>>>>> Hello -
>>>>>
>>>>> The answer to this depends somewhat on what else you are doing in
>>>>> your
>>>>> configuration file.
>>>>>
>>>>> Here is one way:
>>>>>
>>>>> <Handler Acct-Status-Type = Stop>
>>>>> # deal with stops
>>>>> .....
>>>>> </Handler>
>>>>>
>>>>> <Handler>
>>>>> # deal with everything else
>>>>> .....
>>>>> </Handler>
>>>>>
>>>>> You can also do something similar in your AuthBy SQL clause:
>>>>>
>>>>> <AuthBy SQL>
>>>>> # deal with stops only
>>>>> HandleAcctStatusTypes Stop
>>>>> .....
>>>>> </AuthBy>
>>>>>
>>>>> regards
>>>>>
>>>>> Hugh
>>>>>
>>>>>
>>>>> On 24 Aug 2004, at 20:54, Mohammad Junaid wrote:
>>>>>
>>>>>> Hi,
>>>>>> Our NAS is sending Start and Stop packets, due to this reason we
>>>>>> have
>>>>>> two records every time a users connects and then disconnects . We
>>>>>> want
>>>>>> only one record (CDR) for each user who connects and then
>>>>>> disconnects.
>>>>>> Due to debugging requirement we cannot stop NAS to generate START
>>>>>> packet, therefore we want radiator to ignore START packet and only
>>>>>> accept STOP packet. How we can achieve this.
>>>>>>
>>>>>> Mohammad Junaid
>>>>>>
>>>>>
>>>>> NB: have you included a copy of your configuration file (no 
>>>>> secrets),
>>>>> together with a trace 4 debug showing what is happening?
>>>>>
>>>>> -- 
>>>>> Radiator: the most portable, flexible and configurable RADIUS 
>>>>> server
>>>>> anywhere. Available on *NIX, *BSD, Windows, MacOS X.
>>>>> -
>>>>> Nets: internetwork inventory and management - graphical, 
>>>>> extensible,
>>>>> flexible with hardware, software, platform and database 
>>>>> independence.
>>>>> -
>>>>> CATool: Private Certificate Authority for Unix and Unix-like 
>>>>> systems.
>>>>>
>>>>>
>>>>>
>>>>
>>>> NB: have you included a copy of your configuration file (no 
>>>> secrets),
>>>> together with a trace 4 debug showing what is happening?
>>>>
>>>> -- 
>>>> Radiator: the most portable, flexible and configurable RADIUS server
>>>> anywhere. Available on *NIX, *BSD, Windows, MacOS X.
>>>> -
>>>> Nets: internetwork inventory and management - graphical, extensible,
>>>> flexible with hardware, software, platform and database 
>>>> independence.
>>>> -
>>>> CATool: Private Certificate Authority for Unix and Unix-like 
>>>> systems.
>>>>
>>>>
>>>
>>>
>>
>> NB: have you included a copy of your configuration file (no secrets),
>> together with a trace 4 debug showing what is happening?
>>
>> -- 
>> Radiator: the most portable, flexible and configurable RADIUS server
>> anywhere. Available on *NIX, *BSD, Windows, MacOS X.
>> -
>> Nets: internetwork inventory and management - graphical, extensible,
>> flexible with hardware, software, platform and database independence.
>> -
>> CATool: Private Certificate Authority for Unix and Unix-like systems.
>>
>
>

NB: have you included a copy of your configuration file (no secrets),
together with a trace 4 debug showing what is happening?

-- 
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. Available on *NIX, *BSD, Windows, MacOS X.
-
Nets: internetwork inventory and management - graphical, extensible,
flexible with hardware, software, platform and database independence.
-
CATool: Private Certificate Authority for Unix and Unix-like systems.

--
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list