[asterisk-users] Feature Request: GotoIfTimeWithOffset

C. Chad Wallace cwallace at lodgingcompany.com
Thu Dec 17 19:28:19 CST 2009


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 


More information about the asterisk-users mailing list