From: Doug Garstang <[EMAIL PROTECTED]>
Date: Thu, 22 Feb 2007 10:17:20 -0800

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

I have not programmed large dial plans, but have encountered some of the nuances.

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.

Or feature? I posted this question before and haven't got an answer. It might be a feature on the premise that a macro is not a context. (Even though I can use Goto to wander inside.)

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.

In my wild experimentation, I tried to Goto(${MACRO_CONTEXT},${return_value},1). But another way to do this is to abandon macro and use Local channel. Expect to set all necessary _variables yourself before dialing into a local channel.

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.

Local channel may be your friend.

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.

Have you looked at AEL?

Yuan Liu

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

Doug.


_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to