/// <summary> /// Add a new header. /// </summary> /// <param name="name"></param> /// <param name="value"></param> public void Add(string name, IHeader value) { string lowerName = name.ToLower(); if (lowerName == "Content-Length") { ContentLength = (NumericHeader)value; } if (lowerName == "Content-Type") { ContentType = (ContentTypeHeader)value; } if (lowerName == "Connection") { _logger.Debug("____name:Connection :" + value.ToString()); Connection = (ConnectionHeader)value; } _headers.Add(name, value); }
/// <summary> /// Assign a header /// </summary> /// <param name="name">Long name, in lower case.</param> /// <param name="header">Header to assign</param> internal virtual void Assign(string name, IHeader header) { switch (name) { case "to": To = ((ContactHeader)header).FirstContact; break; case "from": From = ((ContactHeader)header).FirstContact; break; case "cseq": CSeq = (CSeq)header; break; case "via": var via = (Via)header; if (Via != null && Via.Items.Count > 0) { foreach (ViaEntry entry in via) { Via.Add(entry); } } else { Via = via; } break; case "call-id": CallId = header.ToString(); break; } Headers.Add(name.ToLower(), header); }