diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-04-29 18:53:01 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-04-29 18:53:01 +0000 |
commit | 8fc2c0f7245703d3dde31d7fa035f3f28c82daeb (patch) | |
tree | 972bdf8f96c18f1b9667469307af69385f4a75f3 /res/res_agi.c | |
parent | 6d9e0aa8817729e7914bb1b3fafe02dc96ae41b5 (diff) |
Merge str_substitution branch.
This branch adds additional methods to dialplan functions, whereby the result
buffers are now dynamic buffers, which can be expanded to the size of any
result. No longer are variable substitutions limited to 4095 bytes of data.
In addition, the common case of needing buffers much smaller than that will
enable substitution to only take up the amount of memory actually needed.
The existing variable substitution routines are still available, but users
of those API calls should transition to using the dynamic-buffer APIs.
Reviewboard: http://reviewboard.digium.com/r/174/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@191140 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_agi.c')
-rw-r--r-- | res/res_agi.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/res/res_agi.c b/res/res_agi.c index 24dd5d0bb..7eebf7c61 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -1828,8 +1828,7 @@ static int handle_getvariable(struct ast_channel *chan, AGI *agi, int argc, char static int handle_getvariablefull(struct ast_channel *chan, AGI *agi, int argc, char **argv) { - char tmp[4096]; - struct ast_channel *chan2=NULL; + struct ast_channel *chan2 = NULL; if (argc != 4 && argc != 5) { return RESULT_SHOWUSAGE; @@ -1842,8 +1841,14 @@ static int handle_getvariablefull(struct ast_channel *chan, AGI *agi, int argc, } if (chan2) { - pbx_substitute_variables_helper(chan2, argv[3], tmp, sizeof(tmp) - 1); - ast_agi_send(agi->fd, chan, "200 result=1 (%s)\n", tmp); + struct ast_str *str = ast_str_create(16); + if (!str) { + ast_agi_send(agi->fd, chan, "200 result=0\n"); + return RESULT_SUCCESS; + } + ast_str_substitute_variables(&str, 0, chan2, argv[3]); + ast_agi_send(agi->fd, chan, "200 result=1 (%s)\n", ast_str_buffer(str)); + ast_free(str); } else { ast_agi_send(agi->fd, chan, "200 result=0\n"); } |