Fix a deadlock caused by a race condition between removing a hint and reloading the dialplan and subscribing to the removed hint.

If conditions were right it was possible for both the PBX core and chan_sip to deadlock by both having a lock that the other
wants. In the case of the PBX core it had the contexts lock and wanted a SIP dialog lock, while in the case of chan_sip it
had the SIP dialog lock and wanted the contexts lock.

This fix unlocks the SIP dialog before getting the extension state so that the other thread will not block on trying to lock
it. Once the extension state is retrieved the SIP dialog is locked again and life carries on.

As the SIP dialog is reference counted it is not possible for it to go away after unlocking.

(closes issue ASTERISK-20437)
Reported by: jhutchins
........

Merged revisions 373438 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 373440 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/10-digiumphones@373490 f38db490-d61c-443f-a65b-d21fe96a405b
reenable automerge

git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/10-digiumphones@373491 f38db490-d61c-443f-a65b-d21fe96a405b
Merged revisions 373466,373468 via svnmerge from 
file:///srv/subversion/repos/asterisk/branches/10

................
  r373466 | rmudgett | 2012-09-24 15:44:27 -0500 (Mon, 24 Sep 2012) | 33 lines
  
  Fix potential reentrancy problems in chan_sip.
  
  Asterisk v1.8 and later was not as vulnerable to this issue.
  
  * Made find_call() lock each private as it processes the found dialogs.
  (Primary cause of ABE-2876)
  
  * Made the other functions that traverse the dialogs container lock each
  private as it examines them.
  
  * Fix race condition in sip_call() if the thread that sent the INVITE is
  held up long enough for a response to be processed.  The p->initid for the
  INVITE retransmission could be added after it was canceled by the response
  processing.
  
  * Made __sip_destroy() clean up resource pointers after freeing.  This is
  primarily defensive in case someone has a stale private pointer.
  
  * Removed redundant memset() in reqprep().  The call to init_req() already
  does the memset() and is the first reference to req in reqprep().
  
  * Removed useless set of req.method in transmit_invite().  The calls to
  initreqprep() and reqprep() have to do this because they memset() the req.
  
  JIRA ABE-2876
  
  ..........
  
  Merged -r373423 from https://origsvn.digium.com/svn/asterisk/be/branches/C.3-bier
  ........
  
  Merged revisions 373424 from http://svn.asterisk.org/svn/asterisk/branches/1.8
................
  r373468 | jrose | 2012-09-24 16:05:44 -0500 (Mon, 24 Sep 2012) | 13 lines
  
  func_audiohookinherit: Document some missed sources.
  
  This patch also mentions that AUDIOHOOK_INHERIT can be used to
  transfer MixMonitor audiohooks. There is also wiki that addresses
  audiohooks and the use of AUDIOHOOK_INHERIT at the following link:
  https://wiki.asterisk.org/wiki/display/AST/Audiohooks
  
  (closes issue ASTERISK-18220)
  Reported by: Ishfaq Malik
  ........
  
  Merged revisions 373467 from http://svn.asterisk.org/svn/asterisk/branches/1.8
................


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/10-digiumphones@373498 f38db490-d61c-443f-a65b-d21fe96a405b