mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 10:33:13 +00:00
Lock on indication, fix agent buglet
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1313 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1150,6 +1150,7 @@ int ast_indicate(struct ast_channel *chan, int condition)
|
|||||||
/* Stop if we're a zombie or need a soft hangup */
|
/* Stop if we're a zombie or need a soft hangup */
|
||||||
if (chan->zombie || ast_check_hangup(chan))
|
if (chan->zombie || ast_check_hangup(chan))
|
||||||
return -1;
|
return -1;
|
||||||
|
ast_mutex_lock(&chan->lock);
|
||||||
if (chan->pvt->indicate)
|
if (chan->pvt->indicate)
|
||||||
res = chan->pvt->indicate(chan, condition);
|
res = chan->pvt->indicate(chan, condition);
|
||||||
if (!chan->pvt->indicate || res) {
|
if (!chan->pvt->indicate || res) {
|
||||||
@@ -1173,17 +1174,19 @@ int ast_indicate(struct ast_channel *chan, int condition)
|
|||||||
if (ts && ts->data[0]) {
|
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_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);
|
ast_playtones_start(chan,0,ts->data, 1);
|
||||||
|
res = 0;
|
||||||
} else if (condition == AST_CONTROL_PROGRESS) {
|
} else if (condition == AST_CONTROL_PROGRESS) {
|
||||||
/* ast_playtones_stop(chan); */
|
/* ast_playtones_stop(chan); */
|
||||||
} else {
|
} else {
|
||||||
/* not handled */
|
/* not handled */
|
||||||
ast_log(LOG_WARNING, "Unable to handle indication %d for '%s'\n", condition, chan->name);
|
ast_log(LOG_WARNING, "Unable to handle indication %d for '%s'\n", condition, chan->name);
|
||||||
return -1;
|
res = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else ast_playtones_stop(chan);
|
else ast_playtones_stop(chan);
|
||||||
}
|
}
|
||||||
return 0;
|
ast_mutex_unlock(&chan->lock);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ast_recvchar(struct ast_channel *chan, int timeout)
|
int ast_recvchar(struct ast_channel *chan, int timeout)
|
||||||
|
@@ -246,6 +246,8 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
|
|||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
CHECK_FORMATS(ast, p);
|
CHECK_FORMATS(ast, p);
|
||||||
if (p->chan) {
|
if (p->chan) {
|
||||||
|
p->chan->exception = ast->exception;
|
||||||
|
p->chan->fdno = ast->fdno;
|
||||||
f = ast_read(p->chan);
|
f = ast_read(p->chan);
|
||||||
} else
|
} else
|
||||||
f = &null_frame;
|
f = &null_frame;
|
||||||
|
Reference in New Issue
Block a user