[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:11:44 CDT 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/934/#review2780
-----------------------------------------------------------



/branches/1.4/channels/chan_local.c
<https://reviewboard.asterisk.org/r/934/#comment5983>

    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);
                    }
            }
    


- Alec


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