Hi, 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. Suggestions ? Cheers -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20091218/d3428e4b/attachment.htm
Tilghman Lesher
2009-Dec-18 01:19 UTC
[asterisk-users] Feature Request: GotoIfTimeWithOffset
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. -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com & www.asterisk.org
Steve Edwards
2009-Dec-18 01:28 UTC
[asterisk-users] Feature Request: GotoIfTimeWithOffset
On Fri, 18 Dec 2009, Olivier wrote:> 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.Wouldn't a "set time" function be more usefull? You could set the time in a single place in your dialplan and you wouldn't have to worry about an extended debugging session exceeding your offset and executing the wrong section of code. You could even make its execution conditional on your ANI (for example) so you could test your dialplan without interferring with production callers. -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000
C. Chad Wallace
2009-Dec-18 01:28 UTC
[asterisk-users] Feature Request: GotoIfTimeWithOffset
At 12:23 AM on 18 Dec 2009, Olivier wrote:> Hi, > > 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.It ain't pretty, but this should work (untested): globals { TIME_OFFSET=-5; }; context test-iftime { s => { GotoIfTime($[6+${TIME_OFFSET}]:00-$[7+${TIME_OFFSET}]:00|*|*|*?goodmorning); Playback(hello); Hangup(); goodmorning: Playback(goodmorning); }; }; Basically, just change each of the hours in your time specs to this: $[<hour>+${TIME_OFFSET}] -- C. Chad Wallace, B.Sc. The Lodging Company http://www.lodgingcompany.com/ OpenPGP Public Key ID: 0x262208A0 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: not available Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20091217/d496fa3d/attachment.pgp
David Backeberg
2009-Dec-18 01:34 UTC
[asterisk-users] Feature Request: GotoIfTimeWithOffset
On Thu, Dec 17, 2009 at 6:23 PM, Olivier <oza-4h07 at myamail.com> wrote:> Hi, > > 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. > > > Suggestions ?It's a novel idea. Previously, I've always had a parallel, weaker test system. (these day, systems are so good you could just use a virt). When I want to test out time conditions, I build them there and change the hardware clock, then restart asterisk as playing with the hardware clock seems to screw up playing messages. In this manner I'm really testing the time conditions, with copy and paste-able dialplan.
On Fri, Dec 18, 2009 at 12:23:22AM +0100, Olivier wrote:> > 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. > > Suggestions ?How about setting, say, LUNCHTIME to "23:00-23:59" and using GotoIfTime(${LUNCHTIME},...) until you're ready to go live? I try to do this when there are multiple GotoIfTime's referencing the same interval in a dialplan. Companies change their minds about things like lunch times, working hours, shift changes all the time, and this makes it easier to change down the road. --Barry
Tilghman Lesher
2009-Dec-18 19:17 UTC
[asterisk-users] Feature Request: GotoIfTimeWithOffset
On Friday 18 December 2009 11:17:24 Steve Edwards wrote:> On Fri, 18 Dec 2009, Tilghman Lesher wrote: > > The syntax is actually: > > > > Set(TESTTIME()=2009-12-25 10:35:00 CST) > > 1) Does this set the "time" to a fixed value or does it set the time at > the point of execution and then the "clock" increments from there?It sets a fixed value.> 2) Does this only affect gotoiftime() or does it affect every time value > associated with the executing channel?Right now, it only affects GotoIfTime. Making it affect all places without making it global (which kind of defeats the purpose) might be rather difficult, as the channel reference is not handed down to every utility function involving time. -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com & www.asterisk.org