Hi,

You can store the timestamp of the last message of interest in a 
transaction-persistent variable - that is, an AVP or XAVP - using $TV():

https://www.kamailio.org/wiki/cookbooks/5.4.x/pseudovariables#tv_name

Then, you can do some arithmetic like this to turn the difference between two 
timestamps into milliseconds. This is stolen straight from CSRP so adapt to 
your needs. :-)

        # Log request processing time.

        $var(cur_time) = $TV(Sn);

        $var(proc_diff) = (
                (((
                  $(var(cur_time){s.select,0,.}{s.int}) - 
                  $(avp(proc_start){s.select,0,.}{s.int})
                ) * 1000000)
                + 
                (
                 $(var(cur_time){s.select,1,.}{s.int}) - 
                 $(avp(proc_start){s.select,1,.}{s.int}) 
                ) / 1000) mod 1000
        );

— Alex

—
Sent from my iPad

> On Feb 9, 2021, at 9:40 AM, David Villasmil <[email protected]> 
> wrote:
> 
> Hello all,
> 
> Is it possible to know the elapsed time since the previously received message?
> 
> On outgoing calls, I.e: when i get a 180, how long did the 100 arrived? Or 
> the INVITE...
> 
> Thanks
> 
> David 
> -- 
> Regards,
> 
> David Villasmil
> email: [email protected]
> phone: +34669448337
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> [email protected]
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to