[Home]

Summary:ASTERISK-10153: timeout value should accept floating point numbers
Reporter:Sam Pendergrass (spendergrasss)Labels:
Date Opened:2007-08-23 13:27:48Date Closed:2008-05-02 07:48:43
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Functions/func_timeout
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20080126__bug10540.diff.txt
( 1) 20080417__bug10540.diff.txt
( 2) 20080602__backtrace-1.txt
( 3) gdb_command_output.txt
( 4) timeout_crash.txt
( 5) valgrind.txt
Description:Example, setting digit timeout value to 1.5 seconds should be accepted.  Currently, it rounds down to nearest whole number.
Comments:By: Digium Subversion (svnbot) 2007-08-23 14:03:51

Repository: asterisk
Revision: 80539

------------------------------------------------------------------------
r80539 | russell | 2007-08-23 14:03:50 -0500 (Thu, 23 Aug 2007) | 4 lines

Fix func_timeout to take values in floating point so 1.5 actually means
1.5 seconds instead of being rounded.
(closes issue ASTERISK-10153, reported by spendergrass, patch by me)

------------------------------------------------------------------------

By: Digium Subversion (svnbot) 2007-08-23 14:04:46

Repository: asterisk
Revision: 80540

------------------------------------------------------------------------
r80540 | russell | 2007-08-23 14:04:46 -0500 (Thu, 23 Aug 2007) | 12 lines

Merged revisions 80539 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r80539 | russell | 2007-08-23 14:21:53 -0500 (Thu, 23 Aug 2007) | 4 lines

Fix func_timeout to take values in floating point so 1.5 actually means
1.5 seconds instead of being rounded.
(closes issue ASTERISK-10153, reported by spendergrass, patch by me)

........

------------------------------------------------------------------------

By: Digium Subversion (svnbot) 2007-08-23 14:11:46

Repository: asterisk
Revision: 80547

------------------------------------------------------------------------
r80547 | russell | 2007-08-23 14:11:45 -0500 (Thu, 23 Aug 2007) | 3 lines

Revert very broken fix for issue ASTERISK-10153 ... none of these values take ms so I
don't know what I was thinking

------------------------------------------------------------------------

By: Digium Subversion (svnbot) 2007-08-23 14:12:46

Repository: asterisk
Revision: 80550

------------------------------------------------------------------------
r80550 | russell | 2007-08-23 14:12:46 -0500 (Thu, 23 Aug 2007) | 11 lines

Merged revisions 80547 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r80547 | russell | 2007-08-23 14:29:44 -0500 (Thu, 23 Aug 2007) | 3 lines

Revert very broken fix for issue ASTERISK-10153 ... none of these values take ms so I
don't know what I was thinking

........

------------------------------------------------------------------------

By: Russell Bryant (russell) 2007-08-23 14:15:10

This is intended behavior.  None of these timeout values accept anything with a higher resolution than seconds and they shouldn't ever need to.  I'm closing this out as "won't fix" and a feature request, at best.

By: Tilghman Lesher (tilghman) 2007-11-16 23:26:35.000-0600

Reopened with a candidate patch for trunk, only.  Needs testing.

By: Leif Madsen (lmadsen) 2007-11-28 17:27:01.000-0600

Patch seems to set the values internally ok... but when I use TIMEOUT(absolute) the call drops immediately instead of dropping at the time it gives on the display.

   -- Executing [800@test_timeout_function:1] NoOp("SIP/outside1-098ab620", "") in new stack
   -- Executing [800@test_timeout_function:2] Set("SIP/outside1-098ab620", "TIMEOUT(digit)=1.5") in new stack
   -- Digit timeout set to 1.500
   -- Executing [800@test_timeout_function:3] Set("SIP/outside1-098ab620", "TIMEOUT(response)=5.5") in new stack
   -- Response timeout set to 5.500
   -- Executing [800@test_timeout_function:4] Verbose("SIP/outside1-098ab620", "1,Wed Nov 28 16:43:29 EST 2007") in new stack
