CopyOf() public method

public CopyOf ( ) : SIPEndPoint
return SIPEndPoint
Exemplo n.º 1
0
        public SIPDialogue(
            string callId,
            SIPRouteSet routeSet,
            SIPUserField localUser,
            SIPUserField remoteUser,
            int cseq,
            SIPURI remoteTarget,
            string localTag,
            string remoteTag,
            Guid cdrId,
            string sdp,
            string remoteSDP,
            SIPEndPoint remoteEndPoint)
        {
            Id = Guid.NewGuid();

            CallId            = callId;
            RouteSet          = routeSet;
            LocalUserField    = localUser;
            LocalTag          = localTag;
            RemoteUserField   = remoteUser;
            RemoteTag         = remoteTag;
            CSeq              = cseq;
            RemoteTarget      = remoteTarget;
            CDRId             = cdrId;
            SDP               = sdp;
            RemoteSDP         = remoteSDP;
            Inserted          = DateTime.UtcNow;
            Direction         = SIPCallDirection.None;
            RemoteSIPEndPoint = remoteEndPoint?.CopyOf();
        }
Exemplo n.º 2
0
        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;
            }
        }