Esempio n. 1
0
        //
        //
        // Retrieve the SessionState associated with a dialog.
        //
        //
        internal SessionState GetSessionState(Microsoft.Rtc.Sip.Message Msg)
        {
            string CallId = GetHeaderValue(Msg, "Call-Id");

            if (SessionStateTable.ContainsKey(CallId))
            {
                //
                // Return saved session state
                //
                return((SessionState)SessionStateTable[CallId]);
            }
            else
            {
                //
                // No state exists -- default state is Unknown
                //
                return(SessionState.Unknown);
            }
        }
Esempio n. 2
0
        //
        //
        // Retrieve the value of the first instance of a message header.
        //
        //
        internal string GetHeaderValue(Microsoft.Rtc.Sip.Message Msg, string Hdr)
        {
            IEnumerator walker = Msg.GetHeaders(Hdr);

            walker.MoveNext();
            if (walker.Current != null)
            {
                //
                // Return first header
                //
                return(((Header)walker.Current).Value);
            }
            else
            {
                //
                // No headers found
                //
                throw new InvalidOperationException("Message doesn't contain a " + Hdr + " header");
            }
        }