Inheritance: SIPChannel
        public static List <SIPChannel> ParseSIPChannelsNode(XmlNode sipChannelsNode, int port = 0)
        {
            var sipChannels = new List <SIPChannel>();

            foreach (XmlNode sipSocketNode in sipChannelsNode.ChildNodes)
            {
                logger.Debug("Creating SIP Channel for " + sipSocketNode.OuterXml + ".");

                var localSocket = sipSocketNode.InnerText;

                var protocol = SIPProtocolsEnum.udp;
                if (sipSocketNode.Attributes.GetNamedItem(SIP_PROTOCOL_PARAMETER) != null)
                {
                    protocol = SIPProtocolsType.GetProtocolType(sipSocketNode.Attributes.GetNamedItem(SIP_PROTOCOL_PARAMETER).Value);
                }

                var nodeSIPEndPoints = GetSIPEndPoints(localSocket, protocol, port);

                foreach (var sipEndPoint in nodeSIPEndPoints)
                {
                    try
                    {
                        switch (protocol)
                        {
                        case SIPProtocolsEnum.udp:
                        {
                            logger.Debug(" attempting to create SIP UDP channel for " + sipEndPoint.GetIPEndPoint() + ".");
                            var udpChannel = new SIPUDPChannel(sipEndPoint.GetIPEndPoint());
                            sipChannels.Add(udpChannel);
                        }
                        break;

                        case SIPProtocolsEnum.tcp:
                        {
                            logger.Debug(" attempting to create SIP TCP channel for " + sipEndPoint.GetIPEndPoint() + ".");

                            var tcpChannel = new SIPTCPChannel(sipEndPoint.GetIPEndPoint());
                            sipChannels.Add(tcpChannel);
                        }
                        break;

                        case SIPProtocolsEnum.tls:
                            if (sipSocketNode.Attributes.GetNamedItem(CERTIFICATE_PATH_PARAMETER) == null)
                            {
                                logger.Warn("Could not create SIPTLSChannel from XML configuration node as no " + CERTIFICATE_PATH_PARAMETER + " attribute was present.");
                            }
                            else
                            {
                                var certificateType = "machinestore";
                                if (sipSocketNode.Attributes.GetNamedItem(CERTIFICATE_TYPE_PARAMETER) != null)
                                {
                                    certificateType = sipSocketNode.Attributes.GetNamedItem(CERTIFICATE_TYPE_PARAMETER).Value;
                                }

                                var certificatePath        = (sipSocketNode.Attributes.GetNamedItem(CERTIFICATE_PATH_PARAMETER) != null) ? sipSocketNode.Attributes.GetNamedItem(CERTIFICATE_PATH_PARAMETER).Value : null;
                                var certificateKeyPassword = (sipSocketNode.Attributes.GetNamedItem(CERTIFICATE_KEY_PASSWORD_PARAMETER) != null) ? sipSocketNode.Attributes.GetNamedItem(CERTIFICATE_KEY_PASSWORD_PARAMETER).Value : String.Empty;
                                logger.Debug(" attempting to create SIP TLS channel for " + sipEndPoint.GetIPEndPoint() + " and certificate type of " + certificateType + " at " + certificatePath + ".");
                                var certificate = LoadCertificate(certificateType, certificatePath, certificateKeyPassword);
                                if (certificate != null)
                                {
                                    var tlsChannel = new SIPTLSChannel(certificate, sipEndPoint.GetIPEndPoint());
                                    sipChannels.Add(tlsChannel);
                                }
                                else
                                {
                                    logger.Warn("A SIP TLS channel was not created because the certificate could not be loaded.");
                                }
                            }
                            break;

                        default:
                            logger.Warn("Could not create a SIP channel for protocol " + protocol + ".");
                            break;
                        }
                    }
                    catch (Exception excp)
                    {
                        logger.Warn("Exception SIPTransportConfig Adding SIP Channel for " + sipEndPoint + ". " + excp.Message);
                    }
                }
            }

            return(sipChannels);
        }
        public static List<SIPChannel> ParseSIPChannelsNode(XmlNode sipChannelsNode)
        {
            List<SIPChannel> sipChannels = new List<SIPChannel>();

            foreach (XmlNode sipSocketNode in sipChannelsNode.ChildNodes)
            {
                logger.Debug("Creating SIP Channel for " + sipSocketNode.OuterXml + ".");

                string localSocket = sipSocketNode.InnerText;

                SIPProtocolsEnum protocol = SIPProtocolsEnum.udp;
                if (sipSocketNode.Attributes.GetNamedItem(SIP_PROTOCOL_PARAMETER) != null)
                {
                    protocol = SIPProtocolsType.GetProtocolType(sipSocketNode.Attributes.GetNamedItem(SIP_PROTOCOL_PARAMETER).Value);
                }

                List<SIPEndPoint> nodeSIPEndPoints = GetSIPEndPoints(localSocket, protocol);

                foreach (SIPEndPoint sipEndPoint in nodeSIPEndPoints)
                {
                    try
                    {
                        if (protocol == SIPProtocolsEnum.udp)
                        {
                            logger.Debug(" attempting to create SIP UDP channel for " + sipEndPoint.GetIPEndPoint() + ".");
                            SIPUDPChannel udpChannel = new SIPUDPChannel(sipEndPoint.GetIPEndPoint());
                            sipChannels.Add(udpChannel);
                        }
                        else if (protocol == SIPProtocolsEnum.tcp)
                        {
                            logger.Debug(" attempting to create SIP TCP channel for " + sipEndPoint.GetIPEndPoint() + ".");

                            SIPTCPChannel tcpChannel = new SIPTCPChannel(sipEndPoint.GetIPEndPoint());
                            sipChannels.Add(tcpChannel);
                        }
                        else if (protocol == SIPProtocolsEnum.tls)
                        {
                            if (sipSocketNode.Attributes.GetNamedItem(CERTIFICATE_PATH_PARAMETER) == null)
                            {
                                logger.Warn("Could not create SIPTLSChannel from XML configuration node as no " + CERTIFICATE_PATH_PARAMETER + " attribute was present.");
                            }
                            else
                            {
                                string certificateType = "machinestore";
                                if (sipSocketNode.Attributes.GetNamedItem(CERTIFICATE_TYPE_PARAMETER) != null)
                                {
                                    certificateType = sipSocketNode.Attributes.GetNamedItem(CERTIFICATE_TYPE_PARAMETER).Value;
                                }

                                string certificatePath = (sipSocketNode.Attributes.GetNamedItem(CERTIFICATE_PATH_PARAMETER) != null) ? sipSocketNode.Attributes.GetNamedItem(CERTIFICATE_PATH_PARAMETER).Value : null;
                                string certificateKeyPassword = (sipSocketNode.Attributes.GetNamedItem(CERTIFICATE_KEY_PASSWORD_PARAMETER) != null) ? sipSocketNode.Attributes.GetNamedItem(CERTIFICATE_KEY_PASSWORD_PARAMETER).Value : String.Empty;
                                logger.Debug(" attempting to create SIP TLS channel for " + sipEndPoint.GetIPEndPoint() + " and certificate type of " + certificateType + " at " + certificatePath + ".");
                                X509Certificate2 certificate = LoadCertificate(certificateType, certificatePath, certificateKeyPassword);
                                if (certificate != null)
                                {
                                    SIPTLSChannel tlsChannel = new SIPTLSChannel(certificate, sipEndPoint.GetIPEndPoint());
                                    sipChannels.Add(tlsChannel);
                                }
                                else
                                {
                                    logger.Warn("A SIP TLS channel was not created because the certificate could not be loaded.");
                                }
                            }
                        }
                        else
                        {
                            logger.Warn("Could not create a SIP channel for protocol " + protocol + ".");
                        }
                    }
                    catch (Exception excp)
                    {
                        logger.Warn("Exception SIPTransportConfig Adding SIP Channel for " + sipEndPoint.ToString() + ". " + excp.Message);
                    }
                }
            }

            return sipChannels;
        }