Header

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.Header ()

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

Header.Header (String)

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

Header.Header (String, String)

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

Header.IsReadOnly

Data type: BooleanAccess

type: Read-only

Indicates whether the SIP header is read-only.

Header.Parameters

Data type: NameValueCollectionAccess

type: Read/write

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

Header.Type

Data type: StringAccess

type: Read-only

Contains the SIP header type as a string.

Header.Value

Data type: StringAccess type:

Read/write

Contains the SIP header value as a string.

Header.ValueNoParameters

Data type: StringAccess

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 Lync 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 Lync Server 2010

Namespace:Microsoft.Rtc.Sip

Assembly: ServerAgent (in ServerAgent.dll)

See Also

Concepts

HeaderCollection