SIPSorcery.SIP.SIPRequest.IsLoop C# (CSharp) Method

IsLoop() public method

Determines if this SIP header is a looped header. The basis for the decision is the branchid in the Via header. If the branchid for a new header computes to the same branchid as a Via header already in the SIP header then it is considered a loop.
public IsLoop ( string ipAddress, int port, string currentBranchId ) : bool
ipAddress string
port int
currentBranchId string
return bool
        public bool IsLoop(string ipAddress, int port, string currentBranchId)
        {
            foreach(SIPViaHeader viaHeader in Header.Vias.Via)
            {
                if(viaHeader.Host == ipAddress && viaHeader.Port == port)
                {
                    if(viaHeader.Branch == currentBranchId)
                    {
                        return true;
                    }
                }
            }

            return false;
        }