Creating and Managing SIP Transactions
The Microsoft.Rtc.Sip namespace defines a base type,, to represent the basic properties of a SIP transaction. This includes the request that originated the transaction, any responses handled by the transaction, and events for catching transaction status changes (such as time-outs or cancellations).
Two types derive from Transaction: , which represents a client transaction; and , which represents a server transaction.
The ServerTransaction instance is obtained by referencing the property, available when a object is dispatched to the designated method. The request it was created to service can be obtained in two ways: one, as the property; or two, as the property.
Client transactions must be created programmatically by calling. The UAC case, in which a client transaction originates a request and does not have a parent server transaction, is not supported.
To fork a message, ServerTransaction.CreateBranch can be called as many times as forks are needed. To send a request to each fork, call on each branch.
Responses to serviced requests are obtained by registering a handler for theevent. When this event is raised, any response received by Microsoft Lync Server 2010 that matches the originating request will be sent as a object to the method registered using the delegate.
Responses can also be raised by dispatches from the message filter script when it is set to filter responses. In this case, the response will be out-of-context—"there is no ClientTransaction object on the server that originated the request. In this case, the new ClientTransaction object is obtained by referencing the property. The ServerTransaction to forward the response is obtained by referencing the property on this ClientTransaction, which contains the new ServerTransaction instance to handle it.
If a CANCEL method is received for a transaction, the event is raised. When the transaction is closed, is raised. If a transaction times out, is raised.