Hi all,

I worked in an prototype recently where I had the following setup working. Kamailio is using Postgres to forward the call to Twilio domain.

Topology:
SIP client (tls) > (SIP Provider) > (tls) Kamailio (udp)  > Twilio > IVR


Right now when I call from SIP Client to IVR, call is not forwarded. Nothing has changed on Kamailio side.

Troubleshooting:

a) SIP client (tls) > (SIP Provider) > (tls) Kamailio (udp)  > Twilio > IVR [Fails] - Case described above.
b) Call from PSTN > (SIP Provider) > (tls) Kamailio (udp)  > Twilio > IVR [Works]

I debug and call arrives to Kamailio but is not being forwarded to Twilio. This used to work before.
When call works Kamailio seems to find remote domain, when fails we just sent a 502 Bad Gateway message

Twilio does not support DNS SRV records, just A host resolution.

Logs

While looking at debugs I found that this DNS logs:
Pastebin below:

Call fails 

Apr 22 06:37:00 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28476]: DEBUG: <core> [dns_cache.c:537]: _dns_hash_find(): (_sip._udp.parzee.sip.twilio.com(31), 33), h=816
Apr 22 06:37:00 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28476]: DEBUG: <core> [resolve.c:741]: get_record(): lookup(_sip._udp.parzee.sip.twilio.com, 33) failed
Apr 22 06:37:00 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28476]: DEBUG: <core> [dns_cache.c:864]: dns_cache_mk_bad_entry(): (_sip._udp.parzee.sip.twilio.com, 33, 60, 1)
Apr 22 06:37:00 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28476]: DEBUG: <core> [dns_cache.c:798]: dns_cache_add(): adding _sip._udp.parzee.sip.twilio.com(31) 33 (flags=1) at 816
Apr 22 06:37:00 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28476]: DEBUG: <core> [dns_cache.c:537]: _dns_hash_find(): (parzee.sip.twilio.com(21), 1), h=267
Apr 22 06:37:00 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28476]: DEBUG: <core> [resolve.c:937]: get_record(): skipping 0 NS (p=0xa1d2e7, end=0xa1d2e7)
Apr 22 06:37:00 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28476]: DEBUG: <core> [resolve.c:952]: get_record(): parsing 0 ARs (p=0xa1d2e7, end=0xa1d2e7)
Apr 22 06:37:00 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28476]: DEBUG: <core> [dns_cache.c:1741]: dns_get_related(): (0x7f1b5c227920 (parzee.sip.twilio.com, 1), 1, *(nil)) (0)
Apr 22 06:37:00 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28476]: DEBUG: <core> [dns_cache.c:840]: dns_cache_add_unsafe(): adding parzee.sip.twilio.com(21) 1 (flags=0) at 267


Call works

Apr 22 07:00:03 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28481]: DEBUG: <core> [dns_cache.c:537]: _dns_hash_find(): (_sip._udp.parzee.sip.twilio.com(31), 33), h=816

Apr 22 07:00:03 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28481]: DEBUG: <core> [resolve.c:741]: get_record(): lookup(_sip._udp.parzee.sip.twilio.com, 33) failed

Apr 22 07:00:03 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28481]: DEBUG: <core> [dns_cache.c:864]: dns_cache_mk_bad_entry(): (_sip._udp.parzee.sip.twilio.com, 33, 60, 1)

Apr 22 07:00:03 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28481]: DEBUG: <core> [dns_cache.c:798]: dns_cache_add(): adding _sip._udp.parzee.sip.twilio.com(31) 33 (flags=1) at 816

Apr 22 07:00:03 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28481]: DEBUG: <core> [dns_cache.c:537]: _dns_hash_find(): (parzee.sip.twilio.com(21), 1), h=267

Apr 22 07:00:03 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28481]: DEBUG: <core> [msg_translator.c:2876]: create_via_hf(): id added: <;i=7>, rcv proto=3

Apr 22 07:00:03 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28481]: DEBUG: <core> [msg_translator.c:158]: check_via_address(): (54.172.60.0, 54.172.60.0, 0)

Apr 22 07:00:03 parzee-sip-kamailio1 /usr/local/sbin/kamailio[28481]: DEBUG: tm [t_funcs.c:368]: t_relay_to(): SER: new transaction fwd'ed


Thank you!