Class SIPEndPoint
This class is a more specific version of the SIPURI class BUT is only concerned with the network and transport properties. It contains all the information needed to determine the remote end point to deliver a SIP request or response to.
This class must remain immutable otherwise the SIP stack can develop problems. SIP end points can get passed amongst different servers for logging and forwarding SIP messages and a modification of the end point by one server can result in a problem for a different server. Instead a new SIP end point should be created wherever a modification is required.
Inherited Members
Namespace: SipLib.Core
Assembly: SipLib.dll
Syntax
public class SIPEndPoint
Constructors
| Edit this page View SourceSIPEndPoint(SIPProtocolsEnum, IPAddress, int)
Instantiates a new SIP end point from a protocol, an IP address and a port number. Unspecified properties will be set to their defaults.
Declaration
public SIPEndPoint(SIPProtocolsEnum protocol, IPAddress address, int port)
Parameters
Type | Name | Description |
---|---|---|
SIPProtocolsEnum | protocol | Protocol for the SIPEndPoint |
IPAddress | address | IPAddress of the SIPEndPoint |
int | port | Port number of the SIPEndPoint |
SIPEndPoint(SIPProtocolsEnum, IPAddress, int, string?, string?)
Instantiates a new SIP end point.
Declaration
public SIPEndPoint(SIPProtocolsEnum protocol, IPAddress address, int port, string? channelID, string? connectionID)
Parameters
Type | Name | Description |
---|---|---|
SIPProtocolsEnum | protocol | The SIP transport/application protocol used for the transmission. |
IPAddress | address | The network address. |
int | port | The network port. |
string | channelID | Optional. The unique ID of the channel that created the end point. |
string | connectionID | Optional. For connection oriented protocols the unique ID of the connection. For connectionless protocols should be set to null. |
SIPEndPoint(SIPProtocolsEnum, IPEndPoint)
Creates a SIP endpoint from the protocol and an IPEndPoint. Unspecified properties will be set to their default values.
Declaration
public SIPEndPoint(SIPProtocolsEnum protocol, IPEndPoint endPoint)
Parameters
Type | Name | Description |
---|---|---|
SIPProtocolsEnum | protocol | Protocol for the SIPEndPoint |
IPEndPoint | endPoint | IPEndPoint for the SIPEndPoint |
SIPEndPoint(SIPProtocolsEnum, IPEndPoint, string?, string?)
Constructs a new SIPEndPoint given an IPEndPoint and all parameters
Declaration
public SIPEndPoint(SIPProtocolsEnum protocol, IPEndPoint endPoint, string? channelID, string? connectionID)
Parameters
Type | Name | Description |
---|---|---|
SIPProtocolsEnum | protocol | Protocol for the SIPEndPoint |
IPEndPoint | endPoint | IPEndPoint for the SIPEndPoint |
string | channelID | Optional. The unique ID of the channel that created the end point. |
string | connectionID | Optional. For connection oriented protocols the unique ID of the connection. For connectionless protocols should be set to null. |
SIPEndPoint(SIPURI)
Constructs a SIPEndPoint from a SIPURI. Unspecified parameters will be set to their default values.
Declaration
public SIPEndPoint(SIPURI sipURI)
Parameters
Type | Name | Description |
---|---|---|
SIPURI | sipURI | Input SIPURI to build the SIPEndPoint from |
SIPEndPoint(IPEndPoint)
Instantiates a new SIP end point from a network end point. Unspecified properties will be set to their defaults.
Declaration
public SIPEndPoint(IPEndPoint endPoint)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint | endPoint | Input IPEndPoint to create the SIPEndPoint from |
Properties
| Edit this page View SourceAddress
The network address for the SIP end point. IPv4 and IPv6 are supported.
Declaration
public IPAddress? Address { get; }
Property Value
Type | Description |
---|---|
IPAddress |
ChannelID
If set represents the SIP channel ID that this SIP end point was created from.
Declaration
public string? ChannelID { get; set; }
Property Value
Type | Description |
---|---|
string |
ConnectionID
For connection oriented transport protocols such as TCP, TLS and WebSockets this ID can record the unique connection a SIP message was received on. This makes it possible to ensure responses or subsequent request can re-use the same connection.
Declaration
public string? ConnectionID { get; set; }
Property Value
Type | Description |
---|---|
string |
Port
The network port for the SIP end point.
Declaration
public int Port { get; }
Property Value
Type | Description |
---|---|
int |
Protocol
The transport/application layer protocol the SIP end point is using.
Declaration
public SIPProtocolsEnum Protocol { get; }
Property Value
Type | Description |
---|---|
SIPProtocolsEnum |
Methods
| Edit this page View SourceAreEqual(SIPEndPoint, SIPEndPoint)
Determines if two SIPEndPoints are equal.
Declaration
public static bool AreEqual(SIPEndPoint endPoint1, SIPEndPoint endPoint2)
Parameters
Type | Name | Description |
---|---|---|
SIPEndPoint | endPoint1 | First SIPEndPoint object |
SIPEndPoint | endPoint2 | Second SIPEndPoint object |
Returns
Type | Description |
---|---|
bool | Returns true if they are equal or false if they are not. |
AreSocketsEqual(SIPEndPoint, SIPEndPoint)
Determines whether the socket destination for two different SIP end points are equal.
Declaration
public static bool AreSocketsEqual(SIPEndPoint endPoint1, SIPEndPoint endPoint2)
Parameters
Type | Name | Description |
---|---|---|
SIPEndPoint | endPoint1 | First end point to compare. |
SIPEndPoint | endPoint2 | Second end point to compare. |
Returns
Type | Description |
---|---|
bool | True if the end points both resolve to the same protocol and IP end point. |
CopyOf()
Creates a deep copy of this SIPEndPoint object
Declaration
public SIPEndPoint CopyOf()
Returns
Type | Description |
---|---|
SIPEndPoint |
Equals(object?)
Determines if another SIPEndPoint object is equal to this one.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | Another SIPEndPoint object |
Returns
Type | Description |
---|---|
bool | Returns true if they are equal of false if they are not. |
Overrides
| Edit this page View SourceGetHashCode()
Computes the hash code for this object
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
| Edit this page View SourceGetIPEndPoint(bool)
Get the IP end point from the SIP end point
Declaration
public IPEndPoint GetIPEndPoint(bool mapIpv4ToIpv6 = false)
Parameters
Type | Name | Description |
---|---|---|
bool | mapIpv4ToIpv6 | Set to true if a resultant IPv4 end point should be mapped to IPv6. This is required in some cases when using dual mode sockets. For example Mono requires that a destination IP end point for a dual mode socket is set as IPv6. |
Returns
Type | Description |
---|---|
IPEndPoint | An IP end point. |
IsSocketEqual(SIPEndPoint)
Determines if the socket destination of a SIPEndPoint object is equal to the socket destination of this SIPEndPoint object
Declaration
public bool IsSocketEqual(SIPEndPoint endPoint)
Parameters
Type | Name | Description |
---|---|---|
SIPEndPoint | endPoint |
Returns
Type | Description |
---|---|
bool | True if the end points both resolve to the same protocol and IP end point. |
ParseSIPEndPoint(string)
Parses a SIP end point from either a serialised SIP end point string, format of: (udp|tcp|tls|ws|wss):(IPEndpoint)[;connid=abcd] or from a string that represents a SIP URI.
Declaration
public static SIPEndPoint? ParseSIPEndPoint(string sipEndPointStr)
Parameters
Type | Name | Description |
---|---|---|
string | sipEndPointStr | The string to parse to extract the SIP end point. |
Returns
Type | Description |
---|---|
SIPEndPoint | If successful a SIPEndPoint object or null otherwise. |
ToString()
Converts this SIPEndPoint object to a string
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
| Edit this page View SourceTryParse(string)
Tries to parse a SIPEndPoint from a string.
Declaration
public static SIPEndPoint? TryParse(string sipEndPointStr)
Parameters
Type | Name | Description |
---|---|---|
string | sipEndPointStr | Input string |
Returns
Type | Description |
---|---|
SIPEndPoint | Returns a new SIPEndPoint object if successful. Return null if an error occurred. |
Operators
| Edit this page View Sourceoperator ==(SIPEndPoint, SIPEndPoint)
Equals operator for the SIPEndPoint class
Declaration
public static bool operator ==(SIPEndPoint endPoint1, SIPEndPoint endPoint2)
Parameters
Type | Name | Description |
---|---|---|
SIPEndPoint | endPoint1 | |
SIPEndPoint | endPoint2 |
Returns
Type | Description |
---|---|
bool |
operator !=(SIPEndPoint, SIPEndPoint)
Not equal operator for the SIPEndPoint class
Declaration
public static bool operator !=(SIPEndPoint endPoint1, SIPEndPoint endPoint2)
Parameters
Type | Name | Description |
---|---|---|
SIPEndPoint | endPoint1 | |
SIPEndPoint | endPoint2 |
Returns
Type | Description |
---|---|
bool |