[asterisk-users] Feature Request: GotoIfTimeWithOffset

Tilghman Lesher tlesher at digium.com
Fri Dec 18 10:59:07 CST 2009


On Friday 18 December 2009 04:11:36 Tzafrir Cohen wrote:
> On Thu, Dec 17, 2009 at 07:19:49PM -0600, Tilghman Lesher wrote:
> > On Thursday 17 December 2009 17:23:22 Olivier wrote:
> > > When I was testing an IVR, I realized I miss a function I would call
> > > GotoIfTimeWithOffset.
> > >
> > > Today, this IVR is using function AEL GotoIfTime in several places.
> > > The problem is if it's 11pm at the moment I'm testing this IVR, I can't
> > > nicely test the 9am or 2pm branch.
> > >
> > > GotoIfTimeWithOffset would get 2 incoming arguments :
> > > - the first is a time range (just like GotoIfTime),
> > > - the second is a duration offset which you could delay or "rewind"
> > > time.
> > >
> > > After testing, you would just have to set this offset to 0, to get a
> > > production-ready dialplan, without changing a line.
> >
> > https://issues.asterisk.org/view.php?id=16464
> >
> > I've made some important changes to your idea.  The method for invoking
> > this is setting a function to a particular date and time.  The reason for
> > this is to permit testing of a live system, without changing the actual
> > dialplan. You could set up a test with a particular extension that sets
> > this function before jumping to the incoming context, or you could use
> > conditional evaluation, such as checking callerid for the administrator's
> > cellphone number, in the incoming context to evaluate whether to set this
> > function or not.
>
> Looks nice. Just one point:
>
> This is a "global" (or rather: channel-specific, but still common to all
> in thecontext of that channel) setting. Suppose I have ( and suppose
> Asterisk even accepts this syntax) :
>
>   $(TESTTIME(...)}
>   GotoIfTime(test1,...)
>   GotoIfTime(test2,...)

The syntax is actually:

Set(TESTTIME()=2009-12-25 10:35:00 CST)

> Both test1 and test2 would be evaluated with the same offset as set in
> the TESTTIME() above. Is that what you want?

I believe it is.  Typically, people do multiple GotoIfTime's in a row, all
predicated on several different conditions that they wish to evaluate.  This
is important, because a night message might say "We will be open at 8:00",
but on Christmas Day, they might wish the message to say instead "We will
not be open at all today".  Order, then, is certainly important and worth
testing.

-- 
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-users mailing list