/* 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) {
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)