Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Note concerning macro variables

A macro is defined in its own block like this. The arguments to the macro are specified with the name of the macro. They are then referred to by that same name. A catch block can be specified to catch special extensions.

Code Block

macro std-exten( ext , dev ) {
    Dial(${dev}/${ext},20);
    switch(${DIALSTATUS}) {
        case BUSY:
            Voicemail(${ext},b);
            break;
        default:
            Voicemail(${ext},u); 
    } 
    catch a { 
        VoiceMailMain(${ext});
        return; 
    }
}

A macro is then called by preceding the macro name with an ampersand. Empty arguments can be passed simply with nothing between commas.

Code Block

context example { 
    _5XXX => &std-exten(${EXTEN}, "IAX2");
    _6XXX => &std-exten(, "IAX2");
    _7XXX => &std-exten(${EXTEN},);
    _8XXX => &std-exten(,);
}
Note
titleDialplan Macros Channel Variables

Due to AEL macro reimplementation the following variables will not be set:

  • ${MACRO_EXTEN}
  • ${MACRO_CONTEXT}
  • ${MACRO_PRIORITY}
  • ${MACRO_OFFSET}