res_pjsip_outbound_registration.c: Fix 423 response handling.
authorRichard Mudgett <rmudgett@digium.com>
Tue, 17 Nov 2015 20:53:57 +0000 (14:53 -0600)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 18 Nov 2015 19:26:49 +0000 (13:26 -0600)
commiteaf898ac881585c23ac0fcb31c5369809c68b1bb
treee30053beaeace9f6b34fe316ccba5f62df6da932
parente90bb44b76d1c34817b5ad7db34c1c595c644702
res_pjsip_outbound_registration.c: Fix 423 response handling.

Receiving a 423 Interval Too Brief response after authentication for an
outbound registration attempt results in assuming that the registrar has
rejected the registration permanently.  If there are no configured retries
for fatal responses then the outbound registration is stopped for that
endpoint.

For registrations, PJSIP/PJPROJECT intercepts the handling of 423
responses and does not include any authentication in the updated
registration request.  When the updated request is challenged then the
Asterisk code assumes that we were challenged again because the peer
rejected the authentication we sent earlier.

* Made registration challenges keep track of the CSeq number to determine
if the received challenge response was for the request we thought we sent.
If the response's CSeq number differs from the CSeq number we last sent
with authentication then authenticate again because it is a challenge to a
different request.

Change-Id: I81b4bd36d1be095bab606e34b8b44e6302971b09
res/res_pjsip_outbound_registration.c