[asterisk-users] AEL if/else/IFTIME fun.

Dan Serban dserban at lodgingcompany.com
Tue Sep 12 10:13:41 MST 2006


I've been playing a lot with AEL and one thing seems to be perplexing me,
it's regarding actions taken using the IFTIME command, and they don't seem
to be having much affect.

Here's my AEL script:

// Main menu configuration

context mainmenu {
	includes {
                default;
        };

        1 => goto canadamenu|s|1;
        2 => goto usmenu|s|1;
        3 => &agentqueue(mx);
        4 => goto adminmenu|s|1;

        // T1 PRI
        2977 => goto s|1;

        s => {
                Ringing();
                Wait(1);
                Set(attempts=0);
                Answer();
                Wait(1);
                if( $[IFTIME(06:00-11:59,mon-fri,*,*) |
IFTIME(07:00-11:59,sat,*,*) | IFTIME(08:00-11:59,sun,*,*)]) {
                        // Morning
                        Background('menu/tlc-good-morning');
                }
                if( $[IFTIME(12:00-16:59,*,*,*)] ) {
                        // Afternoon
                        Background('menu/tlc-good-afternoon');
                }
                if( $[IFTIME(17:00-20:00,mon-fri,*,*) |
IFTIME(17:00-18:00,sat-sun,*,*) ] ) {
                        // Evening
                        Background('menu/tlc-good-evening');
                }
                else {
                        Background('menu/tlc-after-hours');
                        WaitExten(5);
                        goto default|200|1; // General Mailbox
                        Hangup();
                };
        repeat:
                // Main
                Set(attempts=$[${attempts} + 1]);
                Background('menu/tlc-home-menu');
                WaitExten(5);
                if( ${attempts} < 2 ) goto repeat;
                &adminqueue(operator);
                Hangup();
        };
};

The above is fairly self explanatory, and based on what I could glean
through googling, it should be correct.  Though I've tried different
variations on the above implementation of the IFTIME calls.  (using else if,
IFTIME by itself etc.)

What happens, is that it only plays the good morning greeting at any time
during the day.  What am I doing wrong?


More information about the asterisk-users mailing list