diff --git a/src/sipreg/reg.c b/src/sipreg/reg.c index 76e558c75..1cbb56a05 100644 --- a/src/sipreg/reg.c +++ b/src/sipreg/reg.c @@ -223,6 +223,12 @@ static void response_handler(int err, const struct sip_msg *msg, void *arg) case 401: case 407: + if (reg->ls.failc > 1 && + reg->ls.last_scode == msg->scode) { + reg->failc++; + goto out; + } + sip_auth_reset(reg->auth); err = sip_auth_authenticate(reg->auth, msg); if (err) {