Fix deadlock in SIP transfers that involve a REFER request
authorMatthew Jordan <mjordan@digium.com>
Tue, 12 Jun 2012 14:07:13 +0000 (14:07 +0000)
committerMatthew Jordan <mjordan@digium.com>
Tue, 12 Jun 2012 14:07:13 +0000 (14:07 +0000)
commit8bc3c1e20fe11204b6aa39ba0d23fcee67b7813e
tree181ee410caf4143b8938390e89447750bab0bd81
parentafa03bd3107c6116f3252451def0498248cf8ffc
Fix deadlock in SIP transfers that involve a REFER request

In r367163, "send to voicemail" functionality was added to the SIP channel
driver.  This required updating the party redirecting information for the
channel based on the headers provided in the REFER request.  When the
redirecting party information is updated on the channel, a call to
ast_indicate_data occurs.  Because handle_request_refer still had the sip_pvt
locked, a deadlock could occur between the pbx_thread and the do_monitor thread
servicing the REFER request.

This patch preserves the proper locking order between the channel and the
sip_pvt by ensuring that the sip_pvt is unlocked prior to updating the party
redirecting information on the channel.

(closes issue AST-903)
Reported by: Matt Jordan
patches:
  jira_ast_903_trunk.patch by rmudgett (license 5621)

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