Class SIPClientWebSocketChannel
A SIP transport Channel for establishing an outbound connection over a Web Socket communications layer as per RFC7118. The channel can manage multiple connections. All SIP clients wishing to initiate a connection to a SIP web socket server should use a single instance of this class.
Implements
Inherited Members
Namespace: SIPSorcery.SIP
Assembly: SIPSorcery.dll
Syntax
public class SIPClientWebSocketChannel : SIPChannel, IDisposable
Constructors
| Improve this Doc View SourceSIPClientWebSocketChannel()
Declaration
public SIPClientWebSocketChannel()
SIPClientWebSocketChannel(Encoding, Encoding)
Creates a SIP channel to establish outbound connections and send SIP messages over a web socket communications layer.
Declaration
public SIPClientWebSocketChannel(Encoding sipEncoding, Encoding sipBodyEncoding)
Parameters
Type | Name | Description |
---|---|---|
System.Text.Encoding | sipEncoding | |
System.Text.Encoding | sipBodyEncoding |
Fields
| Improve this Doc View SourceSIP_Sec_WebSocket_Protocol
Declaration
public const string SIP_Sec_WebSocket_Protocol = "sip"
Field Value
Type | Description |
---|---|
System.String |
WEB_SOCKET_SECURE_URI_PREFIX
Declaration
public const string WEB_SOCKET_SECURE_URI_PREFIX = "wss://"
Field Value
Type | Description |
---|---|
System.String |
WEB_SOCKET_URI_PREFIX
Declaration
public const string WEB_SOCKET_URI_PREFIX = "ws://"
Field Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceClose()
Closes all web socket connections.
Declaration
public override void Close()
Overrides
| Improve this Doc View SourceDispose()
Calls close on the channel when it is disposed.
Declaration
public override void Dispose()
Overrides
| Improve this Doc View SourceHasConnection(SIPEndPoint)
Checks whether the client web socket SIP channel has a connection to the requested server end point.
Declaration
public override bool HasConnection(SIPEndPoint serverEndPoint)
Parameters
Type | Name | Description |
---|---|---|
SIPEndPoint | serverEndPoint |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
| Improve this Doc View SourceHasConnection(String)
Checks whether the web socket SIP channel has a connection matching a unique connection ID.
Declaration
public override bool HasConnection(string connectionID)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionID | The connection ID to check for a match on. |
Returns
Type | Description |
---|---|
System.Boolean | True if a match is found or false if not. |
Overrides
| Improve this Doc View SourceHasConnection(Uri)
Checks whether there is an existing client web socket connection for a remote end point.
Declaration
public override bool HasConnection(Uri serverUri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | serverUri | The server URI to check for an existing connection. |
Returns
Type | Description |
---|---|
System.Boolean | True if there is a connection or false if not. |
Overrides
| Improve this Doc View SourceIsAddressFamilySupported(AddressFamily)
Checks whether the specified address family is supported.
Declaration
public override bool IsAddressFamilySupported(AddressFamily addresFamily)
Parameters
Type | Name | Description |
---|---|---|
System.Net.Sockets.AddressFamily | addresFamily | The address family to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if supported, false if not. |
Overrides
| Improve this Doc View SourceIsProtocolSupported(SIPProtocolsEnum)
Checks whether the specified protocol is supported.
Declaration
public override bool IsProtocolSupported(SIPProtocolsEnum protocol)
Parameters
Type | Name | Description |
---|---|---|
SIPProtocolsEnum | protocol | The protocol to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if supported, false if not. |
Overrides
| Improve this Doc View SourceSendAsync(SIPEndPoint, Byte[], Boolean, String)
Ideally sends on the web socket channel should specify the connection ID. But if there's a good reason not to we can check if there is an existing client connection with the requested remote end point and use it.
Declaration
public override Task<SocketError> SendAsync(SIPEndPoint dstEndPoint, byte[] buffer, bool canInitiateConnection, string connectionIDHint)
Parameters
Type | Name | Description |
---|---|---|
SIPEndPoint | dstEndPoint | The remote destination end point to send the data to. |
System.Byte[] | buffer | The data to send. |
System.Boolean | canInitiateConnection | |
System.String | connectionIDHint | The ID of the specific web socket connection to try and send the message on. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Sockets.SocketError> | If no errors SocketError.Success otherwise an error value. |
Overrides
| Improve this Doc View SourceSendSecureAsync(SIPEndPoint, Byte[], String, Boolean, String)
Send to a secure web socket server.
Declaration
public override Task<SocketError> SendSecureAsync(SIPEndPoint dstEndPoint, byte[] buffer, string serverCertificateName, bool canInitiateConnection, string connectionIDHint)
Parameters
Type | Name | Description |
---|---|---|
SIPEndPoint | dstEndPoint | |
System.Byte[] | buffer | |
System.String | serverCertificateName | |
System.Boolean | canInitiateConnection | |
System.String | connectionIDHint |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Sockets.SocketError> |