I was under the impression 'n' could be used only if the dial plans are
drawn sequentially & simple dialplans.  I did not know the 'n' could be used
in a GotoIF statements.  Input from you and anyone here on this regard would
be greatly appreciated since I have complex dial plans with the GotoIF
statement, not just Goto statement... and implementing the 'n', would save a
LOT OF hassle.

You can use 'n' with any type of dialplan, goto is just as iterative as gotoif.

try something like this psuedo macro:

[macro-gtif]    ;;treat gotoif as a reserved word all sorts of
undocumented ones exist.

exten => s,1,Set(temp=${ARG1})
exten => s,n,GotoIf(${temp}="foo"?bar:nobar)
exten => s,n(bar),NoOp("wassup foo")
exten => s,n(nobar),NoOp("who u callin a foo punk")
exten => s,n,blah
.
.   ;; add some more blahs
.
.

The only difference is that with one you are dealing with a hash index
the other an array.

Personally I think numbering with literal ascending numbers, vs. the 'n',
has greater advantage in complex dial plans, comprising with AGI scripts,
Goto & GotoIF statements.  It greatly improves debuging and tweaking out
your codes in debug mode.

Asterisk dialplans are ugly by nature, just like ms batch files, and for
the same reasons. Using literals won't make the dialplan any easier to
debug, using lots of NoOps will.

Reply via email to