Partilhar via


Header class

 
Microsoft Office Live Communications Server 2005 with SP1

Header

The Header class defines a SIP header.

The Header class is derived from the System.Object class.

Public Constructors

The Header class has the following public constructors.

Constructor Description
Header()

Initializes a new instance of the Header class without a specified type or value.

Header(String type)

Initializes a new instance of the Header class of the specified SIP header type.

Header(String type, String value)

Initializes a new instance of the Header class of the specified SIP header type, with the specified value.

Public Methods

The Header class has the following public methods.

Method Description
Equals(Object)

Inherited from System.Object. Determines whether the specified System.Object is equal to the current System.Object.

GetHashCode()

Inherited from System.Object. Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.

GetType()

Inherited from System.Object. Gets the System.Type of the current instance.

ToString()

Inherited from System.Object. Returns a System.String that represents the current System.Object.

Public Properties

The Header class has the following public properties.

Property Description
IsReadOnly Data type: Boolean
Access type: Read-only

Indicates whether the SIP header is read-only.

Parameters Data type: NameValueCollection
Access type: Read/write

Contains the parameters for the SIP header as a collection of name/value pairs.

Type Data type: String
Access type: Read-only

Contains the SIP header type as a string.

Value Data type: String
Access type: Read/write

Contains the SIP header value as a string.

ValueNoParameters Data type: String
Access type: Read/write

Contains the SIP header value as a string, minus any attached parameters.

Remarks

A SIP header field is represented as type: value *(;parameter-name=parameter-value). The header type is a specific name, such as "Via", "Subject", or "Route". The header value is a string value corresponding to the type. The optional parameter list occurs after the value, with each parameter name/value pair separated from the header value and the other parameters by a semicolon.

Example Code

The following code sample sends a redirection response with the new endpoint address in the "Contact" header. Requests are dispatched to this method from the MSPL script in the application manifest using the Dispatch MSPL function.

public void OnRequest(object sender, RequestReceivedEventArgs rreArgs)
{

	// Send a generic response to the sender indicating redirection (302). 
		
	Response response = rreArgs.Request.CreateResponse(302);

	response.ReasonPhrase = "Redirected by Live Communications Server";

	// Add the "Contact" header indicating the new redirection address of the SIP user.
	// In this example, the localhost is supplied; in a real application, the second
	// parameter of the Header constructor would be the redirection address of the user.
		
	Header h = new Header("Contact", "sip:127.0.0.1:5060;transport=tcp");
	response.AllHeaders.Add(h);

	// Send the response.
	rreArgs.ServerTransaction.SendResponse(response);

}

Requirements

Redistributable: Requires Microsoft Office Live Communications Server 2005 with SP1.
Namespace: Microsoft.Rtc.Sip
Assembly: ServerAgent (in ServerAgent.dll)

See Also

HeaderCollection

  
  What did you think of this topic?
  © 2008 Microsoft Corporation. All rights reserved.