Exemple #1
0
        /// <summary>
        /// Creates new call ID value.
        /// </summary>
        /// <returns>Returns call ID value.</returns>
        public static SIP_t_CallID CreateCallID()
        {
            SIP_t_CallID callID = new SIP_t_CallID();

            callID.CallID = Guid.NewGuid().ToString().Replace("-", "");

            return(callID);
        }
Exemple #2
0
        /// <summary>
        /// Parses "Join" from specified reader.
        /// </summary>
        /// <param name="reader">Reader from where to parse.</param>
        /// <exception cref="ArgumentNullException">Raised when <b>reader</b> is null.</exception>
        /// <exception cref="SIP_ParseException">Raised when invalid SIP message.</exception>
        public override void Parse(StringReader reader)
        {
            /*
             *  Join       = callid *(SEMI join-param)
             *  join-param = to-tag / from-tag / generic-param
             *  to-tag     = "to-tag" EQUAL token
             *  from-tag   = "from-tag" EQUAL token
             *
             *  A Join header MUST contain exactly one to-tag and exactly one from-
             *  tag, as they are required for unique dialog matching.
             */

            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            // Parse address
            SIP_t_CallID callID = new SIP_t_CallID();

            callID.Parse(reader);
            m_pCallID = callID;

            // Parse parameters
            ParseParameters(reader);

            // Check that to and from tags exist.
            if (this.Parameters["to-tag"] == null)
            {
                throw new SIP_ParseException("Join value mandatory to-tag value is missing !");
            }
            if (this.Parameters["from-tag"] == null)
            {
                throw new SIP_ParseException("Join value mandatory from-tag value is missing !");
            }
        }