[asterisk-dev] How to change length of variable

Kirill Popov popov-k at speechpro.com
Wed Oct 19 04:27:06 CDT 2011


Thanks guys!

I was wrong. Limit was 2048.
Now I set VAR_BUF_SIZE and AGI_BUF_LEN = 8192.
I try to set more, but 8192 it's hard limit.

I think that's enough.


19.10.2011 11:45, Tilghman Lesher пишет:
> On Wed, Oct 19, 2011 at 2:03 AM, Terry Wilson<twilson at digium.com>  wrote:
>>> I understand that Asterisk have limit of the length of the variable -
>>> 256 characters.
>>> How I can change this limit?
>>> I want to recieve long variables from AGI-script.
>>> What I need to fix in the sources?
>>
>> I'm pretty sure that the maximum value length for dialplan
>> variable substitution is 4095 characters + the terminating
>> NULL. Look at VAR_BUF_SIZE in main/pbx.c. It looks like
>> res/res_agi.c on the getvariable function it limits the string
>> length to 1024 with the tempstr variable. You might also
>> check out AGI_BUF_LEN in res/res_agi.c as it looks like
>> it might limit things as well (it is set to 2048).
>>
>> Looks like it would be nice for us to set some global limits
>> and be consistent with them all over the place (or just stop
>> using stack-allocated buffers for things and remove the
>> arbitrary limits on variable values).
>>
>> If you are talking about the length of dialplan variable
>> names, I am not aware of a limit on those. I could always
>> be wrong, though.
>
> While there are still a few places using
> pbx_substitute_variables_helper(), most uses have been
> transitioned to use ast_str_substitute_variables(), which has
> no arbitrary limit on variable expansion.
>
> Looks like 1.8's AGI is using the newer API, so there shouldn't
> be a limit on variable expansion with GET FULL VARIABLE.  Of
> course, as Terry stated, you'll run into the 2048-byte command
> limit if you try to set a variable longer than about 2000 bytes
> (subtract the command name and variable name from 2048).
> Given that this is a read buffer, there isn't really a great way to
> kill this limit.  You can raise it, but the implicit limit is still there.
>
> Given that the OP expressed a limit of 256 characters, I took
> another look.  This limit would only be the case in 1.4 AGI if
> LOW_MEMORY was defined.  If that's what you have, then
> clearly you need to remove that checkmark in menuselect.
> This will make the variable expansion buffer increase to 8192,
> although the 2048 command buffer limit in AGI will still be
> present.
>
> -Tilghman
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>     http://lists.digium.com/mailman/listinfo/asterisk-dev

-- 
Best regards,
Kirill Popov
Engineer of Project Implementation
Speech Technology Center, Ltd
Russia, Saint Petersburg
Tel: +7 812 3258848, ext 6755
E-mail: popov-k at speechpro.com
http://www.speechpro.com



More information about the asterisk-dev mailing list