aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--channels/chan_agent.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 02c175388..0b1590341 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -2289,7 +2289,9 @@ static int function_agent(struct ast_channel *chan, const char *cmd, char *data,
ast_copy_string(buf, agent->moh, len);
else if (!strcasecmp(args.item, "channel")) {
if (agent->chan) {
+ ast_channel_lock(agent->chan);
ast_copy_string(buf, agent->chan->name, len);
+ ast_channel_unlock(agent->chan);
tmp = strrchr(buf, '-');
if (tmp)
*tmp = '\0';