(RADIATOR) Re: how to reject START

Hugh Irvine hugh at open.com.au
Wed Aug 25 21:40:37 CDT 2004


Hello Mohammad -

Further to this, it is generally much more useful to keep the  
timestamps in the database in UNIX format and then output the  
information in whatever format is required.

Here is an example:


mysql> select USERNAME ,FROM_UNIXTIME(TIME_STAMP,'%D %M %h:%i:%s %x')   
from
   RADONLINE where USERNAME = 'xxxxx';
+-------------------------------- 
+-----------------------------------------------+
| USERNAME                       | FROM_UNIXTIME(TIME_STAMP,'%D %M  
%h:%i:%s %x') |
+-------------------------------- 
+-----------------------------------------------+
| xxxxx                                  | 26th August 12:22:09 2004     
                  |
+-------------------------------- 
+-----------------------------------------------+
1 row in set (0.00 sec)


FROM_UNIXTIME(unix_timestamp,format)
     Returns a representation of the unix_timestamp argument as a value  
in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether  
the function is used in a string or numeric context.

mysql> SELECT FROM_UNIXTIME(875996580);
         -> '1997-10-04 22:23:00'
mysql> SELECT FROM_UNIXTIME(875996580) + 0;
         -> 19971004222300

     If format is given, the result is formatted according to the format  
string. format may contain the same specifiers as those listed in the  
entry for the DATE_FORMAT() function.

mysql> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(),
     ->                      '%Y %D %M %h:%i:%s %x');
         -> '2003 6th August 06:22:58 2003'


See also

	http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html

Other databases have similar functions.

Thanks to Paul at Connect for the pointers.

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