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.
context conditional {
_8XXX => {
Dial(SIP/${EXTEN});
if ("${DIALSTATUS}" = "BUSY")
{
NoOp(yessir);
Voicemail(${EXTEN},b);
}
else
Voicemail(${EXTEN},u);
ifTime (14:00-25:00,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!);
}
}
}