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

Attachment: signature.asc
Description: PGP signature

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to