### Description 1. Added 3 gateways to the dispatcher list file: ``` 1 sip:naptr.mydomain.net 0 0 2 sip:srv.mydomain.net 0 0 ``` started kamailio and ran: ```kamcmd dispatcher.list``` Output: ```error: 500 - No Destination Sets``` If I append to the list, one gateway which resolves to an A record (or an IP:PORT format) like e.g.: ```3 sip:a.mydomain.net:5060 0 0```, it shows up in the dispatcher list just fine: ``` { NRSETS: 1 RECORDS: { SET: { ID: 3 TARGETS: { DEST: { URI: sip:a.mydomain.net:5060 FLAGS: AP PRIORITY: 0 LATENCY: { AVG: 14.642 STD: 0.05 EST: 15.0345 MAX: 25.452 TIMEOUT: 0 } } } } } } ```
I also verified the DNS resolution with: ```kamcmd dns.lookup naptr naptr.mydomain.net``` and ```kamcmd dns.lookup srv srv.mydomain.net``` which was perfectly as expected.
Since I wasn't even able to see a dispatcher loaded, there was no operation that I could do to it to set it to active or anything else.
A network trace just shows A record queries to all gateways with no success on those which have NAPTR/SRV records.
#### Reproduction 100% reproducible with the description above.
### Additional Information
Tested on Kamailio version 4.4.5 and 5.1.1 with the following detailed version info:
``` version: kamailio 5.1.1 (x86_64/linux) flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, 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. compiled with /usr/bin/gcc 4.1.2 ```
Can you try with latest master branch and set flags with value 16? I pushed a patch to allow skipping the DNS A/AAAA query at startup. This will disable the matching with ds_is_from_list(), keepalives should still be sent by doing NAPTR/SRV/... at runtime.
If all works fine, then I can backport to branch 5.2 to get it fixed.
NAPTRs/SRVs and A records are working as expected, but if a gateway with flag=16 is not resolvable by DNS, it is incorrectly kept in the ```FLAGS: AX``` state and not ```IP```. Whereas if an A-record (flag!=16) is not resolvable, it is correctly set to ```IP```.
Iirc, AX is active state, which should be the expected in this case, because NAPTR+SRV can return many records of A/AAAA/CNAME/IP type, and the module is not keeping track of them.
Sometimes not all of them are returned, just couple, being rotated for the purpose of DNS based load balancer. So, the idea is that an address with flag 16 set should be used always.
You can set retransmission timeout to a short interval to fail over to another destination quickly, instead of trying to rely on not selecting it due to inactive state. This should be done also even for IP addresses, because the keepalive is sent periodically, in the intervals between them the destination can become inactive.
For now, I think the use of naptr/srv only records is working as expected.
Closed #1743.