Fix #
3580212: Connection drops after a few hours
When we receive a 401 Unauthorized to a REGISTER message we used to
check the register attempt counter. But that was obsoleted and now we
check if the security context is already valid, i.e. when the
authentication handshake has failed.
While this is the correct behaviour during an authentication handshake,
this change unfortunately now prevents the code from reaching the next
check, where we check for failed RE-REGISTER attempts. Thus a failed
RE-REGISTER attempt leads to a connection failure instead of a forced
re-authentication attempt.
Swapping the checks in sip-transport.c fixes this problem.