SIPSorcery.SIP.SIPTransport.SendResponse C# (CSharp) Method

SendResponse() private method

private SendResponse ( SIPChannel sipChannel, SIPEndPoint dstEndPoint, SIPResponse sipResponse ) : void
sipChannel SIPChannel
dstEndPoint SIPEndPoint
sipResponse SIPResponse
return void
        private void SendResponse(SIPChannel sipChannel, SIPEndPoint dstEndPoint, SIPResponse sipResponse)
        {
            try
            {
                if (dstEndPoint != null && dstEndPoint.Address.Equals(BlackholeAddress))
                {
                    // Ignore packet, it's destined for the blackhole.
                    return;
                }

                if (m_sipChannels.Count == 0)
                {
                    throw new ApplicationException("No channels are configured in the SIP transport layer. The response could not be sent.");
                }

                sipResponse.Header.ContentLength = (sipResponse.Body.NotNullOrBlank()) ? Encoding.UTF8.GetByteCount(sipResponse.Body) : 0;
                sipChannel.Send(dstEndPoint.GetIPEndPoint(), Encoding.UTF8.GetBytes(sipResponse.ToString()));

                if (SIPRequestOutTraceEvent != null)
                {
                    FireSIPResponseOutTraceEvent(sipChannel.SIPChannelEndPoint, dstEndPoint, sipResponse);
                }
            }
            catch (ApplicationException appExcp)
            {
                logger.Warn("ApplicationException SIPTransport SendResponse. " + appExcp.Message);
            }
        }

Same methods

SIPTransport::SendResponse ( SIPChannel sipChannel, SIPResponse sipResponse ) : void
SIPTransport::SendResponse ( SIPEndPoint dstEndPoint, SIPResponse sipResponse ) : void
SIPTransport::SendResponse ( SIPResponse sipResponse ) : void