C# Class SIPSorcery.SIP.SIPTransport

Record number of each type of request received.
Show file Open project: sipsorcery/sipsorcery Class Usage Examples

Public Properties

Property Type Description
BlackholeAddress System.Net.IPAddress
ContactIPAddress System.Net.IPAddress
PerformanceMonitorPrefix string

Public Methods

Method Description
AddSIPChannel ( List sipChannels ) : void

Adds additional SIP Channels to the transport layer.

AddSIPChannel ( SIPChannel sipChannel ) : void

Adds an additional SIP Channel to the transport layer.

CreateCancelTransaction ( SIPRequest sipRequest, SIPEndPoint dstEndPoint, SIPEndPoint localSIPEndPoint, UASInviteTransaction inviteTransaction ) : SIPCancelTransaction
CreateNonInviteTransaction ( SIPRequest sipRequest, SIPEndPoint dstEndPoint, SIPEndPoint localSIPEndPoint, SIPEndPoint outboundProxy ) : SIPNonInviteTransaction
CreateUACTransaction ( SIPRequest sipRequest, SIPEndPoint dstEndPoint, SIPEndPoint localSIPEndPoint, SIPEndPoint outboundProxy, bool sendOkAckManually = false ) : UACInviteTransaction
CreateUASTransaction ( SIPRequest sipRequest, SIPEndPoint dstEndPoint, SIPEndPoint localSIPEndPoint, SIPEndPoint outboundProxy, bool noCDR = false ) : UASInviteTransaction
DoesTransactionExist ( SIPRequest sipRequest ) : bool
FindSIPChannel ( SIPEndPoint localSIPEndPoint ) : SIPChannel

Attempts to match a SIPChannel for this process that has the specified local end point and protocol.

GetDefaultSIPEndPoint ( ) : SIPEndPoint
GetDefaultSIPEndPoint ( SIPEndPoint destinationEP ) : SIPEndPoint
GetDefaultSIPEndPoint ( SIPProtocolsEnum protocol ) : SIPEndPoint
GetDefaultTransportContact ( SIPProtocolsEnum protocol ) : SIPEndPoint
GetHostEndPoint ( string host, bool async ) : SIPDNSLookupResult
GetListeningSIPEndPoints ( ) : List
GetRequest ( SIPMethodsEnum method, SIPURI uri ) : SIPRequest
GetRequest ( SIPMethodsEnum method, SIPURI uri, SIPToHeader to, SIPEndPoint localSIPEndPoint ) : SIPRequest
GetRequestEndPoint ( SIPRequest sipRequest, SIPEndPoint outboundProxy, bool async ) : SIPDNSLookupResult

Based on the information in the SIP request attempts to determine the end point the request should be sent to.

GetResponse ( SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, SIPResponseStatusCodesEnum responseCode, string reasonPhrase ) : SIPResponse

Used to create a SIP response when it was not possible to parse the incoming SIP request.

GetResponse ( SIPRequest sipRequest, SIPResponseStatusCodesEnum responseCode, string reasonPhrase ) : SIPResponse
GetTransaction ( SIPRequest sipRequest ) : SIPTransaction
GetTransaction ( string transactionId ) : SIPTransaction
GetURIEndPoint ( SIPURI uri, bool async ) : SIPDNSLookupResult
IsLocalSIPEndPoint ( SIPEndPoint sipEndPoint ) : bool
PreProcessRouteInfo ( SIPRequest sipRequest ) : void

This function performs processing on a request to handle any actions that need to be taken based on the Route header.

The main sections in the RFC3261 dealing with Route header processing are sections 12.2.1.1 for request processing and 16.4 for proxy processing. The steps to process requests for Route headers are: 1. If route set is empty no further action is required, forward to destination resolved from request URI, 2. If the request URI is identified as a value that was previously set as a Route by this SIP agent it means the previous hop was a strict router. Replace the reqest URI with the last Route header and go to next step, 3. If the top most route header was set by this SIP agent then remove it and go to next step, 4. If the top most route set does contain the lr parameter then forward to the destination resolved by it, 5. If the top most route header does NOT contain the lr parameter is must be popped and inserted as the request URI and the original request URI must be added to the end of the route set, forward to destination resolved from request URI,

