[asterisk-dev] Timeout Values

Daniel Hazelbaker daniel at highdesertchurch.com
Tue Dec 4 18:21:44 CST 2007


I have been going through starting to work on a patch to make the  
digit and response timeouts all floating point (i.e. millisecond)  
aware.  Everything is going fine but I am running into a point of  
confusion that I would like to get some feedback on.

In some places the timeouts are logged (via ast_log) as second  
values.  In other places, these timeouts are logged as millisecond  
values.  This brings two questions for feedback:

#1 Should everything be logged as seconds (rounded down),  
milliseconds, or floating point ("1.2" seconds)?
#2 When retrieving the timeout value in the dialplan should it return  
the same as #1 or continue to return a whole number or always floating  
point?

Caveat 1 - There is a potential compatibility issue with #2.  Changing  
this to millisecond could cause some problems in peoples dialplans to  
say nothing about getting a millisecond precise value when requesting  
the "when to hangup" timeout.  Floating point values could cause  
problems too, but probably a lot less as general math should still work.

Caveat 2 - The timeout(a) values, "when to hangup" are still whole  
numbers as asterisk doesn't do millisecond timing on how long a  
channel has been up, so while this could "accept" a millisecond value  
it wouldn't do any good and it would always return a second-precise  
value.  This is not so much an issue as a by the way.

If this patch is not implemented, though, somebody should go through  
and fix-up the code.  It looks like there are a few places where  
dtimeout is used and passed directly to a function that is expecting a  
millisecond value instead of a second value so instead of waiting 2  
seconds it is only waiting 2 milliseconds.  I'm surprised nobody has  
run into a problem related to this before.

Regards,
Daniel Hazelbaker



More information about the asterisk-dev mailing list