[asterisk-users] Macros, Background(), Return Values...

Doug Garstang dgarstan at talkplus.com
Thu Feb 22 11:17:20 MST 2007


I am programming a very large dialplan right now (Asterisk 1.4), and a 
couple of things are annoying the heck out of me.

1. When in a macro, background() does not work properly. If you use the 
background() app inside a macro, and then press a key, execution returns 
back to the calling context where it tries to match that extension. I 
believe this is a known bug.

2. Is there any way to have macros return a value? I can pass arguments 
to macro's with ARG1..ARGN, but the only way to set a return variable is 
to set a channel variable. Essentially, I have a large number of global 
variables which is never good.

3. If you use Gosub to and Return to jump into and out of contexts, and 
use them like macros to get around the background() problem, the global 
variable issue becomes worse as there's no way to explicitly pass 
variables to the contexts when you do this.

4.Every time you make a decision, you have to use GotoIf, which means 
more code to do simple things like set variables, or do things based on 
a decision. It would be great if there was SetIf(), MacroIf(), or even 
doIf() applications.

Has anyone tried to program large complex dialplans before and come 
across some of these issues? How did you resolve them?

Doug.





More information about the asterisk-users mailing list