aboutsummaryrefslogtreecommitdiffstats
path: root/channel.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-08-13 18:29:58 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-08-13 18:29:58 +0000
commit2d8b03612b8b39f9f4f11639205c2070a34f47e1 (patch)
tree1ac413cd10cfa9aa21e237f3ae6a9287593dff0c /channel.c
parentbd0679195f59fd5ef7d94aea54011912c0b316fc (diff)
Lock on indication, fix agent buglet
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1313 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rwxr-xr-xchannel.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/channel.c b/channel.c
index 81f3a6660..dd80cc85e 100755
--- a/channel.c
+++ b/channel.c
@@ -1150,6 +1150,7 @@ int ast_indicate(struct ast_channel *chan, int condition)
/* Stop if we're a zombie or need a soft hangup */
if (chan->zombie || ast_check_hangup(chan))
return -1;
+ ast_mutex_lock(&chan->lock);
if (chan->pvt->indicate)
res = chan->pvt->indicate(chan, condition);
if (!chan->pvt->indicate || res) {
@@ -1173,17 +1174,19 @@ int ast_indicate(struct ast_channel *chan, int condition)
if (ts && ts->data[0]) {
ast_log(LOG_DEBUG, "Driver for channel '%s' does not support indication %d, emulating it\n", chan->name, condition);
ast_playtones_start(chan,0,ts->data, 1);
+ res = 0;
} else if (condition == AST_CONTROL_PROGRESS) {
/* ast_playtones_stop(chan); */
} else {
/* not handled */
ast_log(LOG_WARNING, "Unable to handle indication %d for '%s'\n", condition, chan->name);
- return -1;
+ res = -1;
}
}
else ast_playtones_stop(chan);
}
- return 0;
+ ast_mutex_unlock(&chan->lock);
+ return res;
}
int ast_recvchar(struct ast_channel *chan, int timeout)