Lock masquerading into channel

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1291 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer 2003-08-11 20:45:43 +00:00
parent 5dc7640d74
commit 886cf4f227
1 changed files with 5 additions and 0 deletions

View File

@ -129,11 +129,16 @@ static void check_bridge(struct local_pvt *p, int isoutbound)
return;
if (isoutbound && p->chan && p->chan->bridge && p->owner) {
/* Masquerade bridged channel into owner */
/* Lock other side first */
ast_pthread_mutex_lock(&p->chan->bridge->lock);
ast_channel_masquerade(p->owner, p->chan->bridge);
ast_pthread_mutex_unlock(&p->chan->bridge->lock);
p->alreadymasqed = 1;
} else if (!isoutbound && p->owner && p->owner->bridge && p->chan) {
/* Masquerade bridged channel into chan */
ast_pthread_mutex_lock(&p->owner->bridge->lock);
ast_channel_masquerade(p->chan, p->owner->bridge);
ast_pthread_mutex_unlock(&p->owner->bridge->lock);
p->alreadymasqed = 1;
}
}