[SR-Users] Determine destination address family

Alex Balashov abalashov at evaristesys.com
Wed Oct 31 18:15:46 CET 2018


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

-- 
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) 
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/



More information about the sr-users mailing list