]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Fix a race condition where a reinvite could trigger a 482 response.
authorMark Michelson <mmichelson@digium.com>
Thu, 14 May 2009 22:17:55 +0000 (22:17 +0000)
committerMark Michelson <mmichelson@digium.com>
Thu, 14 May 2009 22:17:55 +0000 (22:17 +0000)
commit7aa29c797a338efc84ea1d6490ba1e01ab1eb307
tree3ad386b96a8306f608e8106cfa3078472f7f4491
parent7189d758051d3cf467dc1ca29337a766e92eb8b2
Fix a race condition where a reinvite could trigger a 482 response.

The loop detection/spiral detection code in chan_sip used the owner
channel's state as a criterion for determining if the incoming INVITE
is a looped request. The problem with this is that the INVITE-handling
code happens in a different thread than the thread that marks the owner
channel as being up. As a result, if a reinvite were to come in very quickly,
say from another Asterisk on the same LAN, it was possible for the reinvite
to arrive before the owner channel had been set to the up state.

This patch corrects the problem by using the invitestate of the sip_pvt
instead, since that can be guaranteed to be set correctly by the time
the reinvite arrives. Since there is a switch statement further in the
INVITE-handling code, the AST_STATE_RINGING state also checks the invitestate
of the sip_pvt in case we should actually be treating the channel as if it were
up already.

(closes issue #12215)
Reported by: jpyle
Patches:
      12215_confirmed.patch uploaded by mmichelson (license 60)
Tested by: lmadsen

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