Wed Nov 28 16:43:29 EST 2007

   -- Executing [800@test_timeout_function:5] Set("SIP/outside1-098ab620", "TIMEOUT(absolute)=7.8") in new stack
   -- Channel will hangup at 2007-11-28 16:43:37.320 EST.
   -- Executing [h@test_timeout_function:1] Verbose("SIP/outside1-098ab620", "1,Wed Nov 28 16:43:29 EST 2007") in new stack
Wed Nov 28 16:43:29 EST 2007

By: Daniel Hazelbaker (cabal95) 2007-12-06 10:47:02.000-0600

In pbx.h, the patch changes dtimeout and rtimeout to *ms, but the comment still says it is the time in seconds.

main/app.c: ast_app_dtget(), the patch (it was incorrect before too) incorrectly calls ast_waitfordigit() with seconds while it expects milliseconds, why nobody has ever noticed this problem before I don't know.

main/pbx.c: collect_digits() is now receiving ms in waittime (as it should), but still multiplying by 1000 before calling ast_waitfordigit().

I'll have to do some digging to see if I can see why it is dropping calls immediately.

By: Tilghman Lesher (tilghman) 2007-12-19 16:06:48.000-0600

blitzrage:  try that patch.  I found a case where the logic was reversed.

By: Leif Madsen (lmadsen) 2007-12-21 14:08:55.000-0600

No crash this time around... but a couple of other issues:

   -- Executing [ASTERISK-119@phones:1] NoOp("SIP/leifmadsen_desk-106cdc20", "") in new stack
   -- Executing [ASTERISK-119@phones:2] Set("SIP/leifmadsen_desk-106cdc20", "TIMEOUT(digit)=1.5") in new stack
   -- Digit timeout set to 1500
   -- Executing [ASTERISK-119@phones:3] Set("SIP/leifmadsen_desk-106cdc20", "TIMEOUT(response)=5.2") in new stack
   -- Response timeout set to 5200
   -- Executing [ASTERISK-119@phones:4] Set("SIP/leifmadsen_desk-106cdc20", "TIMEOUT(absolute)=3.5") in new stack
Channel will hangup at 1969-12-31 19:00:03.500 EST.
   -- Executing [ASTERISK-119@phones:5] Verbose("SIP/leifmadsen_desk-106cdc20", "1,37.1") in new stack
37.1*CLI>
   -- Executing [ASTERISK-119@phones:6] WaitExten("SIP/leifmadsen_desk-106cdc20", "") in new stack
   -- Timeout on SIP/leifmadsen_desk-106cdc20, going to 't'
   -- Executing [t@phones:1] Verbose("SIP/leifmadsen_desk-106cdc20", "1,40.6") in new stack
40.6
   -- Executing [h@phones:1] Verbose("SIP/leifmadsen_desk-106cdc20", "1,40.6") in new stack
40.6

Notice the TIMEOUT(absolute) is not offset correctly. Seems to be offsetting backwards of 1970-01-01?  At least just in the output there.

The response timeout is set to 5.2, but absolute is set to 3.5, so the time output of STRFTIME seems to match up that the absolute is what is causing the hangup, but it's going to 't' instead of 'T', which I believe (unless I'm remembering wrong) is the desired behaviour.

By: Tilghman Lesher (tilghman) 2007-12-21 16:25:20.000-0600

blitzrage:  could you post your dialplan?  It's difficult to read the output without knowing what all it's doing.

For the textual problems, patch updated.

By: Leif Madsen (lmadsen) 2007-12-21 16:29:30.000-0600

Sure thing!

exten => ASTERISK-119,1,NoOp()
exten => ASTERISK-119,n,Set(TIMEOUT(digit)=1.5)
exten => ASTERISK-119,n,Set(TIMEOUT(response)=5.2)
exten => ASTERISK-119,n,Set(TIMEOUT(absolute)=3.5)
exten => ASTERISK-119,n,Verbose(1,${STRFTIME(,,%S.%1q)})
exten => ASTERISK-119,n,WaitExten()
exten => h,1,Verbose(1,${STRFTIME(,,%S.%1q)})
exten => t,1,Verbose(1,${STRFTIME(,,%S.%1q)})
exten => T,1,Verbose(1,${STRFTIME(,,%S.%1q)})

By: Tilghman Lesher (tilghman) 2007-12-21 17:15:24.000-0600

