[Home]

Summary:ASTERISK-06072: GotoIfTime function does not handle the [weekdays] parameter properly
Reporter:sivana (sivana)Labels:
Date Opened:2006-01-13 08:08:06.000-0600Date Closed:2008-01-15 16:15:54.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:When specifying a weekday range (ie. mon-fri) in GotoIfTime, the last day in the range is not counted as true when it's the current day.

Example:  Today is Friday, January 13th, 2005 - (maybe that's why?)

exten => s,1,GotoIfTime(8:00-18:00|mon-fri|*|*?OFFICE_CA_XFER,s,1)

The above range is not counted as true and the extension is not jumped. I had to change the last range to "sat" for it to work properly.

I don't know if the first parameter in the range is counted properly when it's the current day, I will update this on Monday.
Comments:By: BJ Weschke (bweschke) 2006-01-13 08:39:10.000-0600

yep. definitely broken.

By: BJ Weschke (bweschke) 2006-01-13 09:29:05.000-0600

I think this is corrected now in the latest /trunk. Pls test and confirm.



By: Luigi Rizzo (rizzo) 2006-01-13 10:04:54.000-0600

actually it seems to do the right thing here.. at least with
the code in ASTERISK-5943. I have
put some debugging code in the relevant functions and here is
what i get:

*CLI> dial 200@timed
   -- Executing [timed:1] GotoIfTime("OSS/dsp", "8:00-19:00|mon-fri|*|*?incoming|200|1") in new stack
Jan 13 18:49:39 WARNING[40706]: pbx.c:3827 ast_build_timing: in: <8:00-19:00|mon-fri|*|*> out: dow 3e day 7fffffff month fff
Jan 13 18:49:39 WARNING[40706]: pbx.c:3839 ast_check_timing: now is tm_mon: 1 tm_mday 1000 tm_wday 20
   -- Goto (incoming,200,1)

As you see, mon-fri is correctly represented by 0x3e (0011 1110)
-the rightmost bit, bit 0, is sunday; you see five '1' bits.
and today, friday, is 0x20 (tm_wday) which is 0010 0000 and matches.

are you sure your clock is not off e.g. by one our ? i see you
posted the bug at 08:08 of some timezone... very close to
the time-match 08-18 ?

By: BJ Weschke (bweschke) 2006-01-13 10:07:37.000-0600

rizzo: it was definitely broken. Please take a look at r8056 in /trunk and let me know if that's an appropriate fix.

By: Luigi Rizzo (rizzo) 2006-01-13 10:24:50.000-0600

ok sorry, i did not see your commit in the log.
i see the problem now, i mistyped the variable used to
initialize the mask. Fortunately the comment provided a good hint.

Unfortunately the fix in svn8056 is wrong because (see the comment just
above) ranges are cyclic and that code fails to handle cases such as
fri-mon or 27-05. The correct fix (after 8056) is below.
Thanks for handling this.

@@ -3747,8 +3677,8 @@
                       e = s;
       }
       /* Fill the mask. Remember that ranges are cyclic */
