C# Class SIPSorcery.Servers.SIPProxyScriptFacade

Show file Open project: sipsorcery/sipsorcery Class Usage Examples

Public Methods

Method Description
DispatcherLookup ( SIPRequest sipRequest ) : SIPEndPoint
DispatcherLookup ( SIPResponse sipResponse ) : SIPEndPoint
GetAppServer ( ) : SIPEndPoint
GetDefaultSIPEndPoint ( SIPProtocolsEnum protocol ) : SIPEndPoint
Log ( string message ) : void
Resolve ( SIPRequest sipRequest ) : SIPDNSLookupResult
Resolve ( SIPURI sipURI ) : SIPDNSLookupResult
Resolve ( SIPResponse sipResponse ) : SIPEndPoint
Respond ( SIPRequest sipRequest, SIPResponseStatusCodesEnum responseCode, string reasonPhrase ) : void

Helper method for dynamic proxy runtime script.

SIPProxyScriptFacade ( SIPMonitorLogDelegate proxyLogger, SIPTransport sipTransport, SIPProxyDispatcher dispatcher, GetAppServerDelegate getAppServer ) : NUnit.Framework
SendExternal ( SIPEndPoint receivedOnEP, SIPEndPoint dstSIPEndPoint, SIPRequest sipRequest, string proxyBranch, IPAddress publicIPAddress ) : void

Used to send a request from an internal server agent to an external SIP user agent. The difference between this method and the SendTransparent method is that this one will set Via headers in accordance with RFC3261.

SendExternal ( SIPResponse sipResponse, SIPEndPoint localSIPEndPoint ) : void
SendExternal ( SIPResponse sipResponse, SIPEndPoint localSIPEndPoint, IPAddress publicIPAddress ) : void
SendInternal ( SIPEndPoint receivedFromEP, SIPEndPoint receivedOnEP, SIPResponse sipResponse, SIPEndPoint localSIPEndPoint ) : void
SendInternal ( SIPEndPoint receivedFromEP, SIPEndPoint receivedOnEP, string dstSocket, SIPRequest sipRequest, string proxyBranch, string sendFromSocket ) : void

Used to send a SIP request received from an external user agent to an internal SIP server agent.

SendTransparent ( SIPEndPoint receivedFromEP, SIPEndPoint receivedOnEP, SIPResponse sipResponse, SIPEndPoint localSIPEndPoint, SIPEndPoint dstSIPEndPoint, string proxyBranch ) : void

This method is the equivalent to the same named method for sending SIP requests. The two methods are used to allow the Proxy to deliver requests to external SIP agents with only a SINGLE Via header due to a small number of providers rejecting requests with more than one Via header.

SendTransparent ( SIPEndPoint receivedFromEP, SIPEndPoint receivedOnEP, SIPResponse sipResponse, SIPEndPoint localSIPEndPoint, string dstSIPEndPoint, string proxyBranch ) : void
SendTransparent ( SIPEndPoint dstSIPEndPoint, SIPRequest sipRequest, IPAddress publicIPAddress ) : void

Forwards a SIP request through the Proxy. This method differs from the standard Send in that irrespective of whether the Proxy is receiving and sending on different sockets only a single Via header will ever be allowed on the request. It is then up to the response processing logic to determine from which Proxy socket to forward the request and to add back on the Via header for the end agent. This method is only ever used for requests destined for EXTERNAL SIP end points.

Private Methods

Method Description
AdjustContactHeader ( SIPHeader sipHeader, SIPEndPoint localSIPEndPoint, IPAddress publicIPAddress ) : void
IsDestinationValid ( SIPRequest sipRequest, SIPEndPoint dstSIPEndPoint ) : bool
IsDestinationValid ( SIPRequest sipRequest, string dstSIPEndPoint ) : bool

Method Details

DispatcherLookup() public method

public DispatcherLookup ( SIPRequest sipRequest ) : SIPEndPoint
sipRequest SIPSorcery.SIP.SIPRequest
return SIPSorcery.SIP.SIPEndPoint

DispatcherLookup() public method

public DispatcherLookup ( SIPResponse sipResponse ) : SIPEndPoint
sipResponse SIPSorcery.SIP.SIPResponse
return SIPSorcery.SIP.SIPEndPoint

GetAppServer() public method

public GetAppServer ( ) : SIPEndPoint
return SIPSorcery.SIP.SIPEndPoint

GetDefaultSIPEndPoint() public method

public GetDefaultSIPEndPoint ( SIPProtocolsEnum protocol ) : SIPEndPoint
protocol SIPProtocolsEnum
return SIPSorcery.SIP.SIPEndPoint

Log() public method

public Log ( string message ) : void
message string
return void

Resolve() public method

public Resolve ( SIPRequest sipRequest ) : SIPDNSLookupResult
sipRequest SIPSorcery.SIP.SIPRequest
return SIPDNSLookupResult

Resolve() public method

public Resolve ( SIPURI sipURI ) : SIPDNSLookupResult
sipURI SIPSorcery.SIP.SIPURI
return SIPDNSLookupResult

Resolve() public method

public Resolve ( SIPResponse sipResponse ) : SIPEndPoint
sipResponse SIPSorcery.SIP.SIPResponse
return SIPSorcery.SIP.SIPEndPoint

Respond() public method

Helper method for dynamic proxy runtime script.
public Respond ( SIPRequest sipRequest, SIPResponseStatusCodesEnum responseCode, string reasonPhrase ) : void
sipRequest SIPSorcery.SIP.SIPRequest
responseCode SIPResponseStatusCodesEnum
reasonPhrase string
return void

SIPProxyScriptFacade() public method

