Class SIPTLSChannel
Class for managing SIP connections using the Transport Layer Security (TLS) protocol.
Inherited Members
Namespace: SipLib.Channels
Assembly: SipLib.dll
Syntax
public class SIPTLSChannel : SIPChannel
Constructors
| Edit this page View SourceSIPTLSChannel(X509Certificate2?, IPEndPoint, string?, bool, AcceptConnectionDelegate?, AcceptCertificateDelegate?, AcceptCertificateDelegate?)
Constructs a new SIPTLSChannel and initializes it.
Declaration
public SIPTLSChannel(X509Certificate2? serverCertificate, IPEndPoint localIPEndPoint, string? User = null, bool UseMutualAuth = true, AcceptConnectionDelegate? acceptConnection = null, AcceptCertificateDelegate? acceptClientCertificate = null, AcceptCertificateDelegate? acceptServerCertificate = null)
Parameters
Type | Name | Description |
---|---|---|
X509Certificate2 | serverCertificate | Server X.509 certificate to use |
IPEndPoint | localIPEndPoint | Local IPEndPoint to listen on |
string | User | Specifies the User part of the SIPURI for the local contact URI. This parameter defaults to null. |
bool | UseMutualAuth | If true then use mutual TLS authentication. This parameter defaults to true. |
AcceptConnectionDelegate | acceptConnection | User provided callback function that can determine whether or not to accept a network connection based on the client's IPEndPoint and the protocol type. Defaults to null. |
AcceptCertificateDelegate | acceptClientCertificate | User provided callback function that can determine whether or not to accept a connection from a client based on the client's X.509 certificate. Defaults to null. |
AcceptCertificateDelegate | acceptServerCertificate | User provided callback function that can determine whether or not to allow a connection to a server base on the server's X.509 certificate. Defaults to null. |
Methods
| Edit this page View SourceClose()
Closes the listener socket and closes connections to all clients.
Declaration
public override void Close()
Overrides
| Edit this page View SourceGetConnectionsList()
Gets the current connections dictionary. The returned object must be locked by the caller. Don't use this function because its not thread safe.
Declaration
protected override Dictionary<string, SIPConnection> GetConnectionsList()
Returns
Type | Description |
---|---|
Dictionary<string, SIPConnection> |
Overrides
| Edit this page View SourceGetRemoteCertificate(string)
Virtual function to get the remote certificate for a connection that is being managed by this SIPChannel object.
Declaration
public override 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. |
Overrides
| Edit this page View SourceGetRemoteCertificate2(string)
Virtual function to get the remote certificate for a connection that is being managed by this SIPChannel object.
Declaration
public override 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. |
Overrides
| Edit this page View SourceIsConnectionEstablished(IPEndPoint)
Checks to see if this object is currently connected to a remote endpoint
Declaration
public override bool IsConnectionEstablished(IPEndPoint remoteEndPoint)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint | remoteEndPoint |
Returns
Type | Description |
---|---|
bool | True if currently connected or false if not connected |
Overrides
| Edit this page View SourceSend(IPEndPoint, byte[])
Sends a byte array
Declaration
public override void Send(IPEndPoint dstEndPoint, byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint | dstEndPoint | IPEndPoint to send the message to. |
byte[] | buffer | Message to send. |
Overrides
| Edit this page View SourceSend(IPEndPoint, byte[], string?)
Sends a byte array
Declaration
public override void Send(IPEndPoint dstEndPoint, byte[] buffer, string? serverCertificateName)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint | dstEndPoint | IPEndPoint to send the message to. |
byte[] | buffer | Message to send. |
string | serverCertificateName | Name of the remote endpoint's X.509 certificate. |
Overrides
| Edit this page View SourceSend(IPEndPoint, string)
Sends a string
Declaration
public override void Send(IPEndPoint destinationEndPoint, string message)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint | destinationEndPoint | IPEndPoint to send the message to. |
string | message | Message to send. |
Overrides
Remarks
Must already be connected to the remote endpoint in order to use this method.
Events
| Edit this page View SourceSIPConnectionDisconnected
Fired if the TCP connection gets disconnected
Declaration
public event SipConnectionFailedDelegate? SIPConnectionDisconnected
Event Type
Type | Description |
---|---|
SipConnectionFailedDelegate |
SIPConnectionFailed
Fired if the TCP connection request to a remote endpoint failed.
Declaration
public event SipConnectionFailedDelegate? SIPConnectionFailed
Event Type
Type | Description |
---|---|
SipConnectionFailedDelegate |