Does the dial plan support arrays or multivalue variables?

According to the wiki asterisk does have an array function however it appears to only be a shortcut for declaring multiple separate variables.

Set(ARRAY(var1,var2)=1,2) will set var1 to 1 and var2 to 2

I’m looking for a way to preform logical operations on an entire set of variables, not just define multiple variables at once.

In short, I’m looking for a better way to write:

same => n,GotoIf($[${var1} != 1] & $[${var2} != 1] & $[${var3} != 1] & $[${var4} != 1] ?label1:label2)

I would like to be able to do:
same => n,GotoIf($[${contenceOfarrayName} != 1]?label1:label2)
But that does not work.

Not directly, but variable names are also subject to the same macro expansion as top level variables, so you can dynamically create a variable name.

1 Like

Referencing my snippet from your earlier post.

You could think of:

                        switch  (${STEP-${IDX}-TYPE})

kind of like

typedef struct
// ints
       	int                             active;
        int                             type;
// strings
        char                            data[256];
        char                            prompt[256];
        }                               STEP;

static  STEP                            step[100];

        switch                          (step[idx].type)

But Asterisk really sees it as:

                        switch  (${STEP-42-TYPE})