Learn how a forking proxy in a managed SIP application forwards a SIP request to multiple SIP address and returns the responses to the sender. This topic discusses the object model for the forking behavior.

SIP forking proxy application

In Microsoft Lync Server 2013 SDK, you can use the Microsoft SIP Processing Language (MSPL) message filter to fork basic proxies.

SIP forking proxy behavior

The following illustration shows the basic flow of a forking proxy.

SIP Forking Proxy Transaction

When a message is dispatched to the application by the MSPL script, a RequestReceivedEventArgsobject is returned to the method inside the application that is designated by the Dispatchcall. Attached to this object is a new ServerTransactionobject, which contains the Requestobject as the ServerTransaction.Requestproperty.

To fork the Request, clone ServerTransaction.Requestfor each recipient. First, ensure that the ServerTransaction.EnableForkingproperty is set to true . If this property is set to false (the default is true ), ArgumentExceptionis thrown when you call ServerTransaction.CreateBranchagain.

For each proxied request, call ServerTransaction.CreateBranchand then immediately call ClientTransaction.SendRequest, passing in the cloned Request.

Responses are handled asynchronously through the ResponseReceivedEventHandlerdelegate. The ClientTransaction.ResponseReceivedevent is triggered when a response for a sent Requestis received, and the corresponding Responseobject is returned as the ResponseReceivedEventArgs.Responseproperty.

To proxy the response, call ServerTransaction.SendResponse, passing in ResponseReceivedEventArgs.Response.

When a final response is passed to the server transaction, the object space that contains the ServerTransactionand its branches is automatically disposed of by the server agent, unless the ServerTransaction.Close()method on ServerTransactionwas overridden.

See also