mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 03:48:02 +00:00
lock the channel before calling ast_bridged_channel() to prevent a seg fault.
AMI agents list called on shutdown causes a segfault, introducing proper locking will prevent this. (closes issue ASTERISK-18092) Reported by: agustina Patches: chan_agent.patch (License #5041) patch uploaded by irroot git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@335978 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1506,6 +1506,7 @@ static int action_agents(struct mansession *s, const struct message *m)
|
|||||||
char *talkingto = NULL;
|
char *talkingto = NULL;
|
||||||
char *talkingtoChan = NULL;
|
char *talkingtoChan = NULL;
|
||||||
char *status = NULL;
|
char *status = NULL;
|
||||||
|
struct ast_channel *bridge;
|
||||||
|
|
||||||
if (!ast_strlen_zero(id))
|
if (!ast_strlen_zero(id))
|
||||||
snprintf(idText, sizeof(idText) ,"ActionID: %s\r\n", id);
|
snprintf(idText, sizeof(idText) ,"ActionID: %s\r\n", id);
|
||||||
@@ -1530,10 +1531,13 @@ static int action_agents(struct mansession *s, const struct message *m)
|
|||||||
if (p->owner && p->owner->_bridge) {
|
if (p->owner && p->owner->_bridge) {
|
||||||
talkingto = S_COR(p->chan->caller.id.number.valid,
|
talkingto = S_COR(p->chan->caller.id.number.valid,
|
||||||
p->chan->caller.id.number.str, "n/a");
|
p->chan->caller.id.number.str, "n/a");
|
||||||
if (ast_bridged_channel(p->owner))
|
ast_channel_lock(p->owner);
|
||||||
talkingtoChan = ast_strdupa(ast_bridged_channel(p->owner)->name);
|
if ((bridge = ast_bridged_channel(p->owner))) {
|
||||||
else
|
talkingtoChan = ast_strdupa(bridge->name);
|
||||||
|
} else {
|
||||||
talkingtoChan = "n/a";
|
talkingtoChan = "n/a";
|
||||||
|
}
|
||||||
|
ast_channel_unlock(p->owner);
|
||||||
status = "AGENT_ONCALL";
|
status = "AGENT_ONCALL";
|
||||||
} else {
|
} else {
|
||||||
talkingto = "n/a";
|
talkingto = "n/a";
|
||||||
|
|||||||
Reference in New Issue
Block a user