From 0165c5f95aa058b0884f8dec8695237cb0bef186 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Fri, 3 Oct 2014 17:47:42 +0000 Subject: chan_pjsip: Fix deadlock when masquerading PJSIP channels. Performing a directed call pickup resulted in a deadlock when PJSIP channels were involved. A masquerade needs to hold onto the channel locks while it swaps channel information between the two channels involved in the masquerade. With PJSIP channels, the fixup routine needed to push a fixup task onto the PJSIP channel's serializer. Unfortunately, if the serializer was also processing a task that needed to lock the channel, you get deadlock. * Added a new control frame that is used to notify the channels that a masquerade is about to start and when it has completed. * Added the ability to query taskprocessors if the current thread is the taskprocessor thread. * Added the ability to suspend/unsuspend the PJSIP serializer thread so a masquerade could fixup the PJSIP channel without using the serializer. ASTERISK-24356 #close Reported by: rmudgett Review: https://reviewboard.asterisk.org/r/4034/ ........ Merged revisions 424471 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 424472 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424473 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_iax2.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'channels/chan_iax2.c') diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index a3fb34c23..d093438c8 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -1421,6 +1421,8 @@ static int iax2_is_control_frame_allowed(int subtype) /* Only meaningful across a bridge on this machine for direct-media exchange. */ case AST_CONTROL_PVT_CAUSE_CODE: /* Intended only for the sending machine's local channel structure. */ + case AST_CONTROL_MASQUERADE_NOTIFY: + /* Intended only for masquerades when calling ast_indicate_data(). */ case AST_CONTROL_STREAM_STOP: case AST_CONTROL_STREAM_SUSPEND: case AST_CONTROL_STREAM_RESTART: @@ -5770,6 +5772,7 @@ static int iax2_indicate(struct ast_channel *c, int condition, const void *data, } break; case AST_CONTROL_PVT_CAUSE_CODE: + case AST_CONTROL_MASQUERADE_NOTIFY: res = -1; goto done; } -- cgit v1.2.3