<h3>Description</h3>
<p>Multiple rules with the same prefix and with the stopper flag are added. All the rules have the same priority in the target table.<br>
When routing calls to this prefix (load_gw + next_gw), the LCR module does not load balance the calls, it always sends to the same GW.</p>
<h4>Reproduction</h4>
<p>Scenario is the following, the LCR rules have one default GW which is reachable via an empty rule. However, a certain prefix must not be sent there, so a rule with the stopper flag is added pointing to another GW. This works fine and the default GW is never attempted.<br>
However, for load balance purposes, it is necessary to send calls to this prefix to 2 different GWs. So another rule with the same prefix is added with the stopper flag set too. The target table was updated accordingly and has the same priority.<br>
When we have all this setup, by calling "next_gw()" we always get the same GW (which is random depending on the DB situation I think). The other(s) GW is never attempted.<br>
This does not allow to load balance 2 GWs for rules with the stopper flag.<br>
Given the stopper flag should prevent selecting shorter prefixes, it should not restrict the routing for rules with the same prefix (same length). Having this, the load balance of stopper rules would be possible.</p>
<h3>Possible Solutions</h3>
<p>Apparently, there is no workaround, expect by not using the stopper flag, however then there is a risk of sending calls to GWs with shorter prefix length which is not desired.</p>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<pre><code>kamailio -v
version: kamailio 5.2.2 (x86_64/linux) 67f967
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, 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
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: 67f967 
compiled on 11:40:41 Mar 11 2019 with gcc 4.8.5
</code></pre>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>
<pre><code>uname -a
Linux uat1-sbc-0002 3.10.0-1062.1.2.el7.x86_64 #1 SMP Mon Sep 30 14:19:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

</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/2105?email_source=notifications&email_token=ABO7UZL4A7UT7EQ7E526YVTQPUYPJA5CNFSM4JCYDKJ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HTB3AVQ">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZOOMIYAY4UAJPIWXFLQPUYPJANCNFSM4JCYDKJQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZMHT2TRK3IQEY2XGWLQPUYPJA5CNFSM4JCYDKJ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HTB3AVQ.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/2105?email_source=notifications\u0026email_token=ABO7UZL4A7UT7EQ7E526YVTQPUYPJA5CNFSM4JCYDKJ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HTB3AVQ",
"url": "https://github.com/kamailio/kamailio/issues/2105?email_source=notifications\u0026email_token=ABO7UZL4A7UT7EQ7E526YVTQPUYPJA5CNFSM4JCYDKJ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HTB3AVQ",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>