[asterisk-dev] [Code Review]: Gently reduce masquerade insanity

David Lee reviewboard at asterisk.org
Thu Jan 10 10:01:15 CST 2013



> On Jan. 7, 2013, 8:51 p.m., rmudgett wrote:
> > /trunk/main/channel.c, lines 7012-7027
> > <https://reviewboard.asterisk.org/r/2266/diff/1/?file=32634#file32634line7012>
> >
> >     You can eliminate one of these name arrays (Preferably newn[]) with some more judicious shuffling of strings.
> >     
> >     Do this as one block of code lines:
> >     1) Swap channel names
> >     2) Rename origclone channel name to zombie.
> 
> David Lee wrote:
>     Maybe I'm being a bit dense, but wouldn't swapping the channel name require a temporary? How is that any different than what's going on with newn?
>     
>     Although I do think I can make the shuffling a bit clearer.

I get it. Reuse the variable. Density lowered.


- David


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


On Jan. 7, 2013, 2:04 p.m., David Lee wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2266/
> -----------------------------------------------------------
> 
> (Updated Jan. 7, 2013, 2:04 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> Masquerades are an insane implementation detail within Asterisk. It generates
> a number of useless and confusing events, and manipulates channels in a way
> that semantically doesn't make sense. I've given a fairly thorough review of
> masquerade code and its usage on the wiki at
> https://wiki.asterisk.org/wiki/x/IwBRAQ.
> 
> While ultimately it makes the most sense to abandon masquerades altogether,
> it will take some time to completely irradicate. Even then, there may always
> be code that's not worth rewriting to get rid of the masquerade.
> 
> This patch does two things to make masquerades slightly less insane:
>  * When swapping the names of the original and clone channel, only emit a
>    single rename event of original -> original<ZOMBIE>. The original code
>    issued three rename events to accomplish the same end.
>  * In addition to swapping the names of the channels, also swap their
>    uniqueid's. This allows the 'Uniqueid' field to be used as a stable
>    identifier for a channel from and external interface, such as AMI.
> 
> 
> Diffs
> -----
> 
>   /trunk/UPGRADE.txt 378651 
>   /trunk/include/asterisk/manager.h 378651 
>   /trunk/main/channel.c 378651 
> 
> Diff: https://reviewboard.asterisk.org/r/2266/diff
> 
> 
> Testing
> -------
> 
> I've run a few SIP transfers and parking scenarios. AMI masquerade events seem
> reasonable, and the Uniqueid and Linkedid fields in CELs made more sense.
> 
> 
> Thanks,
> 
> David
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130110/42b60770/attachment.htm>


More information about the asterisk-dev mailing list