Пример #1
0
 public SIPClientUserAgent(
     SIPTransport sipTransport,
     SIPEndPoint outboundProxy)
 {
     m_sipTransport  = sipTransport;
     m_outboundProxy = outboundProxy?.CopyOf();
 }
        private void AdjustContactHeader(SIPHeader sipHeader, SIPEndPoint localSIPEndPoint, IPAddress publicIPAddress)
        {
            try
            {
                // Set the Contact URI on the outgoing requests depending on which SIP socket the request is being sent on and whether
                // the request is going to an external network.
                if (sipHeader.Contact != null && sipHeader.Contact.Count == 1)
                {
                    SIPEndPoint proxyContact = localSIPEndPoint.CopyOf();
                    if (publicIPAddress != null)
                    {
                        proxyContact = new SIPEndPoint(proxyContact.Protocol, publicIPAddress, proxyContact.Port);
                    }

                    sipHeader.Contact[0].ContactURI.Host     = proxyContact.GetIPEndPoint().ToString();
                    sipHeader.Contact[0].ContactURI.Protocol = proxyContact.Protocol;
                }
            }
            catch (Exception excp)
            {
                logger.Error("Exception AdjustContactHeader. " + excp.Message);
                throw;
            }
        }