[OpenSIPS-Users] R: R: R: Milliseconds in the accounting table

Mauro Davi' mauro.davi at acotel.com
Tue Feb 17 16:07:09 CET 2009


Thanks so much Bogdan, now the script works fine.

-----Messaggio originale-----
Da: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro] 
Inviato: martedì 17 febbraio 2009 13:38
A: Mauro Davi'
Cc: users at lists.opensips.org
Oggetto: Re: R: R: [OpenSIPS-Users] Milliseconds in the accounting table

Hi Mauro,

Use $var() in the acc params. If you want to use AVPs, you have to set 
in TM the "onreply_avp_mode" param to 1:
    http://www.opensips.org/html/docs/modules/1.4.x/tm.html#id270504

By default, the avps from onreply route are not attached to transaction, 
so not available for Acc.

Regards,
Bogdan

Mauro Davi' wrote:
> Hi Bogdan,
>
> Below the code used in the script...
>
> modparam("acc", "multi_leg_info", "src_leg=$avp(i:901);dst_leg=$avp(i:902)")
>
>
> onreply_route[1]
> {
>    if (t_check_status("200"))
>    {
>       setflag(4);
>       setflag(24);
>       setflag(25);
>       $avp(s:acc_caller_user) = $fU;
>       $avp(s:acc_caller_domain) = $fd;
>       $avp(s:acc_callee_user) = $rU;
>       $avp(s:acc_callee_domain) = $rd;
>       avp_printf("$avp(s:received_time)", "$time(year)/$time(mon)/
>          $time(mday)$time(hour):$time(min):$time(sec).$time(msec)");
>       avp_printf("$avp(i:901)","$avp(s:acc_caller_user)|
>          $avp (s:acc_caller_domain)|$avp(s:received_time)");
>       avp_printf("$avp(i:902)","$avp(s:acc_callee_user)|
>          $avp(s:acc_callee_domain)|$avp(s:received_time)");
>       xlog("L_INFO", "200 OK received $avp(i:901) $avp(i:902)!!!\n");
>    }
> }
>
> Is there something wrong? I need to use var(x) or can I use the avp variable?
>
> Regards
>     MD
>
> -----Messaggio originale-----
> Da: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro] 
> Inviato: martedì 17 febbraio 2009 00:02
> A: Mauro Davi'
> Cc: users at lists.opensips.org
> Oggetto: Re: R: [OpenSIPS-Users] Milliseconds in the accounting table
>
> Hi Mauro,
>
> are you sure you added an onreply_route[] for the call and store the 
> time into the $var(x)?
>
>     onreply_route[1] {
>        if (t_check_status("200")) {
>           $var(x) = $Ts;
>        }
>     }
>
> and set $var(x) as extra acc :
>     modparam("acc", "db_extra", "custom_time=$var(x)")
>
> Regards,
> Bogdan
>
>
> Mauro Davi' wrote:
>   
>> Hi Bogdan,
>>
>> I modified the script as you said but in the DB there is always the same
>> problem.
>> I used an avp variable to store the time value in the onreply_route
>> function, now I invoke the t_on_reply()function before the INVITE
>> t_relay() function.
>> When the server received the 200 OK (onreply_route function), I see the
>> correct time value in the log file, but the stored value on the DB is
>> different. It is the time taken at the INVITE received time...I Think...
>> Any suggestions??
>>
>> Thanks a lot
>>     MD
>>
>> -----Messaggio originale-----
>> Da: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro] 
>> Inviato: sabato 14 febbraio 2009 22:22
>> A: Mauro Davi'
>> Cc: users at lists.opensips.org
>> Oggetto: Re: [OpenSIPS-Users] Milliseconds in the accounting table
>>
>> Hi Mauro,
>>
>> The "time" for accounting is when the reply is received - for the acc'ed
>>
>> INVITEs, it is the time for the 200 OK reply.
>>
>> So, what you can do is to use onreply_route to store in a $var(x) the 
>> string with the time representation you want and set $var(x) as extra
>> acc;
>>
>> Regards,
>> Bogdan
>>
>> Mauro Davi' wrote:
>>   
>>     
>>> Hi,
>>>
>>> I'm always a newbye so be patient.
>>>
>>> I need to trace in the accounting table the start/stop dialog time in 
>>> milliseconds.
>>>
>>> I don't know if this is the correct way, but I modified the cfgutils. 
>>> Now I can write $time(msec) and I receive the millisecs...
>>>
>>> So I store this information in an avp variable that I store on the DB 
>>> in the acc table via the multi_leg_info parameter.
>>>
>>> Obviusly I store the entire date time in the form 
>>> $time(year)/$time(mon)/$time(mday) 
>>> $time(hour):$time(min):$time(sec).$time(msec).
>>>
>>> Problem: The date time stored for the INVITE message, with this method
>>>     
>>>       
>>   
>>     
>>> differ to the time writed in the time field on the same acc table...
>>>
>>> I think that the time saved in the time field is that of the received 
>>> ACK message... On the otherhand the time saved with the multi_leg_info
>>>     
>>>       
>>   
>>     
>>> is the time of the first INVITE...
>>>
>>> I need the correct date time with millisecs of a dialog start/stop, so
>>>     
>>>       
>>   
>>     
>>> the time field in the accounting table isn't good enough...
>>>
>>> Any suggestion to bypass this problem?
>>>
>>> Thanks in advance
>>>
>>> MD
>>>
>>>
>>>     
>>>       
>> ------------------------------------------------------------------------
>>   
>>     
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>   
>>>     
>>>       
>>   
>>     
>
>
>   




More information about the Users mailing list