blitzrage:  you found an unrelated bug in WaitExten:  it doesn't handle Absolute timeouts (this will go into 1.4).

By: Tilghman Lesher (tilghman) 2008-01-28 15:08:14.000-0600

blitzrage:  could I get you to test this once again?

By: Leif Madsen (lmadsen) 2008-02-06 20:43:08.000-0600

Backtrace attached after patching latest trunk (102777)

By: Leif Madsen (lmadsen) 2008-02-07 07:43:54.000-0600

Also the valgrind output is attached. This might not be part of this bug, but I haven't had a chance to try trunk without the patch... sorry :(

By: Tilghman Lesher (tilghman) 2008-04-17 14:52:57

Patch updated to current.

By: Leif Madsen (lmadsen) 2008-04-21 14:09:06

I have added a backtrace (timeout_crash.txt) which I got when using my test dialplan as showed in a previous note.

It should also be noted that I was running this as non-root, so hopefully I didn't just find a non-related bug :)

By: Tilghman Lesher (tilghman) 2008-04-21 20:09:35

In gdb, I'd like to see the output of:

p c->cdr)
p *(c->cdr)
p c->cdr->start

By: Leif Madsen (lmadsen) 2008-04-21 20:29:35

gdb_command_output.txt uploaded per request

By: Tilghman Lesher (tilghman) 2008-04-21 21:29:39

Are you running optimized or with DONT_OPTIMIZE?

By: Leif Madsen (lmadsen) 2008-04-21 21:35:32

Ya, according to my menuselect and the output from gdb it looks like it's configured with DONT_OPTIMIZE

By: Tilghman Lesher (tilghman) 2008-04-23 17:42:25

blitzrage:  could you please retest this under valgrind?  I think we may be getting an unrelated crash, but I'm not sure at this point.

By: Leif Madsen (lmadsen) 2008-04-24 10:37:42

New valgrind.txt file uploaded!

By: Leif Madsen (lmadsen) 2008-05-01 16:46:50

OK, tested this again 1.6.0-beta8 after a distclean (my bad). Patch applies cleanly (just offset hunks). Tested the timeouts, and they look good for response and timeout.

No crashes or anything funky. Everything looks good to me.

By: Digium Subversion (svnbot) 2008-05-01 18:00:47

Repository: asterisk
Revision: 115076

U   trunk/CHANGES
U   trunk/apps/app_dial.c
U   trunk/apps/app_disa.c
U   trunk/apps/app_dumpchan.c
U   trunk/apps/app_queue.c
U   trunk/apps/app_read.c
U   trunk/apps/app_readexten.c
U   trunk/apps/app_rpt.c
U   trunk/apps/app_speech_utils.c
U   trunk/funcs/func_timeout.c
U   trunk/include/asterisk/channel.h
U   trunk/include/asterisk/pbx.h
U   trunk/main/app.c
U   trunk/main/channel.c
U   trunk/main/cli.c
U   trunk/main/dial.c
U   trunk/main/manager.c
U   trunk/main/pbx.c
U   trunk/res/res_agi.c

------------------------------------------------------------------------
r115076 | tilghman | 2008-05-01 18:00:46 -0500 (Thu, 01 May 2008) | 7 lines

Modify TIMEOUT() to be accurate down to the millisecond.
(closes issue ASTERISK-10153)
Reported by: spendergrass
Patches:
      20080417__bug10540.diff.txt uploaded by Corydon76 (license 14)
Tested by: blitzrage

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=115076

By: Digium Subversion (svnbot) 2008-05-01 18:02:12

Repository: asterisk
Revision: 115077

_U  branches/1.6.0/

------------------------------------------------------------------------
r115077 | tilghman | 2008-05-01 18:02:12 -0500 (Thu, 01 May 2008) | 14 lines

Blocked revisions 115076 via svnmerge

........
r115076 | tilghman | 2008-05-01 18:06:23 -0500 (Thu, 01 May 2008) | 7 lines

Modify TIMEOUT() to be accurate down to the millisecond.
(closes issue ASTERISK-10153)
Reported by: spendergrass
Patches:
      20080417__bug10540.diff.txt uploaded by Corydon76 (license 14)
Tested by: blitzrage

........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=115077

By: Digium Subversion (svnbot) 2008-05-02 07:48:43

