/// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="owner">Owner message that owns this group.</param>
        /// <param name="fieldName">Header field name what group holds.</param>
        public SIP_MVGroupHFCollection(SIP_Message owner, string fieldName)
        {
            m_pMessage  = owner;
            m_FieldName = fieldName;

            m_pFields = new List <SIP_MultiValueHF <T> >();

            Refresh();
        }
        /// <summary>
        /// Matches speecified SIP message to SIP dialog. If no matching dialog found, returns null.
        /// </summary>
        /// <param name="message">SIP message.</param>
        /// <returns>Returns matched SIP dialog or null in no match found.</returns>
        internal SIP_Dialog MatchDialog(SIP_Message message)
        {
            string callID  = message.CallID;
            string fromTag = message.From.Tag;
            string toTag   = message.To.ToTag;

            if(callID != null && fromTag != null && toTag != null){
                string dialogID = callID + "-" + fromTag + "-" + toTag;
                lock(m_pDialogs){
                    foreach(SIP_Dialog dialog in m_pDialogs){
                        if(dialogID == dialog.DialogID){
                            return dialog;
                        }
                    }
                }
            }

            return null;
        }
Example #3
0
        /*
        /// <summary>
        /// Transfers call to specified recipient.
        /// </summary>
        /// <param name="to">Address where to transfer call.</param>
        public void CallTransfer(string to)
        {
            throw new NotImplementedException();
        }*/

        #endregion
                
        #region method CopyMessage

        /// <summary>
        /// Copies header fileds from 1 message to antother.
        /// </summary>
        /// <param name="source">Source message.</param>
        /// <param name="destination">Destination message.</param>
        /// <param name="exceptHeaders">Header fields not to copy.</param>
        private void CopyMessage(SIP_Message source,SIP_Message destination,string[] exceptHeaders)
        {
            foreach(SIP_HeaderField headerField in source.Header){
                bool copy = true;
                foreach(string h in exceptHeaders){
                    if(h.ToLower() == headerField.Name.ToLower()){
                        copy = false;
                        break;
                    }
                }

                if(copy){
                    destination.Header.Add(headerField.Name,headerField.Value);
                }
            }

            destination.Data = source.Data;
        }