I noticed that sometimes the trunk registration just fails after TTL expiry and the kamailio tries to resolve an A record for next_hop=sip:reg.sip-trunk.telekom.de:5060;transport=tcp where actually no A record exists resulting in an unregistered trunk for one register period. After the one failed period the SRV will result in correct CNAME resolving again and the trunk will be registered for one full hour (baes on TTL expiry of SRV record).
``` Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: uac [uac_reg.c:1138]: uac_reg_send(): using custom socket tcp:10.124.2.2:5060 to send request Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: <core> [core/socket_info.c:702]: grep_sock_info(): checking if host==us: 10==10 && [10.124.2.2] == [10.124.2.2] Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: <core> [core/socket_info.c:709]: grep_sock_info(): checking if port 5060 (advertise 5060) matches port 5060 Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: tm [h_table.c:580]: tm_xdata_replace(): replace existing list in backup xd from new xd Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: tm [h_table.c:413]: build_cell(): created new cell 0x7fc7766aa400 Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: tm [h_table.c:568]: tm_xdata_replace(): restore X/AVP msg context from backup data Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: tm [uac.c:468]: t_uac_prepare(): next_hop=sip:reg.sip-trunk.telekom.de:5060;transport=tcp Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: <core> [core/dns_cache.c:534]: _dns_hash_find(): (_sip._tcp.reg.sip-trunk.telekom.de(34), 33), h=666 Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: <core> [core/resolve.c:999]: get_record(): skipping 0 NS (p=0x560cf3e135dc, end=0x560cf3e135dc) Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: <core> [core/resolve.c:1012]: get_record(): parsing 0 ARs (p=0x560cf3e135dc, end=0x560cf3e135dc) Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: <core> [core/dns_cache.c:1640]: dns_get_related(): (0x7fc7766f9ab8 (_sip._tcp.reg.sip-trunk.telekom.de, 33), 33, *(nil)) (0) Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: <core> [core/dns_cache.c:746]: dns_cache_add_unsafe(): adding _sip._tcp.reg.sip-trunk.telekom.de(34) 33 (flags=0) at 666 Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: <core> [core/dns_cache.c:534]: _dns_hash_find(): (reg.sip-trunk.telekom.de(24), 1), h=400 Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: <core> [core/resolve.c:784]: get_record(): lookup(reg.sip-trunk.telekom.de, 1) failed Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: <core> [core/dns_cache.c:768]: dns_cache_mk_bad_entry(): (reg.sip-trunk.telekom.de, 1, 60, 1) Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: <core> [core/dns_cache.c:708]: dns_cache_add(): adding reg.sip-trunk.telekom.de(24) 1 (flags=1) at 400 Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: ERROR: <core> [core/resolve.c:1730]: sip_hostport2su(): could not resolve hostname: "reg.sip-trunk.telekom.de" Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: ERROR: tm [ut.h:309]: uri2dst2(): failed to resolve "reg.sip-trunk.telekom.de" Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: ERROR: tm [uac.c:491]: t_uac_prepare(): no socket found Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: DEBUG: tm [h_table.c:132]: free_cell_helper(): freeing transaction 0x7fc7766aa400 from uac.c:632 Aug 21 16:55:57 seelze-iptel1 kamailio[4116711]: ERROR: uac [uac_reg.c:1178]: uac_reg_send(): failed to send request for [siptrunk] ``` At this point it should not try to resolve reg.sip-trunk.telekom.de but instead one of the SRV CNAMES.