[SR-Users] How to enforce max_contacts at registration?
Daniel-Constantin Mierla
miconda at gmail.com
Thu Aug 18 12:02:41 CEST 2022
Hello,
I looked at code and I couldn't spot quickly anything wrong with using
the xavp. I added more debug message in the git master branch.
Can you add:
pv_xavp_print();
just before save() in your config and test with git master branch and
debug=3? Then send the log messages printed for the registration that
should exceed the limit set in the xavp.
Cheers,
Daniel
On 18.08.22 10:04, Benoit Panizzon wrote:
> Hi Daniel
>
> debug=3
>
> Two CEP already registered. Registering a 3rd one (snom).
>
> Some IP and Hostnames replaced by 'HIDDEN'.
>
> Aug 18 07:52:55 dev-cpereg02 kamailio[1187007]: INFO: [1 315995001 zygwpey7 at snom 1899942452 REGISTER]<script>: REGISTRAR: Setting max_contacts to 2 for sip:315995001 at dev-cpereg02.HIDDEN
> Aug 18 07:52:55 dev-cpereg02 kamailio[1187007]: DEBUG: [1 315995001 zygwpey7 at snom 1899942452 REGISTER]registrar [regpv.c:552]: pv_fetch_contacts_helper(): memory block between 0x7fd0c5bc7230 - 0x7fd0c5bc73a8
> Aug 18 07:52:55 dev-cpereg02 kamailio[1187007]: DEBUG: [1 315995001 zygwpey7 at snom 1899942452 REGISTER]registrar [regpv.c:552]: pv_fetch_contacts_helper(): memory block between 0x7fd0c5bc7410 - 0x7fd0c5bc75ea
> Aug 18 07:52:55 dev-cpereg02 kamailio[1187007]: DEBUG: [1 315995001 zygwpey7 at snom 1899942452 REGISTER]registrar [regpv.c:574]: pv_fetch_contacts_helper(): fetched <2> contacts for <315995001> in [caller]
> Aug 18 07:52:55 dev-cpereg02 kamailio[1187007]: INFO: [1 315995001 zygwpey7 at snom 1899942452 REGISTER]<script>: REGISTRAR: Existing registration contacts count: 2
> Aug 18 07:52:55 dev-cpereg02 kamailio[1187007]: INFO: [1 315995001 zygwpey7 at snom 1899942452 REGISTER]<script>: REGISTRAR: 0: Contact-Address: sip:315995001 at HIDDEN:5060 Agent: Cisco/SPA112-1.4.1_SR5 Expires: 1660811132
> Aug 18 07:52:55 dev-cpereg02 kamailio[1187007]: INFO: [1 315995001 zygwpey7 at snom 1899942452 REGISTER]<script>: REGISTRAR: 1: Contact-Address: sip:315995001 at HIDDEN;transport=udp Agent: Linphone Desktop/ (Debian GNU/Linux 11 (bullseye), Qt 5.15.2) LinphoneCore/4.4.21 Expires: 1660810748
> Aug 18 07:52:55 dev-cpereg02 kamailio[1187007]: INFO: [1 315995001 zygwpey7 at snom 1899942452 REGISTER]<script>: REGISTRAR: XAVP: <null> before setting
> Aug 18 07:52:55 dev-cpereg02 kamailio[1187007]: INFO: [1 315995001 zygwpey7 at snom 1899942452 REGISTER]<script>: REGISTRAR: XAVP: 2 after setting
> Aug 18 07:52:55 dev-cpereg02 kamailio[1187007]: DEBUG: [1 315995001 zygwpey7 at snom 1899942452 REGISTER]registrar [save.c:324]: pack_ci(): set instance[<urn:uuid:1844976b-42aa-4810-b846-13783b5a8c8f>]
> Aug 18 07:52:55 dev-cpereg02 kamailio[1187007]: DEBUG: [1 315995001 zygwpey7 at snom 1899942452 REGISTER]<core> [core/utils/sruid.c:209]: sruid_nextx(): new sruid is [uloc-62fdee99-121cbf-1] (1 / 22)
> Aug 18 07:52:55 dev-cpereg02 kamailio[1187007]: DEBUG: [1 315995001 zygwpey7 at snom 1899942452 REGISTER]registrar [save.c:420]: pack_ci(): generated ruid is: uloc-62fdee99-121cbf-1
> Aug 18 07:52:55 dev-cpereg02 kamailio[1187007]: DEBUG: [1 315995001 zygwpey7 at snom 1899942452 REGISTER]registrar [save.c:607]: test_max_contacts(): 2 valid contacts
> Aug 18 07:52:55 dev-cpereg02 kamailio[1187007]: DEBUG: [1 315995001 zygwpey7 at snom 1899942452 REGISTER]registrar [save.c:629]: test_max_contacts(): 3 contacts after commit
>
> Produced by:
>
> $avp(max_contacts) is 2 for this $aU.
>
> $var(saveuri) = "sip:" + $aU + "@" + $rd;
>
> if ($avp(debug) > 0) {
> xlog("L_INFO", "$cfg(route): Setting max_contacts to $avp(max_contacts) for $var(saveuri)\n");
> if(reg_fetch_contacts("location", "$var(saveuri)", "caller")) {
> xlog("L_INFO","$cfg(route): Existing registration contacts count: $(ulc(caller=>count))\n");
> $var(i) = 0;
> while($var(i) < $(ulc(caller=>count))) {
> xlog("L_INFO","$cfg(route): $var(i): Contact-Address: $(ulc(caller=>addr)[$var(i)]) Agent: $(ulc(caller=>user_agent)[$var(i)]) Expires: $(ulc(caller=>expires)[$var(i)])\n");
> $var(i) = $var(i) + 1;
> }
> } else {
> xlog("L_INFO","$cfg(route): No existing contacts for AOR $var(saveuri)\n");
> }
> }
> xlog("L_INFO","$cfg(route): XAVP: $xavp(reg=>max_contacts) before setting\n");
> $xavp(reg=>max_contacts) = $avp(max_contacts);
> xlog("L_INFO","$cfg(route): XAVP: $xavp(reg=>max_contacts) after setting\n");
>
> $var(result) = save("location","0x00","$var(saveuri)");
>
> == snipp ==
>
> # kamctl ul show 315995001 at dev-cpereg01.[HIDDEN] | grep Address
> "Address": "sip:315995001@[HIDDEN].229:5060",
> "Address": "sip:315995001@[HIDDEN]:9afa:9bff:fe4a:aa55];transport=udp",
> "Address": "sip:315995001@[HIDDEN]:204:13ff:fe30:2a80]:3038;transport=udp;line=8usewy",
>
> 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
> ______________________________________________________
--
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
More information about the sr-users
mailing list