Repository: asterisk
Revision: 115193

_U  team/seanbright/resolve-shadow-warnings/
U   team/seanbright/resolve-shadow-warnings/CHANGES
U   team/seanbright/resolve-shadow-warnings/apps/app_dial.c
U   team/seanbright/resolve-shadow-warnings/apps/app_disa.c
U   team/seanbright/resolve-shadow-warnings/apps/app_dumpchan.c
U   team/seanbright/resolve-shadow-warnings/apps/app_queue.c
U   team/seanbright/resolve-shadow-warnings/apps/app_read.c
U   team/seanbright/resolve-shadow-warnings/apps/app_readexten.c
U   team/seanbright/resolve-shadow-warnings/apps/app_rpt.c
U   team/seanbright/resolve-shadow-warnings/apps/app_speech_utils.c
U   team/seanbright/resolve-shadow-warnings/apps/app_voicemail.c
U   team/seanbright/resolve-shadow-warnings/channels/chan_sip.c
U   team/seanbright/resolve-shadow-warnings/channels/chan_zap.c
U   team/seanbright/resolve-shadow-warnings/configure
U   team/seanbright/resolve-shadow-warnings/configure.ac
U   team/seanbright/resolve-shadow-warnings/funcs/func_timeout.c
U   team/seanbright/resolve-shadow-warnings/include/asterisk/autoconfig.h.in
U   team/seanbright/resolve-shadow-warnings/include/asterisk/channel.h
U   team/seanbright/resolve-shadow-warnings/include/asterisk/compiler.h
U   team/seanbright/resolve-shadow-warnings/include/asterisk/config.h
U   team/seanbright/resolve-shadow-warnings/include/asterisk/logger.h
U   team/seanbright/resolve-shadow-warnings/include/asterisk/pbx.h
U   team/seanbright/resolve-shadow-warnings/include/asterisk/res_odbc.h
U   team/seanbright/resolve-shadow-warnings/include/asterisk/sched.h
U   team/seanbright/resolve-shadow-warnings/main/app.c
U   team/seanbright/resolve-shadow-warnings/main/asterisk.c
U   team/seanbright/resolve-shadow-warnings/main/channel.c
U   team/seanbright/resolve-shadow-warnings/main/cli.c
U   team/seanbright/resolve-shadow-warnings/main/config.c
U   team/seanbright/resolve-shadow-warnings/main/dial.c
U   team/seanbright/resolve-shadow-warnings/main/manager.c
U   team/seanbright/resolve-shadow-warnings/main/pbx.c
U   team/seanbright/resolve-shadow-warnings/main/sched.c
U   team/seanbright/resolve-shadow-warnings/res/res_agi.c

------------------------------------------------------------------------
r115193 | seanbright | 2008-05-02 07:48:39 -0500 (Fri, 02 May 2008) | 43 lines

Merged revisions 115076,115078,115104,115157,115159 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r115076 | tilghman | 2008-05-01 19:06:23 -0400 (Thu, 01 May 2008) | 7 lines

Modify TIMEOUT() to be accurate down to the millisecond.
(closes issue ASTERISK-10153)
Reported by: spendergrass
Patches:
      20080417__bug10540.diff.txt uploaded by Corydon76 (license 14)
Tested by: blitzrage

................
r115078 | bbryant | 2008-05-01 19:09:08 -0400 (Thu, 01 May 2008) | 2 lines

Add two new console commands "pri show version" and "ss7 show version" that will show the version of each library respectively.

................
r115104 | tilghman | 2008-05-01 19:21:13 -0400 (Thu, 01 May 2008) | 10 lines

Merged revisions 115102 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115102 | tilghman | 2008-05-01 18:20:25 -0500 (Thu, 01 May 2008) | 2 lines

Change the comment of deprecated to an actual compiler deprecation

........

................
r115157 | tilghman | 2008-05-01 22:33:04 -0400 (Thu, 01 May 2008) | 2 lines

Add attributes to various API calls, to help track down bugs (and remove a deprecated function)

................
r115159 | tilghman | 2008-05-01 22:56:39 -0400 (Thu, 01 May 2008) | 2 lines

Okay, maybe FreeBSD will like this better.

................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=115193