public SIPProxyScriptFacade ( SIPMonitorLogDelegate proxyLogger, SIPTransport sipTransport, SIPProxyDispatcher dispatcher, GetAppServerDelegate getAppServer ) : NUnit.Framework
proxyLogger SIPMonitorLogDelegate
sipTransport SIPSorcery.SIP.SIPTransport
dispatcher SIPProxyDispatcher
getAppServer GetAppServerDelegate
return NUnit.Framework

SendExternal() public method

Used to send a request from an internal server agent to an external SIP user agent. The difference between this method and the SendTransparent method is that this one will set Via headers in accordance with RFC3261.
public SendExternal ( SIPEndPoint receivedOnEP, SIPEndPoint dstSIPEndPoint, SIPRequest sipRequest, string proxyBranch, IPAddress publicIPAddress ) : void
receivedOnEP SIPSorcery.SIP.SIPEndPoint The proxy SIP end point the request was received on.
dstSIPEndPoint SIPSorcery.SIP.SIPEndPoint
sipRequest SIPSorcery.SIP.SIPRequest The SIP request to send.
proxyBranch string The branch parameter for the top Via header that has been pre-calculated by the proxy core.
publicIPAddress System.Net.IPAddress
return void

SendExternal() public method

public SendExternal ( SIPResponse sipResponse, SIPEndPoint localSIPEndPoint ) : void
sipResponse SIPSorcery.SIP.SIPResponse
localSIPEndPoint SIPSorcery.SIP.SIPEndPoint
return void

SendExternal() public method

public SendExternal ( SIPResponse sipResponse, SIPEndPoint localSIPEndPoint, IPAddress publicIPAddress ) : void
sipResponse SIPSorcery.SIP.SIPResponse
localSIPEndPoint SIPSorcery.SIP.SIPEndPoint
publicIPAddress System.Net.IPAddress
return void

SendInternal() public method

public SendInternal ( SIPEndPoint receivedFromEP, SIPEndPoint receivedOnEP, SIPResponse sipResponse, SIPEndPoint localSIPEndPoint ) : void
receivedFromEP SIPSorcery.SIP.SIPEndPoint
receivedOnEP SIPSorcery.SIP.SIPEndPoint
sipResponse SIPSorcery.SIP.SIPResponse
localSIPEndPoint SIPSorcery.SIP.SIPEndPoint
return void

SendInternal() public method

Used to send a SIP request received from an external user agent to an internal SIP server agent.
public SendInternal ( SIPEndPoint receivedFromEP, SIPEndPoint receivedOnEP, string dstSocket, SIPRequest sipRequest, string proxyBranch, string sendFromSocket ) : void
receivedFromEP SIPSorcery.SIP.SIPEndPoint The SIP end point the proxy received the request from.
receivedOnEP SIPSorcery.SIP.SIPEndPoint The SIP end point the proxy received the request on.
dstSocket string The internal socket to send the request to.
sipRequest SIPSorcery.SIP.SIPRequest The SIP request to send.
proxyBranch string The branch to set on the Via header when sending the request. The branch should be calculated /// by the proxy core so that looped requests can be detected.
sendFromSocket string The proxy socket to send the request from.
return void

SendTransparent() public method

This method is the equivalent to the same named method for sending SIP requests. The two methods are used to allow the Proxy to deliver requests to external SIP agents with only a SINGLE Via header due to a small number of providers rejecting requests with more than one Via header.
public SendTransparent ( SIPEndPoint receivedFromEP, SIPEndPoint receivedOnEP, SIPResponse sipResponse, SIPEndPoint localSIPEndPoint, SIPEndPoint dstSIPEndPoint, string proxyBranch ) : void
receivedFromEP SIPSorcery.SIP.SIPEndPoint The socket the response was received from.
receivedOnEP SIPSorcery.SIP.SIPEndPoint The proxy socket the response was received on.
sipResponse SIPSorcery.SIP.SIPResponse The response being forwarded.
localSIPEndPoint SIPSorcery.SIP.SIPEndPoint The proxy socket to forward the request from.
dstSIPEndPoint SIPSorcery.SIP.SIPEndPoint The internal destination socket to forward the response to.
proxyBranch string The branch parameter from the top Via header that needs to be reused when forwarding the response.
return void

SendTransparent() public method

public SendTransparent ( SIPEndPoint receivedFromEP, SIPEndPoint receivedOnEP, SIPResponse sipResponse, SIPEndPoint localSIPEndPoint, string dstSIPEndPoint, string proxyBranch ) : void
receivedFromEP SIPSorcery.SIP.SIPEndPoint
receivedOnEP SIPSorcery.SIP.SIPEndPoint
sipResponse SIPSorcery.SIP.SIPResponse
localSIPEndPoint SIPSorcery.SIP.SIPEndPoint
dstSIPEndPoint string
proxyBranch string
return void

SendTransparent() public method

Forwards a SIP request through the Proxy. This method differs from the standard Send in that irrespective of whether the Proxy is receiving and sending on different sockets only a single Via header will ever be allowed on the request. It is then up to the response processing logic to determine from which Proxy socket to forward the request and to add back on the Via header for the end agent. This method is only ever used for requests destined for EXTERNAL SIP end points.
public SendTransparent ( SIPEndPoint dstSIPEndPoint, SIPRequest sipRequest, IPAddress publicIPAddress ) : void
dstSIPEndPoint SIPSorcery.SIP.SIPEndPoint The destination SIP socket to send the request to.
sipRequest SIPSorcery.SIP.SIPRequest The SIP request to send.
publicIPAddress System.Net.IPAddress
return void