[SR-Users] How to enforce max_contacts at registration?

Daniel-Constantin Mierla miconda at gmail.com
Wed Aug 17 11:37:43 CEST 2022


Hello,

On 16.08.22 16:09, Benoit Panizzon wrote:
> Hi List
>
> After some more google research and finding this thread
>
> https://www.mail-archive.com/sr-dev@lists.kamailio.org/msg18728.html
>
> and some more testing, I think I can conclude that setting 
>
> $xavp(reg=>max_contacts) = $anyvalue
>
> is just not working as described in the documentation:
>
> https://kamailio.org/docs/modules/5.1.x/modules/registrar.html#idp47250596

what actually happens? New registrations are accepted with different
contact headers? Have you run with debug=3 to see if you can spot any
hint in the logs?


> So I went ahead and pulled:
>
> reg_fetch_contacts("location", "$var(saveuri)", "caller")
> to get $(ulc(caller=>count))
>
> But now I face a new problem: When I get a registration, I don't know
> if this a legitimate update for a existing registration or the insertion
> of a new registration which would exceed the numbers of registration I
> want to allow for that specific AOR.

It's up to you to do the match, the simplest is to compare the contact
address, but that can fail with devices behind the nat having the same
private address in different networks. Then source address, callid, path
... can be added to the matching expression. You can look at usrloc
module readme, there is a parameter to specify how to match and inspire
from there.

Cheers,
Daniel

>
> Any hint how to solve that challenge or how $xavp(reg=>max_contacts)
> could be made to work as documented?
>
> Mit freundlichen Grüssen
>
> -Benoît Panizzon-
> -- 
> I m p r o W a r e   A G    -    Leiter Commerce Kunden
> ______________________________________________________
>
> Zurlindenstrasse 29             Tel  +41 61 826 93 00
> CH-4133 Pratteln                Fax  +41 61 826 93 01
> Schweiz                         Web  http://www.imp.ch
> ______________________________________________________
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users at lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the sender!
> Edit mailing list options or unsubscribe:
>   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda




More information about the sr-users mailing list