SIPSorcery.SIP.SIPURI.ToParameterlessString C# (CSharp) Method

ToParameterlessString() public method

Returns a string representation of the URI with any parameter and headers ommitted except for the transport parameter. The string returned by this function is used amonst other things to match Route headers set by this SIP agent.
public ToParameterlessString ( ) : string
return string
        public string ToParameterlessString()
        {
            try
            {
                string uriStr = Scheme.ToString() + SCHEME_ADDR_SEPARATOR;

                uriStr = (User != null) ? uriStr + User + USER_HOST_SEPARATOR + Host : uriStr + Host;

                // If the URI's protocol is not implied already set the transport parameter.
                if (Scheme != SIPSchemesEnum.sips && Protocol != SIPProtocolsEnum.udp && !Parameters.Has(m_uriParamTransportKey))
                {
                    uriStr += PARAM_TAG_DELIMITER + m_uriParamTransportKey + TAG_NAME_VALUE_SEPERATOR + Protocol.ToString();
                }

                return uriStr;
            }
            catch (Exception excp)
            {
                logger.Error("Exception SIPURI ToParamaterlessString. " + excp.Message);
                throw excp;
            }
        }

Usage Example

Example #1
0
        public string ToParameterlessString()
        {
            try
            {
                string userFieldStr = null;

                if (Name != null)
                {
                    userFieldStr = "\"" + Name + "\" ";
                }

                userFieldStr += "<" + URI.ToParameterlessString() + ">";

                return(userFieldStr);
            }
            catch (Exception excp)
            {
                logger.LogError("Exception SIPUserField ToParameterlessString. " + excp.Message);
                throw;
            }
        }