GotoIfTIme not working as expected

Hi there,
I have configured the following scheduler:

[macro-temporiz1]
exten => s,1,GotoIfTime(|mon,tue||*?rule0:)
exten => s,n(rule0),Dial(SIP/atcom1)
exten => s,n(rule0),Hangup()

which I invoke trough a “exten => temp1,1,Macro(temporiz1)” statement in the dialplan.

However, when I dial to that extension the following lines appear on the Ast. console:

If i call on a Monday:

  • Executing Macro(“SIP/hera-7d72”, “temporiz1”) in new stack
  • Executing GotoIfTime(“SIP/hera-7d72”, “|mon|tue||*?rule0:”) in new stack
    Jul 31 12:17:38 WARNING[1919]: pbx.c:3979 get_day: Invalid day ‘tue’, assuming none
  • Executing Dial(“SIP/hera-7d72”, “SIP/atcom1”) in new stack
  • Called atcom1

If I call on a Tuesday:

Same messages as above.

If i call on a Wednesday:

Same messages as above.

I then changes the scheduler to this:

[macro-temporiz1]
exten => s,1,GotoIfTime(|mon,thu,wed,sun,fri,sat||*?rule0:)
exten => s,n(rule0),Dial(SIP/atcom1)
exten => s,n(rule0),Hangup()

and then I got these following messages:

  • Executing Macro(“SIP/hera-9c27”, “temporiz1”) in new stack
  • Executing GotoIfTime(“SIP/hera-9c27”, “|mon|thu|wed|sun|fri|sat||*?rule0:”) in new stack
    Jul 31 12:20:45 WARNING[2100]: pbx.c:3979 get_day: Invalid day ‘thu’, assuming none
    Jul 31 12:20:45 WARNING[2100]: pbx.c:4043 get_month: Invalid month ‘wed’, assuming none
  • Executing Dial(“SIP/hera-9c27”, “SIP/atcom1”) in new stack
  • Called atcom1

After a few tests I can observe that if i try to declare independent day names and not a range of them, i always get the error stating that the 2nd one doesn’t exist…1

Is the scheduler’s syntax correct or is it a bug?

Thank you,
Sergio

i’m loathe to say it’s a bug, but asking for trouble would be more approriate :smiley:

the examples on the wiki page suggest using multiple lines to match non-sequential days, and ‘-’ to define a range (mon-tue).

voip-info.org/wiki-Asterisk+cmd+GotoIfTime

the problem seems to centre around the use of commas instead of pipes, 'cos Asterisk uses both as a delimiter and you want “mon,tue,thu” to not mean “mon|tue|thu”

Thank you for your answer.
I see that you have an Asterisk 1.2.10 system, could you do a quick test of the code above (or similar)?
I’m inclined to believe that this “bug” might have been corrected in newer versions of the software… (i’m running 1.2.1).
If this doesn’t work I’ll go with the sequential solution you suggested.

i’ve just done this quickly and it would appear that the problem is still there in 1.2.9.1

using e.g. mon-fri works ok, but mon,tue,wed,thu,fri fails.

can i also highlight that if the time isn’t matched, execution continues at the next priority … it’s easy to get weird results if you’re only checking for a single time condition and use the “usual” Goto format.

Thanks for your availability.

I’ll take that in mind :smile: