<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Hi,<div><br></div><div>You can store the timestamp of the last message of interest in a transaction-persistent variable - that is, an AVP or XAVP - using $TV():</div><div><br></div><div><a href="https://www.kamailio.org/wiki/cookbooks/5.4.x/pseudovariables#tv_name">https://www.kamailio.org/wiki/cookbooks/5.4.x/pseudovariables#tv_name</a></div><div><br></div><div>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. :-)</div><div><br></div><div><pre style="-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); word-wrap: break-word;"> # 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
        );</pre><pre style="-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); word-wrap: break-word;"><br></pre></div><div><div dir="ltr">— Alex</div><div id="AppleMailSignature" dir="ltr"><br></div><div dir="ltr">—<div>Sent from my iPad</div></div><div dir="ltr"><br><blockquote type="cite">On Feb 9, 2021, at 9:40 AM, David Villasmil <david.villasmil.work@gmail.com> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr">Hello all,<div dir="auto"><br></div><div dir="auto">Is it possible to know the elapsed time since the previously received message?</div><div dir="auto"><br></div><div dir="auto">On outgoing calls, I.e: when i get a 180, how long did the 100 arrived? Or the INVITE...</div><div dir="auto"><br></div><div dir="auto">Thanks</div><div dir="auto"><br></div><div dir="auto">David </div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div>
<span>_______________________________________________</span><br><span>Kamailio (SER) - Users Mailing List</span><br><span>sr-users@lists.kamailio.org</span><br><span>https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</span><br></div></blockquote></div></body></html>