How to change length of variable


I understand that Asterisk have limit of the length of the variable - 256 characters.
How I can change this limit?
Can it be fixed in the sources?

I would suggest asking on the developer mailing list or IRC channel.

It is obvious that this can be changed in the source code, but I don’t know how big a job this will be.

hi,are you got any idea about the variable length limit ?
i have the same problem .

I measure the maximum variable length in Asterisk 13 at 4090.

; channel variable length test
        same = n(loop),                 set(t=${t}b)
        same = n,                       verbose(${LEN(${t})})
        same = n,                       wait(0.01)
        same = n,                       goto(loop)
        same = n,                       hangup()

Maybe storing a key to a row in a database would be a better approach?

I can’t see any limit on the size of variables much less than MAXINT. The limits are almost certainly imposed in other places, such as the maximum expanded length of a dialplan line. That’s why I said that some work would be needed to find all the limits, as there may be multiple places were limits are applied.

It also means that answer you get may depend on what else is on the application name and parameter line.

I’m not sure exactly which version this is based on; I looked in the source of the trunk version of five years ago, as I had an offline copy of all of that.

@david551 is right. My test dialplan snippet above fails at 4091 with something about not being able to find the closing parenthesis.

Returning a channel variable from an AGI appears to fall over somewhere around 2016 (Asterisk 14).

So, apart from finding a less ‘abusive’ way to manage call variables (like a database), you will need to determine the maximum length for your specific application.

But the lack of consistency may be a clue that you are using channel variables for purposes beyond their intended use.