[asterisk-dev] [Code Review] Don't let a Local channel get bridged to itself
Alec Davis
sivad.a at paradise.net.nz
Fri Sep 24 05:16:50 CDT 2010
> On 2010-09-24 05:11:44, Alec Davis wrote:
> > /branches/1.4/channels/chan_local.c, line 448
> > <https://reviewboard.asterisk.org/r/934/diff/1/?file=12588#file12588line448>
> >
> > Shouldn't you check that we're not a hangup, otherwise finish up with noise on console after each masq optimized out channel.
> >
> > Like below, but "Only Hangup.." is for example only.
> >
> > if (p->owner->_bridge == p->chan || p->chan->_bridge == p->owner) {
> > if (!ast_check_hangup(newchan)) {
> > ast_log(LOG_WARNING, "You can not bridge a Local channel %s to itself!\n", newchan->name);
> > ast_mutex_unlock(&p->lock);
> > ast_queue_hangup(newchan);
> > return -1;
> > } else {
> > ast_log(LOG_WARNING, "Only hangup can bridge a Local channel %s to itself!\n", newchan->name);
> > }
> > }
> >
using localchan test as below. Dial 10002, and you'll get a console message "You can not bridge a Local channel to itself!"
[phones]
exten => 10000,1,Answer()
exten => 10000,n,Playback(test-tones-follow)
exten => 10000,n,Milliwatt()
exten => _1XXXX,1,Set(i=${MATH(${EXTEN}-1,int)})
exten => _1XXXX,n,Dial(Local/${i}@phones)
- Alec
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/934/#review2780
-----------------------------------------------------------
On 2010-09-22 17:33:51, Terry Wilson wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/934/
> -----------------------------------------------------------
>
> (Updated 2010-09-22 17:33:51)
>
>
> Review request for Asterisk Developers.
>
>
> Summary
> -------
>
> Through craziness, it is currently possible to get a Local channel bridged to itself.
>
> [default]
> exten => _XXXX,n,Dial(SIP/${EXTEN})
> exten => _7XXXX,1,Dial(Local/${EXTEN:1}/nm)
>
> Dialing 76002 from a SIP phone and sending a REFER replacing the original call results in the two SIP channels going away, but leaving an orphaned Local channel with the ,1 side bridged to the ,2 side. The only way to hang up the call then is through the CLI, AMI, etc.
>
> This patch catches the attempt to bridge a local channel to its other side in the fixup() callback, and denies it.
>
>
> Diffs
> -----
>
> /branches/1.4/channels/chan_local.c 288419
>
> Diff: https://reviewboard.asterisk.org/r/934/diff
>
>
> Testing
> -------
>
> Tested before and after on 1.4 and trunk. After the patch, the call is hung up if someone tries something so silly.
>
>
> Thanks,
>
> Terry
>
>
More information about the asterisk-dev
mailing list