Exemple #1
0
        public void SetHeader(SipHeaderBase header)
        {
            Check.Require(header, "header");

            switch (header.Name)
            {
                case SipHeaderNames.CSeq: _sceq = (SipCSeqHeader)header;
                    break;
                case SipHeaderNames.CallId: _callId = (SipCallIdHeader)header;
                    break;
                case SipHeaderNames.Contact: _contacts.Add((SipContactHeader)header);
                    break;
                case SipHeaderNames.ContentLength: _contentLenght = (SipContentLengthHeader)header;
                    break;
                case SipHeaderNames.ContentType: _contentType = (SipContentTypeHeader)header;
                    break;
                case SipHeaderNames.From: _from = (SipFromHeader)header;
                    break;
                case SipHeaderNames.MaxForwards: _maxForwards = (SipMaxForwardsHeader)header;
                    break;
                case SipHeaderNames.To: _to = (SipToHeader)header;
                    break;
                case SipHeaderNames.Via: _vias.Add((SipViaHeader) header);
                    break;
                case SipHeaderNames.Subject: _subject = (SipSubjectHeader)header;
                    break;
                case SipHeaderNames.Route: _routes.Add((SipRouteHeader)header);
                    break;
                case SipHeaderNames.Expires: _expires = (SipExpiresHeader)header;
                    break;
                case SipHeaderNames.RecordRoute: _recordRoutes.Add((SipRecordRouteHeader)header);
                    break;
                case SipHeaderNames.Allow: _allow = (SipAllowHeader)header;
                    break;
                case SipHeaderNames.UserAgent: _userAgent = (SipUserAgentHeader)header;
                    break;
                default:
                    throw new NotSupportedException(string.Format("The header with name {0} is not supported.", header.Name));
            }
        }
Exemple #2
0
        public void RemoveHeader(string header)
        {
            Check.Require(header, "header");

            switch (header)
            {
                case SipHeaderNames.CSeq:
                    _sceq = null;
                    break;
                case SipHeaderNames.CallId:
                    _callId = null;
                    break;
                case SipHeaderNames.Contact:
                    _contacts.Clear();
                    break;
                case SipHeaderNames.ContentLength:
                    _contentLenght = null;
                    break;
                case SipHeaderNames.ContentType:
                    _contentType = null;
                    break;
                case SipHeaderNames.From:
                    _from = null;
                    break;
                case SipHeaderNames.MaxForwards:
                    _maxForwards = null;
                    break;
                case SipHeaderNames.To:
                    _to = null;
                    break;
                case SipHeaderNames.Via:
                    _vias.Clear();
                    break;
                case SipHeaderNames.Subject:
                    _subject =  null;;
                    break;
                case SipHeaderNames.Route:
                    _routes.Clear();
                    break;
                case SipHeaderNames.Expires:
                    _expires = null;
                    break;
                case SipHeaderNames.RecordRoute:
                    _recordRoutes.Clear();
                    break;
                case SipHeaderNames.Allow:
                    _allow = null;
                    break;
                case SipHeaderNames.UserAgent:
                    _userAgent = null;
                    break;
                default:
                    throw new NotSupportedException(string.Format("The header with name {0} is not supported.", header));
            }
        }