[asterisk-users] Large dial plans and variables

Philipp Kempgen philipp.kempgen at amooma.de
Wed May 2 12:32:49 MST 2007


Doug Garstang wrote:

> I have a large dial plan here with over 3000 lines, and several dozen 
> macros. As it grew, it became apparent that there was some problems.
> 
> 1. When you pass arguments to a macro in the form of $ARG1, $ARG2 etc, 
> if that macro calls another macro, and passes arguments like this as 
> well, you lose the original values.
> 
> 2. When the macro's 'return' some value, it has to set a channel 
> variable. If your not careful, this quickly becomes a mess. Some 
> standard mechanism is needed.
> 
> In fact, the over all problem is that all channel variables are global 
> within that channel. Macro's don't have local variables and it makes 
> programming large dial plans problematic. Even things like loop counters 
> can get trashed when your inside of a loop, and you jump somewhere else 
> and modify that loop variable, and jump back.
> 
> Anyone got any tips on how to manage this? It would be awesome if AEL2 
> could address this somehow...

A possible "solution" would be to prefix all variables used
within a macro with the name of the macro but you really feel
it's a workaround.

macro do_something( do_something_foo, do_something_bar ) {
  Set(do_something_i=0);
  //...
}

But how nice is ${do_something_i} ?


Regards,
  Philipp

-- 
amooma GmbH - Bachstr. 126 - 56566 Neuwied - http://www.amooma.de
     Let's use IT to solve problems and not to create new ones.
           Asterisk? -> http://www.das-asterisk-buch.de

Geschäftsführer: Stefan Wintermeyer
Handelsregister: Neuwied B 14998


More information about the asterisk-users mailing list