diff --git a/include/re_sip.h b/include/re_sip.h index f4fce22..e5524f3 100644 --- a/include/re_sip.h +++ b/include/re_sip.h @@ -282,6 +282,7 @@ void sip_reply_addr(struct sa *addr, const struct sip_msg *msg, bool rport); int sip_auth_authenticate(struct sip_auth *auth, const struct sip_msg *msg); int sip_auth_alloc(struct sip_auth **authp, sip_auth_h *authh, void *arg, bool ref); +void sip_auth_reset(struct sip_auth *auth); /* dialog */ diff --git a/src/sip/auth.c b/src/sip/auth.c index d6288ac..30ae464 100644 --- a/src/sip/auth.c +++ b/src/sip/auth.c @@ -285,3 +285,12 @@ int sip_auth_alloc(struct sip_auth **authp, sip_auth_h *authh, return 0; } + + +void sip_auth_reset(struct sip_auth *auth) +{ + if (!auth) + return; + + list_flush(&auth->realml); +} diff --git a/src/sipreg/reg.c b/src/sipreg/reg.c index 367c128..a108c0e 100644 --- a/src/sipreg/reg.c +++ b/src/sipreg/reg.c @@ -168,6 +168,10 @@ static void response_handler(int err, const struct sip_msg *msg, void *arg) return; + case 403: + sip_auth_reset(reg->auth); + break; + case 423: minexp = sip_msg_hdr(msg, SIP_HDR_MIN_EXPIRES); if (!minexp || !pl_u32(&minexp->val) || !reg->expires)