Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: fixed example: date 25:00 was out of range, ifTime()'s argument format should use pipe delimiters and asterisks instead of comma delimiters and gaps

AEL supports if and switch statements, like AEL, but adds ifTime, and random. Unlike the original AEL, though, you do NOT need to put curly braces around a single statement in the "true" branch of an if(), the random(), or an ifTime() statement. The if(), ifTime(), and random() statements allow optional else clause.

Code Block

context conditional {
    _8XXX => {
        Dial(SIP/${EXTEN});
        if ("${DIALSTATUS}" = "BUSY") 
        {
            NoOp(yessir);
            Voicemail(${EXTEN},b); 
        }
        else 
            Voicemail(${EXTEN},u);
        ifTime (14:00-2523:00,59|sat-sun,,|*|*) 
            Voicemail(${EXTEN},b); 
        else 
        { 
            Voicemail(${EXTEN},u); 
            NoOp(hi, there!); 
        } 
        random(51) NoOp(This should appear 51% of the time); 
        random( 60 ) 
        { 
                NoOp( This should appear 60% of the time ); 
        }
        else
        { 
                random(75) 
                { 
                    NoOp( This should appear 30% of the time! );
                }
                else 
                {
                    NoOp( This should appear 10% of the time! ); 
                }
        }
    } 
    _777X => {
        switch (${EXTEN}) {
            case 7771:
                NoOp(You called 7771!); 
                break; 
            case 7772: 
                NoOp(You called 7772!); 
                break; 
            case 7773: 
                NoOp(You called 7773!); 
                // fall thru-
            pattern 777[4-9]:
                NoOp(You called 777 something!); 
            default: NoOp(In the default clause!);
        } 
    }
}

...