ReceiveMessage ( SIPChannel sipChannel, SIPEndPoint remoteEndPoint, byte buffer ) : void
RemoveSIPChannel ( SIPChannel sipChannel ) : void
SIPTransport ( ResolveSIPEndPointDelegate sipResolver, SIPTransactionEngine transactionEngine ) : NUnit.Framework
SIPTransport ( ResolveSIPEndPointDelegate sipResolver, SIPTransactionEngine transactionEngine, SIPChannel sipChannel, bool queueIncoming ) : NUnit.Framework
SIPTransport ( ResolveSIPEndPointDelegate sipResolver, SIPTransactionEngine transactionEngine, bool queueIncoming ) : NUnit.Framework
SendRaw ( SIPEndPoint localSIPEndPoint, SIPEndPoint destinationEndPoint, byte buffer ) : void

Allows raw bytes to be sent from one of the SIPTransport sockets. This should not be used for SIP payloads and instead is provided to allow other types of payloads to be multi-plexed on the SIP socket. Examples are sending NAT keep alives and STUN responses where it's useful to use the same socket as the SIP packets.

SendRequest ( SIPEndPoint dstEndPoint, SIPRequest sipRequest ) : void
SendRequest ( SIPRequest sipRequest ) : void
SendResponse ( SIPEndPoint dstEndPoint, SIPResponse sipResponse ) : void
SendResponse ( SIPResponse sipResponse ) : void
SendSIPReliable ( SIPTransaction sipTransaction ) : void

Sends a SIP request/response and keeps track of whether a response/acknowledgement has been received. If no response is received then periodic retransmits are made for up to T1 x 64 seconds.

Shutdown ( ) : void

Private Methods

Method Description
CheckTransactionEngineExists ( ) : void
FireSIPBadRequestInTraceEvent ( SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, string message, SIPValidationFieldsEnum sipErrorField, string rawMessage ) : void
FireSIPBadResponseInTraceEvent ( SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, string message, SIPValidationFieldsEnum sipErrorField, string rawMessage ) : void
FireSIPRequestInTraceEvent ( SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, SIPRequest sipRequest ) : void
FireSIPRequestOutTraceEvent ( SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, SIPRequest sipRequest ) : void
FireSIPResponseInTraceEvent ( SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, SIPResponse sipResponse ) : void
FireSIPResponseOutTraceEvent ( SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, SIPResponse sipResponse ) : void
GetDefaultChannel ( SIPProtocolsEnum protocol ) : SIPChannel

Returns the first SIPChannel found for the requested protocol.

ProcessInMessage ( ) : void
ProcessPendingReliableTransactions ( ) : void
SIPMessageReceived ( SIPChannel sipChannel, SIPEndPoint remoteEndPoint, byte buffer ) : void
SendRequest ( SIPChannel sipChannel, SIPEndPoint dstEndPoint, SIPRequest sipRequest ) : void
SendResponse ( SIPChannel sipChannel, SIPEndPoint dstEndPoint, SIPResponse sipResponse ) : void
SendResponse ( SIPChannel sipChannel, SIPResponse sipResponse ) : void
StartReliableTransmissionsThread ( ) : void
StartTransportThread ( ) : void

Method Details

AddSIPChannel() public method

Adds additional SIP Channels to the transport layer.
public AddSIPChannel ( List sipChannels ) : void
sipChannels List
return void

AddSIPChannel() public method

Adds an additional SIP Channel to the transport layer.
public AddSIPChannel ( SIPChannel sipChannel ) : void
sipChannel SIPChannel
return void

CreateCancelTransaction() public method

public CreateCancelTransaction ( SIPRequest sipRequest, SIPEndPoint dstEndPoint, SIPEndPoint localSIPEndPoint, UASInviteTransaction inviteTransaction ) : SIPCancelTransaction
sipRequest SIPRequest
dstEndPoint SIPEndPoint
localSIPEndPoint SIPEndPoint
inviteTransaction UASInviteTransaction
return SIPCancelTransaction

CreateNonInviteTransaction() public method

public CreateNonInviteTransaction ( SIPRequest sipRequest, SIPEndPoint dstEndPoint, SIPEndPoint localSIPEndPoint, SIPEndPoint outboundProxy ) : SIPNonInviteTransaction
sipRequest SIPRequest
dstEndPoint SIPEndPoint
localSIPEndPoint SIPEndPoint
outboundProxy SIPEndPoint
return SIPNonInviteTransaction

CreateUACTransaction() public method

