chan_sip.c: Update dialog fromtag after request with auth
authorDamian Ivereigh <damo@launtel.net.au>
Thu, 11 Jun 2015 13:18:48 +0000 (23:18 +1000)
committerDamian Ivereigh <damo@launtel.net.au>
Fri, 12 Jun 2015 14:02:34 +0000 (09:02 -0500)
commit19f60d94121f91146e4ec0ea4b2f25a84c2d6f88
treefbecf7ab1a43f3a64c2e301f4b592a75d522e341
parentbb00b26f35157192f58ec8a79f428e7250877823
chan_sip.c: Update dialog fromtag after request with auth

If a client sends and INVITE which is 401 rejected, then subsequently
sends a new INVITE with the auth info and uses a different fromtag
from the first INVITE, Asterisk will accept the new INVITE as part of
the original dialog - match_req_to_dialog() specifically ignores the
fromtag. However it does not update the stored dialog with the new
fromtag.

This results in Asterisk being unable to match future packets that are
part of this dialog (such as the ACK to the OK or the OK to the BYE),
and the call is dropped.

This problem was originally found when using an NEC-i SV8100-GE (NEC SIP
Card).

* After a successful match of a packet to the dialog, if the packet is
  not a SIP_RESPONSE, authentication is present and the fromtags are
  different, the stored fromtag is updated with the one from the recent
  INVITE.

ASTERISK-25154 #close
Reported by: Damian Ivereigh
Tested by: Damian Ivereigh

Change-Id: I5c16cf3b409e5ef9f2b2fe974b6bd2a45a6aa17e
channels/chan_sip.c