Hi Daniel,
I am using call load distribution algorithm calling _ds_select_dst_ function with '10' as second argument, as described in [dispatcher module doc files](http://kamailio.org/docs/modules/4.4.x/modules/dispatcher.html#dispatcher.f....).
The problem I notice is that **all gateways without maxload attribute are discarded**, even though the documentation says that if maxload is set to 0, no active call limit is used. The same thing happens if I set maxload to 0.
Reading the code I think the problem is in [_ds_get_leastloaded_ function in dispatch.c file](https://github.com/kamailio/kamailio/blob/4.4/modules/dispatcher/dispatch.c#...).
This is the patch I have used:
``` diff --git a/modules/dispatcher/dispatch.c b/modules/dispatcher/dispatch.c index c1a831b..1e0064d 100644 --- a/modules/dispatcher/dispatch.c +++ b/modules/dispatcher/dispatch.c @@ -1449,7 +1449,8 @@ int ds_get_leastloaded(ds_set_t *dset) for(j=0; j<dset->nr; j++) { if(!ds_skip_dst(dset->dlist[j].flags) - && dset->dlist[j].dload<dset->dlist[j].attrs.maxload) + && (dset->dlist[j].attrs.maxload == 0 + || dset->dlist[j].dload < dset->dlist[j].attrs.maxload)) { if(dset->dlist[j].dload<t) { ```
I have done my tests with this version:
``` # kamailio -v version: kamailio 4.4.3 (x86_64/linux) e43d82-dirty 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_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: e43d82 -dirty compiled on 12:38:36 Sep 27 2016 with gcc 4.7.2 ```
Thank you and regards,