[SR-Users] Time elapsed since previous message.

Raúl Alexis Betancor Santana rbetancor at serlink.es
Wed Feb 10 12:05:07 CET 2021


What is the point of refusing a call that answer with a 100/183 "too quickly" ? ... I don't get the point on that. 

Saludos 
-- 
Raúl Alexis Betancor Santana 
Serlink Telecom S.R.L.U. 


De: "David Villasmil" <david.villasmil.work at gmail.com> 
Para: "Kamailio (SER) - Users Mailing List" <sr-users at lists.kamailio.org> 
Enviados: Miércoles, 10 de Febrero 2021 9:57:35 
Asunto: Re: [SR-Users] Time elapsed since previous message. 

Hello Alex, 
Again thanks. 

I'm using that calculation to, when receiving a 180/3, if it comes in too quickly (i.e. 100ms) i cancel that call, and send a 480 the the A leg. 
I haven't found way of doing this, is this possible at all? I trired setting a very low t_set_fr(10,10) (0 means set the default), but that's not working... 

Is there a way of doing this? 

Thanks! 
Regards, 

David Villasmil 
email: [ mailto:david.villasmil.work at gmail.com | david.villasmil.work at gmail.com ] 
phone: +34669448337 


On Tue, Feb 9, 2021 at 3:31 PM David Villasmil < [ mailto:david.villasmil.work at gmail.com | david.villasmil.work at gmail.com ] > wrote: 



Thanks Alex, 

Exactly what I was thinking. Just wondering whether there was a better way. 

Again THANKS! 

David 

On Tue, 9 Feb 2021 at 14:56, Alex Balashov < [ mailto:abalashov at evaristesys.com | abalashov at evaristesys.com ] > wrote: 

BQ_BEGIN

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 | 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,.}{ [ http://s.int/ | s.int ] }) - 
		  $(avp(proc_start){s.select,0,.}{ [ http://s.int/ | s.int ] })
		) * 1000000)
		+ 
		(
		 $(var(cur_time){s.select,1,.}{ [ http://s.int/ | s.int ] }) - 
		 $(avp(proc_start){s.select,1,.}{ [ http://s.int/ | s.int ] }) 
		) / 1000) mod 1000
	); 

— Alex 

— 
Sent from my iPad 


BQ_BEGIN
On Feb 9, 2021, at 9:40 AM, David Villasmil < [ mailto:david.villasmil.work at gmail.com | david.villasmil.work at gmail.com ] > wrote: 





BQ_BEGIN

Hello all, 

BQ_END


BQ_BEGIN


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: [ mailto:david.villasmil.work at gmail.com | david.villasmil.work at gmail.com ] 
phone: +34669448337 

BQ_END


BQ_BEGIN

_______________________________________________ 
Kamailio (SER) - Users Mailing List 
[ mailto:sr-users at lists.kamailio.org | sr-users at lists.kamailio.org ] 
[ https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users | https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users ] 

BQ_END

_______________________________________________ 
Kamailio (SER) - Users Mailing List 
[ mailto:sr-users at lists.kamailio.org | sr-users at lists.kamailio.org ] 
[ https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users | https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users ] 

BQ_END

-- 
Regards, 

David Villasmil 
email: [ mailto:david.villasmil.work at gmail.com | david.villasmil.work at gmail.com ] 
phone: +34669448337 

BQ_END


_______________________________________________ 
Kamailio (SER) - Users Mailing List 
sr-users at lists.kamailio.org 
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20210210/39470b63/attachment.htm>


More information about the sr-users mailing list