The Headerclass defines a SIP header.. A Headerinstance may belong to multiple HeaderCollectioninstances.
The Headerclass is derived from the System.Objectclass.
Inheritance hierarchy
Namespace: Microsoft.Rtc.SipAssembly: ServerAgent(in ServerAgent.dll)
Syntax
Visual Basic (declaration) |
---|
Public Class Header _ Inherits ReplicatedObject |
Visual Basic (usage) |
---|
Dim instance As Header |
C# |
---|
public class Header : ReplicatedObject |
Remarks
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.
Examples
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.
Copy code | |
---|---|
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); } |