Jonathan H
2016-Oct-23 01:05 UTC
[asterisk-users] Got bitten by the 255 char variable limit - how best to work around it?
I loop through a list in Asterisk which is generated by a Python AGI and I've just been bitten by a variable limit I didn't realise existed before. The only way I can think of working around this is to get Python to write the list to file, then do a FILE_COUNT_LINE to get the number of items (needed first) and then iterate through them by doing FILE to read one line at a time. Would rather stay away from polluting ASTDB, and don't want to install MySQL as I don't need it for anything else. Ideally, though, is there a workaround for the variable limit? Thanks!
Matt Fredrickson
2016-Oct-24 16:04 UTC
[asterisk-users] Got bitten by the 255 char variable limit - how best to work around it?
On Sat, Oct 22, 2016 at 8:05 PM, Jonathan H <lardconcepts at gmail.com> wrote:> I loop through a list in Asterisk which is generated by a Python AGI > and I've just been bitten by a variable limit I didn't realise existed > before. > > The only way I can think of working around this is to get Python to > write the list to file, then do a FILE_COUNT_LINE to get the number of > items (needed first) and then iterate through them by doing FILE to > read one line at a time. > > Would rather stay away from polluting ASTDB, and don't want to install > MySQL as I don't need it for anything else. > > Ideally, though, is there a workaround for the variable limit? Thanks!I was curious about this and started looking through the code to remember how this all worked. I don't see anything specifically that would truncate setting a channel variable internally, but perhaps it's a limitation due to how AGI is processed or buffers used for parsing/interpreting there. There are a number of fixed sized buffers used in the AGI parsing code. I'm curious, what version of Asterisk are you using? I'm not aware of any workarounds other than those you mentioned. If you wanted to get really into it, you could poke around in res/res_agi.c and see if you can figure out which buffer is limiting. YMMV there though. -- Matthew Fredrickson Digium, Inc. | Engineering Manager 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA