From f9461535d310ff4158346736f83332a5cd7a96d6 Mon Sep 17 00:00:00 2001
From: Tilghman Lesher <tilghman@meg.abyt.es>
Date: Tue, 25 Nov 2008 17:44:30 +0000
Subject: [PATCH] Don't limit the length of the hint at the final step (from
 ~8100 chars max (or ~500 chars max on LOW_MEMORY) to 80 chars max).  This
 will allow more channels to be used in a single hint.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@159162 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 main/pbx.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/main/pbx.c b/main/pbx.c
index d765b411ee..cf32c76373 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -762,6 +762,7 @@ struct ast_app;
 static struct ast_taskprocessor *device_state_tps;
 
 AST_THREADSTORAGE(switch_data);
+AST_THREADSTORAGE(extensionstate_buf);
 
 /*!
    \brief ast_exten: An extension
@@ -3707,7 +3708,7 @@ static struct ast_exten *ast_hint_extension(struct ast_channel *c, const char *c
 /*! \brief Check state of extension by using hints */
 static int ast_extension_state2(struct ast_exten *e)
 {
-	char hint[AST_MAX_EXTENSION] = "";
+	struct ast_str *hint = ast_str_thread_get(&extensionstate_buf, 16);
 	char *cur, *rest;
 	struct ast_devstate_aggregate agg;
 	enum ast_device_state state;
@@ -3717,9 +3718,9 @@ static int ast_extension_state2(struct ast_exten *e)
 
 	ast_devstate_aggregate_init(&agg);
 
-	ast_copy_string(hint, ast_get_extension_app(e), sizeof(hint));
+	ast_str_set(&hint, 0, "%s", ast_get_extension_app(e));
 
-	rest = hint;	/* One or more devices separated with a & character */
+	rest = hint->str;	/* One or more devices separated with a & character */
 
 	while ( (cur = strsep(&rest, "&")) )
 		ast_devstate_aggregate_add(&agg, ast_device_state(cur));
-- 
GitLab