I’m slowly getting to grips with creating a dial plan and have started working with macros and am getting confused. To me, as a programmer used to working in assembly languages, a macro is a piece of code that gets inserted in line each time it is invoked. However, everything about the way my system behaves suggests that, in the Asterisk case, they are actually subroutines. That is, there is only one piece of code that is called each time it is used.
The difference is important because, with a subroutine, you need to make sure you return cleanly from it and don’t jump off to another bit of code. With a macro, you can put whatever you like in there and it will blindly get inserted at compile time.
Are Asterisk macros really subroutines? Do I need to be wary of using statements like Goto and Hangup inside them? Are there any ‘costs’ in using them?