[Users] more on accounting

Cseke Tamas cseke.tamas at eworldcom.hu
Wed Sep 6 10:11:35 CEST 2006


Hi

I've an accounting problem, i think you could maybe help me.

we'd like to use radius accounting with openser.
We'd like to set setuptime, connecttime, endtime in Cdr-s for rating.
Our openser has no database connection, so ew can't use your solution( 
store avps in database)

i planned to send accounting packets to radius on INVITE , ACK and BYE.
And in radius module (BSDRadius) store the system time into database on 
INVITE for setuptime , on ACK for connecttime and on
BYE for endtime,

But the accounting packet for INVITE (Sip-Method: INVITE, 
Acct-Status-Type: Start) radius doest' receive
correct in time, openser send it almost in the same time as the packet 
for ACK, so setuptime is not correct, it is almost equal to connecttime, 
however the phone was ringing long.
And we would like some reliable method for storing the time informations.
Because of the network delay between openser and radius the time 
information can be not correct exactly.


Please let me know, why the accounting packets for INVITE is sent in 
incorrect way, and
if someone know a better solution for storing a setuptime, connecttime 
and endtime for a cdr please let me know.
Is there any radius attributes for example in which we can send this 
time informations to radius server?

Thanks any help
Tamas

>Hi tamas,
>
>Contact me if you need more information.
>What you can do depend on your billing system.
>
>This is what i have done from OpenSER:
>
># avpops params
>modparam("avpops","avp_url","mysql://openser:openserrw@localhost/openser")
>modparam("avpops", "avp_table", "usr_preferences")
>
>
># avp for accounting
>modparam("avpops","avp_aliases","setup_time=s:setup_time")
>modparam("avpops","avp_aliases","connect_time=s:connect_time")
>modparam("avpops","avp_aliases","disconnect_time=s:disconnect_time")
>modparam("avpops","avp_aliases","remote_address=s:remote_address")
>modparam("avpops","avp_aliases","valid_call=s:valid_call")
>
>
>   if (!method=="REGISTER")
>      record_route();
>
>   # ACCOUNTING
>   if (is_method("INVITE"))
>   {
>      avp_write("$Ts","$avp(setup_time)");
>      avp_db_store("$ci","$avp(setup_time)");
>
>      # invite come from PSTN this call should not be accounted
>      if (src_ip=='PSTNGW')
>      {
>         avp_write("no","$avp(valid_call)");
>         avp_db_store("$ci","$avp(valid_call)");
>      } else {
>         # valid call this must accounted
>         avp_write("yes","$avp(valid_call)");
>         avp_db_store("$ci","$avp(valid_call)");
>      };
>
>   } else if (is_method("ACK")) {
>      avp_write("$Ts","$avp(connect_time)");
>      avp_db_store("$ci","$avp(connect_time)");
>   } else if (is_method("BYE")) {
>      avp_write("$Ts","$avp(disconnect_time)");
>      avp_db_store("$ci","$avp(disconnect_time)");
>
>      avp_write("82.215.163.5","$avp(remote_address)");
>      avp_db_store("$ci","$avp(remote_address)");
>
>   };
>
>   if (is_method("BYE"))
>   {  
>      avp_db_query("select value from usr_preferences where uuid='$ci'
>and attribute='setup_time'","$avp(setup_time)");
>      avp_db_query("select value from usr_preferences where uuid='$ci'
>and attribute='connect_time'","$avp(connect_time)");
>      avp_db_query("select value from usr_preferences where uuid='$ci'
>and attribute='disconnect_time'","$avp(disconnect_time)");
>      avp_db_query("select value from usr_preferences where uuid='$ci'
>and attribute='valid_call'","$avp(valid_call)");
>
>      avp_db_load("$ci","$avp(remote_address)");
>      avp_print();
>
>      # BYE from announcement server or valid call
>      # not account this call
>      if (!src_ip=='ANNSERVER' and
>avp_check("$avp(valid_call)","eq/yes/g"))
>      {
>	 # send radius acct
>         setflag(3);
>         setflag(5);
>      };
>
>   };
>   
>   # clean avps from db
>   if (is_method("BYE|CANCEL"))
>   {
>      avp_db_delete("$ci","$avp(setup_time)");
>      avp_db_delete("$ci","$avp(connect_time)");
>      avp_db_delete("$ci","$avp(disconnect_time)");
>      avp_db_delete("$ci","$avp(remote_address)");
>      avp_db_delete("$ci","$avp(valid_call)");
>   };
>
>
>On Wed, 2006-07-12 at 14:53 +0200, Cseke Tamas wrote:
>  
>
>>>modparam("acc", "radius_extra", "h323-setup-time=$avp(setup_time); 
>>>h323-connect-time=$avp(connect_time); 
>>>h323-disconnect-time=$avp(disconnect_time); 
>>>      
>>>
>>Hello,
>>
>>I need this time informations for radius accounting, and  i must decide  
>>to  make this  avps in openser, or  manage this times  in radius server
>>(in BSDRadius it's not so difficult...)
>>
>>I quess it'is not so easy to make this avps in openser,
>>    -create timestamp for particular messages (invite, ack, bye)
>>    -store the avps in database
>>    -and send to radius this attributes on accounting-request
>>
>>Do you use this method, or is there any better solution?
>>
>>Thanks any help,
>>Tamas
>>    
>>
>
>
>_______________________________________________
>Users mailing list
>Users at openser.org
>http://openser.org/cgi-bin/mailman/listinfo/users
>
>  
>





More information about the Users mailing list