aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--channels/chan_agent.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index c8f3381c5..6f34e39b7 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -728,9 +728,15 @@ static int agent_indicate(struct ast_channel *ast, int condition, const void *da
struct agent_pvt *p = ast->tech_pvt;
int res = -1;
ast_mutex_lock(&p->lock);
- if (p->chan && !ast_check_hangup(p->chan))
- res = p->chan->tech->indicate ? p->chan->tech->indicate(p->chan, condition, data, datalen) : -1;
- else
+ if (p->chan && !ast_check_hangup(p->chan)) {
+ while (ast_channel_trylock(p->chan)) {
+ ast_channel_unlock(ast);
+ usleep(1);
+ ast_channel_lock(ast);
+ }
+ res = p->chan->tech->indicate ? p->chan->tech->indicate(p->chan, condition, data, datalen) : -1;
+ ast_channel_unlock(p->chan);
+ } else
res = 0;
ast_mutex_unlock(&p->lock);
return res;