Share via


ClientTransaction

The ClientTransaction class defines a SIP client transaction object located on a SIP proxy.

A ClientTransaction object is created by calling CreateBranch on a ServerTransaction object. For forking proxy behaviors, ServerTransaction.CreateBranch can be called multiple times; however, a ClientTransaction object itself can service only one request. To send the request, call ClientTransaction.SendRequest.

To handle the responses for the request sent by a specific client transaction, you must register for the ClientTransaction.ResponseReceived event. This event will return a ResponseReceivedEventArgs object whenever it is raised, and contains the response as a Response object.

Currently, the UAC client transaction case is not supported, where the server originates a client transaction. Only proxy behaviors are available for this class.

The ClientTransaction class is derived from the Microsoft.Rtc.Sip.Transaction class.

Public Methods

The ClientTransaction class has the following public methods.

Method Description
Cancel()

Inherited from Transaction. Cancels the transaction and raises the Canceled event.

Dispose()

Inherited from Transaction.Releases all resources used by this object and destroys it.

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.

SendRequest(Request)

Sends a SIP request to a server transaction on a proxy or UAS.

ToString()

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

Public Properties

The ClientTransaction class has the following public properties.

Property Description
OriginationTime Data type: DateTime
Access type: Read-only

Inherited from Transaction. Contains the date and time the transaction originated.

Request Data type: Request
Access type: Read-only

Inherited from Transaction. Contains the Request object that initiated the transaction.

Responses Data type: ResponseCollection
Access type: Read-only

Inherited from Transaction. Contains a collection of all Response objects associated with the transaction.

ServerTransaction Data type: ServerTransaction
Access type: Read-only

Contains the root ServerTransaction object for which this client transaction is a branch.

SyncRoot Data type: Object
Access type: Read-only

Inherited from Transaction. Contains an object used for synchronizing access to a group of objects related to a server or client transaction.

Public Events

The ClientTransaction class has the following public events.

Event Description
Canceled

Inherited from Transaction. Occurs when the transaction is canceled.

ResponseReceived

Occurs when a response message for the request sent by the ClientTransaction object has been received.

Terminated

Inherited from Transaction. Occurs when the transaction is terminated.

TimedOut

Inherited from Transaction. Occurs when the transaction times out.

Protected Methods

The ClientTransaction class has the following protected methods.

Method Description
CheckDisposed()

Inherited from Transaction. Throws ObjectDisposedException if the transaction is in the disposed state.

Close()

Inherited from Transaction. Releases all resources associated with the transaction.

Dispose(Boolean)

Inherited from Transaction. Destroys this transaction and releases all unmanaged resources as well as optionally releasing all managed ones.

Finalize()

Inherited from Transaction. Provides a finalizer for this instance of the Transaction class.

OnCanceled()

Inherited from Transaction. Raises the Transaction.Canceled event.

OnResponseReceived()

Raises the ClientTransaction.ResponseReceived event.

OnTerminated()

Inherited from Transaction. Raises the Transaction.Terminated event.

OnTimedOut()

Inherited from Transaction. Raises the Transaction.TimedOut event.

Remarks

For specific information on the nature of client transactions, the UAC, inbound and outbound proxies, and server transactions, see Section 17 of RFC 3261 (SIP: Session Initiation Protocol).

Example Code

The following code example logs the time a request is passed to the "OnRequest" dispatch handler, and then forwards the request by creating a branch on the server transaction passed to the handler. 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 e)
{

    Console.WriteLine("Enter OnRequest:" + System.DateTime.Now.ToLongTimeString());
            
    ClientTransaction branch = e.ServerTransaction.CreateBranch();
    branch.SendRequest(e.Request);
    
}

Requirements

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

See Also

ServerTransaction, ServerTransaction.CreateBranch, Transaction