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

GetDefaultChannel() private method

Returns the first SIPChannel found for the requested protocol.
private GetDefaultChannel ( SIPProtocolsEnum protocol ) : SIPChannel
protocol SIPProtocolsEnum
return SIPChannel
        private SIPChannel GetDefaultChannel(SIPProtocolsEnum protocol)
        {
            // Channels that are not on a loopback address take priority.
            foreach (SIPChannel sipChannel in m_sipChannels.Values)
            {
                if (sipChannel.SIPChannelEndPoint.Protocol == protocol && !IPAddress.IsLoopback(sipChannel.SIPChannelEndPoint.Address))
                {
                    return sipChannel;
                }
            }
            foreach (SIPChannel sipChannel in m_sipChannels.Values)
            {
                if (sipChannel.SIPChannelEndPoint.Protocol == protocol)
                {
                    return sipChannel;
                }
            }

            logger.Warn("No default SIP channel could be found for " + protocol + ".");
            return null;
        }