aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_agi.c
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_agi.c')
-rw-r--r--res/res_agi.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index c3dc147ff..0203bbb9a 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -1619,16 +1619,32 @@ static int handle_verbose(struct ast_channel *chan, AGI *agi, int argc, char **a
static int handle_dbget(struct ast_channel *chan, AGI *agi, int argc, char **argv)
{
int res;
- char tmp[256];
+ struct ast_str *buf;
if (argc != 4)
return RESULT_SHOWUSAGE;
- res = ast_db_get(argv[2], argv[3], tmp, sizeof(tmp));
+
+ if (!(buf = ast_str_create(16))) {
+ ast_agi_send(agi->fd, chan, "200 result=-1\n");
+ return RESULT_SUCCESS;
+ }
+
+ do {
+ res = ast_db_get(argv[2], argv[3], buf->str, buf->len);
+ if (buf->used < buf->len - 1) {
+ break;
+ }
+ if (ast_str_make_space(&buf, buf->len * 2)) {
+ break;
+ }
+ } while (1);
+
if (res)
ast_agi_send(agi->fd, chan, "200 result=0\n");
else
- ast_agi_send(agi->fd, chan, "200 result=1 (%s)\n", tmp);
+ ast_agi_send(agi->fd, chan, "200 result=1 (%s)\n", buf->str);
+ ast_free(buf);
return RESULT_SUCCESS;
}