-       mask = 1 << s;  /* last element in case s == e */
-       for ( ; s<=e; s++) {
+       mask = 1 << e;  /* initialize with last element */
+       for ( ; s !=e ; s++) {
               if (s == max)
                       s = 0 ;
               mask |= (1 << s);

By: BJ Weschke (bweschke) 2006-01-13 10:36:03.000-0600

You are exactly right. Thanks rizzo. Commited your change as r8059.

By: BJ Weschke (bweschke) 2006-01-13 10:36:33.000-0600

Fixed in /trunk.

By: BJ Weschke (bweschke) 2006-01-15 10:06:27.000-0600

rizzo: this is still broken. :(

Snippet from the log yesterday...

Jan 14 16:01:32 VERBOSE[24101] logger.c:     -- Executing GotoIfTime("Zap/28-1", "10:00-16:00|sat|*|*?pripstn|7769|2") in new stack
Jan 14 16:01:32 VERBOSE[24101] logger.c:     -- Goto (pripstn,7769,2)



By: Tilghman Lesher (tilghman) 2006-01-15 10:42:59.000-0600

Actually, we only ever have had a 2 minute resolution in the timer, so 16:01 is still considered 16:00 by the time code.

By: Digium Subversion (svnbot) 2008-01-15 16:15:29.000-0600

Repository: asterisk
Revision: 8059

U   trunk/pbx.c

------------------------------------------------------------------------
r8059 | bweschke | 2008-01-15 16:15:28 -0600 (Tue, 15 Jan 2008) | 3 lines

Another patch against this code (the right one now) to deal with cyclic ranges. ASTERISK-6072


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

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

By: Digium Subversion (svnbot) 2008-01-15 16:15:54.000-0600

Repository: asterisk
Revision: 8086

_U  team/russell/autoconf_and_menuselect/
U   team/russell/autoconf_and_menuselect/app.c
U   team/russell/autoconf_and_menuselect/apps/app_dial.c
U   team/russell/autoconf_and_menuselect/apps/app_directed_pickup.c
U   team/russell/autoconf_and_menuselect/apps/app_festival.c
U   team/russell/autoconf_and_menuselect/apps/app_macro.c
U   team/russell/autoconf_and_menuselect/apps/app_meetme.c
U   team/russell/autoconf_and_menuselect/apps/app_milliwatt.c
U   team/russell/autoconf_and_menuselect/apps/app_mixmonitor.c
U   team/russell/autoconf_and_menuselect/apps/app_morsecode.c
U   team/russell/autoconf_and_menuselect/apps/app_page.c
U   team/russell/autoconf_and_menuselect/apps/app_parkandannounce.c
U   team/russell/autoconf_and_menuselect/apps/app_queue.c
U   team/russell/autoconf_and_menuselect/apps/app_rpt.c
U   team/russell/autoconf_and_menuselect/apps/app_voicemail.c
U   team/russell/autoconf_and_menuselect/asterisk.c
U   team/russell/autoconf_and_menuselect/channel.c
U   team/russell/autoconf_and_menuselect/channels/chan_agent.c
U   team/russell/autoconf_and_menuselect/channels/chan_local.c
U   team/russell/autoconf_and_menuselect/channels/chan_sip.c
U   team/russell/autoconf_and_menuselect/configs/agents.conf.sample
U   team/russell/autoconf_and_menuselect/configs/features.conf.sample
U   team/russell/autoconf_and_menuselect/configs/queues.conf.sample
U   team/russell/autoconf_and_menuselect/doc/CODING-GUIDELINES
U   team/russell/autoconf_and_menuselect/doc/README.variables
U   team/russell/autoconf_and_menuselect/doc/manager.txt
U   team/russell/autoconf_and_menuselect/doc/queuelog.txt
U   team/russell/autoconf_and_menuselect/funcs/func_strings.c
U   team/russell/autoconf_and_menuselect/include/asterisk/app.h
U   team/russell/autoconf_and_menuselect/include/asterisk/frame.h
U   team/russell/autoconf_and_menuselect/include/asterisk/monitor.h
U   team/russell/autoconf_and_menuselect/include/asterisk/utils.h
U   team/russell/autoconf_and_menuselect/manager.c
U   team/russell/autoconf_and_menuselect/pbx.c
U   team/russell/autoconf_and_menuselect/res/res_monitor.c
U   team/russell/autoconf_and_menuselect/udptl.c

------------------------------------------------------------------------
r8086 | russell | 2008-01-15 16:15:53 -0600 (Tue, 15 Jan 2008) | 222 lines

Merged revisions 8019-8024,8030,8034,8037-8038,8042,8044-8045,8048-8051,8056-8060,8063-8066,8068-8073,8075-8076,8078-8080 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
r8019 | russell | 2006-01-12 13:35:03 -0500 (Thu, 12 Jan 2006) | 2 lines

fix breakage from new feature committed in r7995

........
r8020 | bweschke | 2006-01-12 14:01:35 -0500 (Thu, 12 Jan 2006) | 3 lines

Remove an unneccessary unlock and do away with the error msg about not being able to unlock the lock. ASTERISK-6044


........
r8021 | mogorman | 2006-01-12 14:07:18 -0500 (Thu, 12 Jan 2006) | 4 lines

Added option for limiting a user from logging in
as multiple agents at same time. bug 6046 thanks
ppyy

........
r8022 | mogorman | 2006-01-12 14:09:36 -0500 (Thu, 12 Jan 2006) | 2 lines

Minor revisions from bug 6090

........
r8023 | mogorman | 2006-01-12 14:15:20 -0500 (Thu, 12 Jan 2006) | 2 lines

Oops... need to keep my trunk folder clean...

........
r8024 | mogorman | 2006-01-12 14:28:47 -0500 (Thu, 12 Jan 2006) | 3 lines

More cosmetic changes. thanks qwell and everyone
else.

........
r8030 | mogorman | 2006-01-12 14:45:38 -0500 (Thu, 12 Jan 2006) | 3 lines

some error checking added into g and a option
if there is no parens.

........
r8034 | mogorman | 2006-01-12 15:04:52 -0500 (Thu, 12 Jan 2006) | 3 lines

I will never touch VM again...
thanks qwell for spotting mistakes.

........
r8037 | tilghman | 2006-01-12 16:12:25 -0500 (Thu, 12 Jan 2006) | 2 lines

Fix typos that caused voicemail not to compile.

........
r8038 | tilghman | 2006-01-12 16:18:46 -0500 (Thu, 12 Jan 2006) | 2 lines

Bug 6223 - Remove unnecessary header that caused FreeBSD not to compile

........
r8042 | mogorman | 2006-01-12 21:34:10 -0500 (Thu, 12 Jan 2006) | 3 lines

forgot to take out createlink sample along with
other part.

........
r8044 | bweschke | 2006-01-12 22:25:23 -0500 (Thu, 12 Jan 2006) | 3 lines

More memory wrapper and cleanup work. ASTERISK-6068 w/one very minor compile fix mod in app_rpt.c


........
r8045 | bweschke | 2006-01-12 22:34:31 -0500 (Thu, 12 Jan 2006) | 3 lines

More memory wrapper cleanup. ASTERISK-6067


........
r8048 | russell | 2006-01-13 01:11:41 -0500 (Fri, 13 Jan 2006) | 2 lines

fix spelling errors (issue ASTERISK-6069)

........
r8049 | mogorman | 2006-01-13 01:43:27 -0500 (Fri, 13 Jan 2006) | 2 lines

added some minor changes from bug 6046 thanks ppyy

........
r8050 | mogorman | 2006-01-13 01:49:23 -0500 (Fri, 13 Jan 2006) | 2 lines

adding more output for shutdown. as per 6102

........
r8051 | tilghman | 2006-01-13 02:14:42 -0500 (Fri, 13 Jan 2006) | 2 lines

Somebody complained the that length of the dah wasn't quite up to spec...

........
r8056 | bweschke | 2006-01-13 11:01:40 -0500 (Fri, 13 Jan 2006) | 3 lines

Range should be inclusive, not exclusive, of the end of the range.


........
r8057 | mogorman | 2006-01-13 12:02:15 -0500 (Fri, 13 Jan 2006) | 5 lines

allow app_directed_pickup to try to pickup
multiple channels at the same time. however it
does not work in cases where dial was called
with multiple devices.  bug 5694.

........
r8058 | bweschke | 2006-01-13 12:28:22 -0500 (Fri, 13 Jan 2006) | 3 lines

Address the condition where X-ClientCode could be NULL or an empty string - from a -dev posting.


........
r8059 | bweschke | 2006-01-13 12:35:12 -0500 (Fri, 13 Jan 2006) | 3 lines

Another patch against this code (the right one now) to deal with cyclic ranges. ASTERISK-6072


........
r8060 | mogorman | 2006-01-13 12:39:56 -0500 (Fri, 13 Jan 2006) | 3 lines

added two new features to meetme, autofill and
autopause.  thanks twisted from 5577

........
r8063 | bweschke | 2006-01-13 13:23:30 -0500 (Fri, 13 Jan 2006) | 3 lines

Implement the autologoffunavail option in chan_agent (ASTERISK-5880 with some minor mods)


........
r8064 | mogorman | 2006-01-13 13:30:49 -0500 (Fri, 13 Jan 2006) | 3 lines

Made chan_agent code parsing more robust and
implemented new macro code. from 6228.

........
r8065 | russell | 2006-01-13 13:38:55 -0500 (Fri, 13 Jan 2006) | 9 lines

Various cleanups from comments in an email from Luigi Rizzo.  Thank you!
- Use a cleaner syntax for declaring the allocation macros
- Fix return value for ast_strdup/ast_strndup
- remove safe_strdup from app_macro, since ast_strup does the same thing
- fix a place in app_queue where ast_calloc+strncpy was used instead of
 ast_strdup.  If you are helping out with these conversions, please watch out
 for other places where this is done.
- add a note to the coding guidelines about the fix to app_queue

........
r8066 | mogorman | 2006-01-13 14:09:05 -0500 (Fri, 13 Jan 2006) | 2 lines

Added forward context option from 5497

........
r8068 | mogorman | 2006-01-13 17:05:46 -0500 (Fri, 13 Jan 2006) | 4 lines

make voicemail files group writable and uses a
nicer function for creating dirs as described in
5929

........
r8069 | mogorman | 2006-01-13 17:59:19 -0500 (Fri, 13 Jan 2006) | 3 lines

Added QUEUE_MEMBER_COUNT and  QUEUE_MEMBER_LIST
from bug 5451

........
r8070 | mogorman | 2006-01-13 19:32:30 -0500 (Fri, 13 Jan 2006) | 4 lines

added feature for pausing and unpausing the
monitor app from manager and in the call through
features.conf bug 5395 for the patch

........
r8071 | bweschke | 2006-01-13 22:25:38 -0500 (Fri, 13 Jan 2006) | 3 lines

Code cleanup spawned from an earlier commit today r8063. Standardize manager event responses and queue_log behavior on callbacklogoff.


........
r8072 | mattf | 2006-01-14 11:18:03 -0500 (Sat, 14 Jan 2006) | 2 lines

Add mission options to agents.conf sample file (ASTERISK-6076)

........
r8073 | mattf | 2006-01-14 13:53:10 -0500 (Sat, 14 Jan 2006) | 2 lines

Small documentation update for new AST_FRAME_MODEM type

........
r8075 | tilghman | 2006-01-14 14:08:03 -0500 (Sat, 14 Jan 2006) | 3 lines

Merged revisions 8074 via svnmerge from
/branches/1.2

........
r8076 | tilghman | 2006-01-14 14:30:37 -0500 (Sat, 14 Jan 2006) | 2 lines

Bug 6238 - Janitor - update to app_args macros

........
r8078 | tilghman | 2006-01-15 00:50:19 -0500 (Sun, 15 Jan 2006) | 2 lines

Prepare for removal of DBGet/DBPut manager commands, by allowing Getvar to get functions (Setvar can already set functions)

........
r8079 | tilghman | 2006-01-15 13:02:46 -0500 (Sun, 15 Jan 2006) | 2 lines

Allow application arguments to be quoted, allowing '|' characters inside arguments

........
r8080 | tilghman | 2006-01-15 13:08:04 -0500 (Sun, 15 Jan 2006) | 2 lines

Clarify description of ARRAY function

........

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

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