[asterisk-dev] masquerade() Education
Steve Murphy
murf at parsetree.com
Mon Dec 18 18:12:31 CST 2023
I think this letter, if I were to write to only one person, would be
Josh Colp.
But I know that Josh would appreciate my asking in this forum, so all
could enjoy the question and its answer.
My Question is this: A decade (or more) ago, I had high hopes of
masquerade() being obsolesced in Asterisk, with the introduction of
channel bridging. But, I see in rel 20, that masquerade still exists,
and is used in parking, queues, and looking thru the ChangeLog, a lot of
work has been done to correct problems, and work around masqueraded
channels. I saw this comment:
<from 2017-03-15> (Richard Mudgett)
"Dereferencing struct ast_autochan.chan without first calling
ast_autochan_channel_lock() is unsafe because the pointer could
change at
any time due to a masquerade. Unfortunately,
ast_autochan_channel_lock()
itself uses struct ast_autochan.chan unsafely and can result in a
deadlock
if the original channel happens to get destroyed after a
masquerade in
addition to the pointer getting changed."
"The problem is more likely to happen with v11 and earlier because
masquerades are used to optimize out local channels on those versions
However, it could still happen on newer versions if the channel is
executing a dialplan application when the channel is transferred or
redirected. In this situation a masquerade still must be used."
While my work revolves largely around asterisk, this issue comes up over
and over, especially when it's time to upgrade to a new version of
Asterisk. I keep intending to ask about it, but finally, I have this
chance. Why exactly is masquerade() still necessary? I am asking more
out of curiosity than condemnation or other negative reasons! I would
love to understand the issues, perhaps at some point in time, I may be
able to help.
murf
More information about the asterisk-dev
mailing list