Class SIPChannel
Base class for all SIP channel classes.
Inherited Members
Namespace: SipLib.Channels
Assembly: SipLib.dll
Syntax
public abstract class SIPChannel
Fields
| Edit this page View SourceAcceptConnection
Delegate function that can be provided by the user of a SIPConnection derived class to determine whether or not to accept a SIP connection request. The function should return true to accept a connection request or false to refuse it.
If this delegate member is null then all connection requests will be received regardless of where they came from.
Declaration
protected AcceptConnectionDelegate? AcceptConnection
Field Value
Type | Description |
---|---|
AcceptConnectionDelegate |
ChannelStarted
This is set to true when the main listener thread has been started.
Declaration
public bool ChannelStarted
Field Value
Type | Description |
---|---|
bool |
Closed
True if the connection has been closed.
Declaration
protected bool Closed
Field Value
Type | Description |
---|---|
bool |
LocalSIPEndPoint
This is the local SIPEndPoint
Declaration
protected SIPEndPoint LocalSIPEndPoint
Field Value
Type | Description |
---|---|
SIPEndPoint |
LocalTCPSockets
Keeps a list of TCP sockets this process is listening on to prevent it establishing TCP connections to itself. This is used only for TCP and TLS.
Declaration
protected List<string> LocalTCPSockets
Field Value
Type | Description |
---|---|
List<string> |
SIPMessageReceived
Delegate (callback function) that gets called when a SIP message is received.
Declaration
public SIPMessageReceivedDelegate? SIPMessageReceived
Field Value
Type | Description |
---|---|
SIPMessageReceivedDelegate |
SipUri
This is the local SIPURI
Declaration
protected SIPURI SipUri
Field Value
Type | Description |
---|---|
SIPURI |
Properties
| Edit this page View SourceIsReliable
If the underlying transport channel is reliable, such as TCP, this will be set to true;
Declaration
public bool IsReliable { get; }
Property Value
Type | Description |
---|---|
bool |
IsTLS
If true then the SIPConnection uses Transport Layer Security (TLS).
Declaration
public bool IsTLS { get; }
Property Value
Type | Description |
---|---|
bool |
SIPChannelContactURI
This is the URI to be used for contacting this SIP channel.
Declaration
public SIPURI SIPChannelContactURI { get; }
Property Value
Type | Description |
---|---|
SIPURI |
SIPChannelEndPoint
Gets the local SIPEndPoint for the SIP channel
Declaration
public SIPEndPoint SIPChannelEndPoint { get; }
Property Value
Type | Description |
---|---|
SIPEndPoint |
Methods
| Edit this page View SourceClose()
Closes the connection
Declaration
public abstract void Close()
GetConnectionsList()
Gets reference to the dictionary of the connections. The string is the string version of the remote endpoint's IPEndPoint.
Declaration
protected abstract Dictionary<string, SIPConnection> GetConnectionsList()
Returns
Type | Description |
---|---|
Dictionary<string, SIPConnection> |
GetProtocol()
Gets the transport protocol used for this channel.
Declaration
public SIPProtocolsEnum GetProtocol()
Returns
Type | Description |
---|---|
SIPProtocolsEnum | Returns a SIPProtocolsEnum value. |
GetRemoteCertificate(string)
Virtual function to get the remote certificate for a connection that is being managed by this SIPChannel object.
Declaration
public virtual X509Certificate? GetRemoteCertificate(string strRemoteEp)
Parameters
Type | Name | Description |
---|---|---|
string | strRemoteEp | String version of the IP endpoint of the connection. |
Returns
Type | Description |
---|---|
X509Certificate | Returns null if there is no remote certificate available. |
GetRemoteCertificate2(string)
Virtual function to get the remote certificate for a connection that is being managed by this SIPChannel object.
Declaration
public virtual X509Certificate2? GetRemoteCertificate2(string strRemoteEp)
Parameters
Type | Name | Description |
---|---|---|
string | strRemoteEp | String version of the IP endpoint of the connection. |
Returns
Type | Description |
---|---|
X509Certificate2 | Returns null if there is no remote certificate available. |
IsConnectionEstablished(IPEndPoint)
Returns true if there is an established connection the specified IPEndPoint
Declaration
public abstract bool IsConnectionEstablished(IPEndPoint remoteEndPoint)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint | remoteEndPoint |
Returns
Type | Description |
---|---|
bool |
PruneConnections(string)
Periodically checks the established connections and closes any that have not had a transmission for a specified period or where the number of connections allowed per IP address has been exceeded. Only relevant for connection oriented channels such as TCP and TLS.
Declaration
protected void PruneConnections(string threadName)
Parameters
Type | Name | Description |
---|---|---|
string | threadName |
Send(IPEndPoint, byte[])
Sends a SIP message to the specified destination IPEndPoint
Declaration
public abstract void Send(IPEndPoint destinationEndPoint, byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint | destinationEndPoint | Destination to send the message to |
byte[] | buffer | Byte array containing the SIP message |
Send(IPEndPoint, byte[], string?)
Sends a SIP message to a destination IPEndPoint given a byte array and the namd of the server's X.509 certificate name
Declaration
public abstract void Send(IPEndPoint destinationEndPoint, byte[] buffer, string? serverCertificateName)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint | destinationEndPoint | Destination to send the message to |
byte[] | buffer | Byte array containing the SIP message |
string | serverCertificateName | Name of the server's X.509 certificate |
Send(IPEndPoint, string)
Sends a SIP message to the specified destination IPEndPoint
Declaration
public abstract void Send(IPEndPoint destinationEndPoint, string message)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint | destinationEndPoint | Destination to send the message to |
string | message | String message to send |
SetupContactURI(string?)
Sets the local contact SIPURI for this SIPChannel. This method must be called in the constructor of all derived classes.
Declaration
protected void SetupContactURI(string? User)
Parameters
Type | Name | Description |
---|---|---|
string | User | Specifies the User part of the SIPURI. This may be null. |