public CreateUACTransaction ( SIPRequest sipRequest, SIPEndPoint dstEndPoint, SIPEndPoint localSIPEndPoint, SIPEndPoint outboundProxy, bool sendOkAckManually = false ) : UACInviteTransaction
sipRequest SIPRequest
dstEndPoint SIPEndPoint
localSIPEndPoint SIPEndPoint
outboundProxy SIPEndPoint
sendOkAckManually bool
return UACInviteTransaction

CreateUASTransaction() public method

public CreateUASTransaction ( SIPRequest sipRequest, SIPEndPoint dstEndPoint, SIPEndPoint localSIPEndPoint, SIPEndPoint outboundProxy, bool noCDR = false ) : UASInviteTransaction
sipRequest SIPRequest
dstEndPoint SIPEndPoint
localSIPEndPoint SIPEndPoint
outboundProxy SIPEndPoint
noCDR bool
return UASInviteTransaction

DoesTransactionExist() public method

public DoesTransactionExist ( SIPRequest sipRequest ) : bool
sipRequest SIPRequest
return bool

FindSIPChannel() public method

Attempts to match a SIPChannel for this process that has the specified local end point and protocol.
public FindSIPChannel ( SIPEndPoint localSIPEndPoint ) : SIPChannel
localSIPEndPoint SIPEndPoint
return SIPChannel

GetDefaultSIPEndPoint() public method

public GetDefaultSIPEndPoint ( ) : SIPEndPoint
return SIPEndPoint

GetDefaultSIPEndPoint() public method

public GetDefaultSIPEndPoint ( SIPEndPoint destinationEP ) : SIPEndPoint
destinationEP SIPEndPoint
return SIPEndPoint

GetDefaultSIPEndPoint() public method

public GetDefaultSIPEndPoint ( SIPProtocolsEnum protocol ) : SIPEndPoint
protocol SIPProtocolsEnum
return SIPEndPoint

GetDefaultTransportContact() public method

public GetDefaultTransportContact ( SIPProtocolsEnum protocol ) : SIPEndPoint
protocol SIPProtocolsEnum
return SIPEndPoint

GetHostEndPoint() public method

public GetHostEndPoint ( string host, bool async ) : SIPDNSLookupResult
host string
async bool
return SIPDNSLookupResult

GetListeningSIPEndPoints() public method

public GetListeningSIPEndPoints ( ) : List
return List

GetRequest() public method

public GetRequest ( SIPMethodsEnum method, SIPURI uri ) : SIPRequest
method SIPMethodsEnum
uri SIPURI
return SIPRequest

GetRequest() public method

public GetRequest ( SIPMethodsEnum method, SIPURI uri, SIPToHeader to, SIPEndPoint localSIPEndPoint ) : SIPRequest
method SIPMethodsEnum
uri SIPURI
to SIPToHeader
localSIPEndPoint SIPEndPoint
return SIPRequest

GetRequestEndPoint() public method

Based on the information in the SIP request attempts to determine the end point the request should be sent to.
public GetRequestEndPoint ( SIPRequest sipRequest, SIPEndPoint outboundProxy, bool async ) : SIPDNSLookupResult
sipRequest SIPRequest
outboundProxy SIPEndPoint
async bool
return SIPDNSLookupResult

GetResponse() public method

Used to create a SIP response when it was not possible to parse the incoming SIP request.
public GetResponse ( SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, SIPResponseStatusCodesEnum responseCode, string reasonPhrase ) : SIPResponse
localSIPEndPoint SIPEndPoint
remoteEndPoint SIPEndPoint
responseCode SIPResponseStatusCodesEnum
reasonPhrase string
return SIPResponse

GetResponse() public static method

public static GetResponse ( SIPRequest sipRequest, SIPResponseStatusCodesEnum responseCode, string reasonPhrase ) : SIPResponse
sipRequest SIPRequest
responseCode SIPResponseStatusCodesEnum
reasonPhrase string
return SIPResponse

GetTransaction() public method

public GetTransaction ( SIPRequest sipRequest ) : SIPTransaction
sipRequest SIPRequest
return SIPTransaction

GetTransaction() public method

public GetTransaction ( string transactionId ) : SIPTransaction
transactionId string
return SIPTransaction

GetURIEndPoint() public method

public GetURIEndPoint ( SIPURI uri, bool async ) : SIPDNSLookupResult
uri SIPURI
async bool
return SIPDNSLookupResult

IsLocalSIPEndPoint() public method

