Merged revisions 329995 via svnmerge from
authorJason Parker <jparker@digium.com>
Thu, 28 Jul 2011 15:46:16 +0000 (15:46 +0000)
committerJason Parker <jparker@digium.com>
Thu, 28 Jul 2011 15:46:16 +0000 (15:46 +0000)
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r329995 | qwell | 2011-07-28 10:45:49 -0500 (Thu, 28 Jul 2011) | 13 lines

  Merged revisions 329994 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.8

  ........
    r329994 | qwell | 2011-07-28 10:45:24 -0500 (Thu, 28 Jul 2011) | 6 lines

    Fix a SIP transfer deadlock.

    The locking in this function is very scary.  There are like 6 structs involved.

    (closes issue AST-470)
  ........
................

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@329996 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 69cfea7..b08a549 100644 (file)
@@ -23138,8 +23138,6 @@ static int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual *
 
                ast_do_masquerade(target.chan1);
 
 
                ast_do_masquerade(target.chan1);
 
-               sip_pvt_lock(transferer); /* the transferer pvt is expected to remain locked on return */
-
                ast_indicate(target.chan1, AST_CONTROL_UNHOLD);
                if (target.chan2) {
                        ast_indicate(target.chan2, AST_CONTROL_UNHOLD);
                ast_indicate(target.chan1, AST_CONTROL_UNHOLD);
                if (target.chan2) {
                        ast_indicate(target.chan2, AST_CONTROL_UNHOLD);
@@ -23180,6 +23178,8 @@ static int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual *
                        ast_channel_queue_connected_line_update(target.chan1, &connected_to_transferee, NULL);
 
                }
                        ast_channel_queue_connected_line_update(target.chan1, &connected_to_transferee, NULL);
 
                }
+               sip_pvt_lock(transferer); /* the transferer pvt is expected to remain locked on return */
+
                ast_channel_unref(current->chan1);
        }
 
                ast_channel_unref(current->chan1);
        }