Hello,
How can I determine the address family (IPv6 or IPv4) of a destination? The destination in this case is a hostname. I'd like to set a flag if the destination is IPv6 but not sure how to go about it.
Thanks,
Isaac
On Wed, Oct 31, 2018 at 10:16:40AM -0700, Isaac wrote:
How can I determine the address family (IPv6 or IPv4) of a destination? The destination in this case is a hostname. I'd like to set a flag if the destination is IPv6 but not sure how to go about it.
Hi,
You can look up the underlying IP address with dns_query() from the ipops module:
https://kamailio.org/docs/modules/5.1.x/modules/ipops.html#ipops.f.dns_query
Which also provides these testing functions:
https://kamailio.org/docs/modules/5.1.x/modules/ipops.html#ipops.f.is_ipv4 https://kamailio.org/docs/modules/5.1.x/modules/ipops.html#ipops.f.is_ipv6
-- Alex
That's exactly what I need.
Thanks!
On 10/31/2018 10:15 AM, Alex Balashov wrote:
On Wed, Oct 31, 2018 at 10:16:40AM -0700, Isaac wrote:
How can I determine the address family (IPv6 or IPv4) of a destination? The destination in this case is a hostname. I'd like to set a flag if the destination is IPv6 but not sure how to go about it.
Hi,
You can look up the underlying IP address with dns_query() from the ipops module:
https://kamailio.org/docs/modules/5.1.x/modules/ipops.html#ipops.f.dns_query
Which also provides these testing functions:
https://kamailio.org/docs/modules/5.1.x/modules/ipops.html#ipops.f.is_ipv4 https://kamailio.org/docs/modules/5.1.x/modules/ipops.html#ipops.f.is_ipv6
-- Alex