This is an example of how to do a goto in AEL.
context gotoexample { s => { begin: NoOp(Infinite Loop! yay!); Wait(1); goto begin; // go to label in same extension } 3 => { goto s, begin; // go to label in different extension } 4 => { goto gotoexample,s,begin; // overkill go to label in same context } } context gotoexample2 { s => { end: goto gotoexample,s,begin; // go to label in different context } }
You can use the special label of "1" in the goto and jump statements. It means the "first" statement in the extension. I would not advise trying to use numeric labels other than "1" in goto's or jumps, nor would I advise declaring a "1" label anywhere! As a matter of fact, it would be bad form to declare a numeric label, and it might conflict with the priority numbers used internally by asterisk.
The syntax of the jump statement is: jump extension[,priority][@context] If priority is absent, it defaults to "1". If context is not present, it is assumed to be the same as that which contains the "jump".
context gotoexample { s => { begin: NoOp(Infinite Loop! yay!); Wait(1); jump s; // go to first extension in same extension } 3 => { jump s,begin; // go to label in different extension } 4 => { jump s,begin@gotoexample; // overkill go to label in same context } } context gotoexample2 { s => { end: jump s@gotoexample; // go to label in different context } }