Header class

Lync 2013

The Header class defines a SIP header.. A Header instance may belong to multiple HeaderCollection instances.

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

System.Object
  ReplicatedObject
    Microsoft.Rtc.Sip.Header

Namespace:  Microsoft.Rtc.Sip
Assembly:  ServerAgent (in ServerAgent.dll)

public class Header : ReplicatedObject

This class is intended as a base class for some header types. Static constructor methods are provided.

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.

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 by 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);

}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: