Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#1926 closed enhancement (fixed)

Support IPv6 address resolution

Reported by: nanang Owned by: bennylp
Priority: normal Milestone: release-2.5.5
Component: pjsua-lib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description (last modified by nanang)

This ticket will enable PJSUA application to resolve target hostname to IPv6 address. As currently PJLIB-UTIL DNS resolver has not completely supported IPv6 yet, the resolution will only work when DNS server setting (i.e: pjsua_config.nameserver) is not configured, the library will resolve hostname using pj_getaddrinfo().

Update: Ticket #1927 has been completed, PJLIB-UTIL DNS resolver now supports IPv6 for DNS SRV and DNS A/AAAA resolutions. So the following specifications should be applicable to PJSUA-LIB with and without nameserver settings.

Account transport type

This new field is added to PJSUA account structure (in pjsua internal), it represents account transport preference, i.e: local account will always have specific transport type (as it is created with transport ID param), and normal account will have specific transport type only if it is bound to specific transport, i.e: via pjsua_acc_config.transport_id.

Contact generation

  • If account is bound to a specific transport address family of the contact will use the transport address family.
  • Otherwise:
    • if target is an IP address, generated contact will use the same IP version as target
    • if target is a hostname (this is rather difficult as we don't really resolve the target here, except for a special case below):
      • if account transport type is specified, generated contact will use IP version as account transport type
      • otherwise, it will simply use IPv4 (!) as there is no target resolution here, hence application is recommended to bind an IPv6-only account to a specific IPv6 transport.
      • special case when pjsua_acc_config.contact_use_src_port is set (by default it is set) and target param transport is TCP/TLS, it will resolve target hostname first, try to connect to that IP using transport with the same IP version as target, and update Contact address with the transport binding address, so if the hostname is resolved to IPv6, Contact address will use IPv6 address.

SIP transport

  • If account is bound to a specific transport, it will use that transport
  • Otherwise, it will use transport with same IP version as target (resolved address, if it is a hostname)

Media

Media transport is independent from SIP, currently it will simply follow the account setting, i.e: pjsua_acc_config.ipv6_media_use.

Caveat

  • When making call using hostname 'localhost' (on Windows 10), it will now resolve to IPv6 address (was to IPv4 address). The solution is to make call using account that is bound to IPv4 transport. The OS seems to by default register 'localhost' as '::1' and '127.0.0.1' and '::1' has higher priority.

Change History (5)

comment:1 Changed 9 years ago by nanang

  • Description modified (diff)

comment:2 Changed 9 years ago by nanang

  • Milestone changed from release-2.x to release 2.5.5

comment:3 Changed 9 years ago by nanang

  • Resolution set to fixed
  • Status changed from new to closed

In 5337:

Close #1926: Support IPv6 address resolution without DNS resolver.

comment:4 Changed 9 years ago by nanang

  • Description modified (diff)
  • Summary changed from Support IPv6 address resolution without DNS resolver to Support IPv6 address resolution

comment:5 Changed 8 years ago by nanang

In 5369:

Re #1926: Fixed bug of premature app callback invocation in DNS A+AAAA resolution when DNS A record is available in the cache.

Note: See TracTickets for help on using tickets.