public IsLocalSIPEndPoint ( SIPEndPoint sipEndPoint ) : bool
sipEndPoint SIPEndPoint
return bool

PreProcessRouteInfo() public method

This function performs processing on a request to handle any actions that need to be taken based on the Route header.
The main sections in the RFC3261 dealing with Route header processing are sections 12.2.1.1 for request processing and 16.4 for proxy processing. The steps to process requests for Route headers are: 1. If route set is empty no further action is required, forward to destination resolved from request URI, 2. If the request URI is identified as a value that was previously set as a Route by this SIP agent it means the previous hop was a strict router. Replace the reqest URI with the last Route header and go to next step, 3. If the top most route header was set by this SIP agent then remove it and go to next step, 4. If the top most route set does contain the lr parameter then forward to the destination resolved by it, 5. If the top most route header does NOT contain the lr parameter is must be popped and inserted as the request URI and the original request URI must be added to the end of the route set, forward to destination resolved from request URI,
public PreProcessRouteInfo ( SIPRequest sipRequest ) : void
sipRequest SIPRequest
return void

ReceiveMessage() public method

public ReceiveMessage ( SIPChannel sipChannel, SIPEndPoint remoteEndPoint, byte buffer ) : void
sipChannel SIPChannel
remoteEndPoint SIPEndPoint
buffer byte
return void

RemoveSIPChannel() public method

public RemoveSIPChannel ( SIPChannel sipChannel ) : void
sipChannel SIPChannel
return void

SIPTransport() public method

public SIPTransport ( ResolveSIPEndPointDelegate sipResolver, SIPTransactionEngine transactionEngine ) : NUnit.Framework
sipResolver ResolveSIPEndPointDelegate
transactionEngine SIPTransactionEngine
return NUnit.Framework

SIPTransport() public method

public SIPTransport ( ResolveSIPEndPointDelegate sipResolver, SIPTransactionEngine transactionEngine, SIPChannel sipChannel, bool queueIncoming ) : NUnit.Framework
sipResolver ResolveSIPEndPointDelegate
transactionEngine SIPTransactionEngine
sipChannel SIPChannel
queueIncoming bool
return NUnit.Framework

SIPTransport() public method

public SIPTransport ( ResolveSIPEndPointDelegate sipResolver, SIPTransactionEngine transactionEngine, bool queueIncoming ) : NUnit.Framework
sipResolver ResolveSIPEndPointDelegate
transactionEngine SIPTransactionEngine
queueIncoming bool
return NUnit.Framework

SendRaw() public method

Allows raw bytes to be sent from one of the SIPTransport sockets. This should not be used for SIP payloads and instead is provided to allow other types of payloads to be multi-plexed on the SIP socket. Examples are sending NAT keep alives and STUN responses where it's useful to use the same socket as the SIP packets.
public SendRaw ( SIPEndPoint localSIPEndPoint, SIPEndPoint destinationEndPoint, byte buffer ) : void
localSIPEndPoint SIPEndPoint
destinationEndPoint SIPEndPoint
buffer byte
return void

SendRequest() public method

public SendRequest ( SIPEndPoint dstEndPoint, SIPRequest sipRequest ) : void
dstEndPoint SIPEndPoint
sipRequest SIPRequest
return void

SendRequest() public method

public SendRequest ( SIPRequest sipRequest ) : void
sipRequest SIPRequest
return void

SendResponse() public method

public SendResponse ( SIPEndPoint dstEndPoint, SIPResponse sipResponse ) : void
dstEndPoint SIPEndPoint
sipResponse SIPResponse
return void

SendResponse() public method

public SendResponse ( SIPResponse sipResponse ) : void
sipResponse SIPResponse
return void

SendSIPReliable() public method

Sends a SIP request/response and keeps track of whether a response/acknowledgement has been received. If no response is received then periodic retransmits are made for up to T1 x 64 seconds.
public SendSIPReliable ( SIPTransaction sipTransaction ) : void
sipTransaction SIPTransaction
return void

Shutdown() public method

public Shutdown ( ) : void
return void

Property Details

BlackholeAddress public static property

public static IPAddress,System.Net BlackholeAddress
return System.Net.IPAddress

ContactIPAddress public property

public IPAddress,System.Net ContactIPAddress
return System.Net.IPAddress

PerformanceMonitorPrefix public property

public string PerformanceMonitorPrefix
return string