From: Terry Wilson Date: Wed, 22 Sep 2010 23:00:30 +0000 (+0000) Subject: Don't let a Local channel get bridged to itself X-Git-Tag: 1.4.38-rc1~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=947cea177f94e2006e0ca9bbff1accb212615e25;p=thirdparty%2Fasterisk.git Don't let a Local channel get bridged to itself If a local channel gets bridged to itself, it becomes orphaned with no devices left to actually tell it to hang up. This patch modifies local_fixup() to detect this case and deny it. Review: https://reviewboard.asterisk.org/r/934 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@288499 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_local.c b/channels/chan_local.c index 5f17e18144..da133393c6 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -442,6 +442,15 @@ static int local_fixup(struct ast_channel *oldchan, struct ast_channel *newchan) p->owner = newchan; else p->chan = newchan; + + /* Do not let a masquerade cause a Local channel to be bridged to itself! */ + if (p->owner->_bridge == p->chan || p->chan->_bridge == p->owner) { + ast_log(LOG_WARNING, "You can not bridge a Local channel to itself!\n"); + ast_mutex_unlock(&p->lock); + ast_queue_hangup(newchan); + return -1; + } + ast_mutex_unlock(&p->lock); return 0; }