<p></p>

<h3>Description</h3>

<p>I'd like to reduce the number of contacts per AOR for certain UAs, while maintaining a default higher limit.</p>
<pre><code>modparam("registrar", "max_contacts", 10)
modparam("registrar", "xavp_cfg", "reg")

route[REGISTRAR] {
    if($ua=~"^Yealink") {
        $xavp(reg=>max_contacts)=1;
    }

    if(!save("location")) {
        sl_reply_error();
    }
    exit;
}
</code></pre>
<h3>Expected behavior</h3>
<p><a href="https://www.kamailio.org/docs/modules/stable/modules/registrar#registrar.p.xavp_cfg" rel="nofollow">https://www.kamailio.org/docs/modules/stable/modules/registrar#registrar.p.xavp_cfg</a> states:</p>
<ul>
<li>max_contacts - the number of maximum contacts to be stored for the current registration AoR. It <strong>overwrites</strong> the 'max_contacts' module parameter value.</li>
</ul>
<p>I expect that the UA will register with the new contact and have all others removed.</p>
<h4>Actual observed behavior</h4>
<p><code>$xavp(reg=>max_contacts)</code> set to a value lower than the <code>max_contacts</code> modparam does not achieve the <strong>overwrites</strong> expectation from the documentation.</p>
<h4>Log Messages</h4>

<pre><code>INFO: registrar [save.c:619]: test_max_contacts(): too many contacts for AOR <user@example.com>
</code></pre>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<pre><code>version: kamailio 5.4.1-1.gite1d4ddcb6c.fc32 (x86_64/linux) 09fd6a
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 09fd6a 
compiled on 00:00:00 Sep  5 2020 with gcc 10.2.1
</code></pre>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>

<pre><code>Fedora 32, kernel-5.8.4-200.fc32.x86_64
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2471">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZJ24F5T6EHE34X7MM3SEPB6LANCNFSM4Q4V2NOA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZKLSHDQSJ4BOCEX3VTSEPB6LA5CNFSM4Q4V2NOKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4KLEVAGA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2471",
"url": "https://github.com/kamailio/kamailio/issues/2471",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>