Hi
In that case, I would get the return code of the pv_auth_check()
function and use that for the metrics.
- 
https://www.kamailio.org/docs/modules/devel/modules/auth.html#auth.f.pv_auth_check

It's not simple to look at a REGISTER request that has auth in it and
know whether it's a reREGISTER (after several minutes, for example, to
refresh a binding) or simply an authenticated REGISTER for which the
client has just been challenged, but this function can tell you by its
return code. The return codes are the same as those for
pv_www_authenticate().
- -4 (nonce expired)
- -6 (nonce reused)

Those two would tell you that the REGISTER credentials were
generated/used some time ago - default 600 seconds - and therefore
this must be a re-REGISTER.

Does that help?
James

On Tue, 20 May 2025 at 07:13, James Morrison via sr-users
<sr-users@lists.kamailio.org> wrote:
>
> Thanks for reply
> I already know how to detect if it is a new register or re-register. As you 
> know during registration UE first sends a register request which 
> automatically fails the authentication (which is exactly what I want to 
> count)  and then the next request with response to that authentication 
> challenge. In scripts I just want to count the first request, but when it is 
> a re-register, sometimes the first request has the authentication header and 
> response value is not empty.
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions -- 
> sr-users@lists.kamailio.org
> To unsubscribe send an email to sr-users-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- 
sr-users@lists.kamailio.org
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to