Class SipDnsClient
Class for doing DNS server lookups for SIP.
This class uses the LookupClient class of the DnsClient class library.
It uses a single instance of the LookupClient class per application so that features such as the results cache and connection pooling are used. The LookupCLient class is thread-safe and so is this class.
Inherited Members
Namespace: SipLib.Network
Assembly: SipLib.dll
Syntax
public static class SipDnsClient
Methods
| Edit this page View SourceResolveSipServerAsync(SIPURI, bool, bool, bool)
If the input SIPURI does not contain an IP endpoint then resolve the server name into an IP endpoint and return a new SIPURI object. If the input SIPURI contains an IP endpoint, then return the input SIPURI.
Declaration
public static Task<SIPURI?> ResolveSipServerAsync(SIPURI inSipUri, bool includeIPv6 = false, bool preferIPv6 = false, bool useHostsFile = false)
Parameters
| Type | Name | Description |
|---|---|---|
| SIPURI | inSipUri | Input SIPURI to get an IP endpoint for. If this SIPURI specifies a port then that port is used in the new SIPURI. If it does not contain a port number then the default port number for the SIP sheme is used (5060 for sip or 5061 for sips). |
| bool | includeIPv6 | If true, the resolve for IPv6 addresses. Else only IPv4 addresses are searched for. The default is false. |
| bool | preferIPv6 | If true, then IPv6 is preferred over IPv4. Defaults to false. Used only if includeIPv6 is true. |
| bool | useHostsFile | If true, then use the .NET Dns.GetHostEntry() function to search for addresses. Dns.GetHostEntry() also searches the local Hosts file. Defaults fo false. Dns.GetHostEntry() is only called if unable to resolve any IP addresses using the DnsClient class library. |
Returns
| Type | Description |
|---|---|
| Task<SIPURI> | If the input SIPURI object does not contain an IP endpoint, then a new SIPURI is built containing the first IP address found. If the input SIPURI object contains an IP endpoint then that SIPURI is returned unmodified. |