How accurate is TIMEOUT(absolute)?

I use asterisk 1:15.2.1~dfsg-1+deb10u2 from the debian buster distribution.
I run the chan_sip.so module.

in my dialplan I have this:

exten => 7001,1,Set(TIMEOUT(absolute)=10)
exten => 7001,n,Answer()
exten => 7001,n,Set(i=1)
exten => 7001,n,While(True)
exten => 7001,n,SayNumber(${i})
exten => 7001,n,Wait(1)
exten => 7001,n,Set(i=$[${i} + 1])
exten => 7001,n,EndWhile()
exten => 7001,n,Hangup()

and it works. But …

how accurate is TIMEOUT(absolute)=10 ?
I have seen I can also configure TIMEOUT(absolute)=9.995 Should it make a difference ?

The source e.g: funcs/func_timeout.c that uses function ast_tvdiff_ms to set ast_channel_whentohangup lets me assume it is millisecond accurate. Is this true ?

Can I then expect millisecond accuracy ?

Does the TIMEOUT use the time between the “SIP OK” after “SIP INVITE” and the SIP BYE ?

In my tcpdump pcap files I see times between 10.006 sec to 10.025 sec if I check “SIP OK” to “SIP BYE”.

Is there a better way to make sure a call is exactly 10sec long (no millisec longer) ?

Things take time to process both on your own system, in Asterisk, across the network, and anything remote. It’s not possible to have it be exactly 10 seconds.

Measured where? Speed of light considerations apply, for a start, but there will be much larger network propagation delays, and you may lose packets.

For me it would be enough if I could see that my asterisk machine would send the “BYE” exactly 10sec after the “SIP OK”. So network does not matter for this local tcpdump.

It’s really still not possible.

thank you for answer. I will only measure locally. You are right I can lose packets. But I will only do a local tcpdump. I only want to see that my asterisk after it gets the “SIP OK” sends a BYE exact after 10sec.

So does it make a difference in the internal processing of asterisk if I configure one of the 3 lines:
TIMEOUT(absolute)=9.995
TIMEOUT(absolute)=10
TIMEOUT(absolute)=10.005 ?

Or does asterisk do some rounding ?

I can’t think why anyone would care enough to check the code. Also, the machine architecture will affect the resolution, as I think will some OS configuration options.

I rather suspect the OS only guarantees at least a specified delay.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.