OCS Server API: SimpleProxy
“Hidden” property on Request Object - Secret revealed!
We were working through the OCS SDK samples a few weeks ago and found this little gem in the “Archiver” sample. SimpleProxy is a property on the Request object - in the SDK example below, the developer sets this property to true before proxying the request.
//
// Mark the request as simple proxy. This will turn on
// performance optimizations that would otherwise be not
// possible.
//
e.Request.SimpleProxy = true;
e.ServerTransaction.EnableForking = false;//
// Proxy the request.
//
e.ServerTransaction.CreateBranch().SendRequest(e.Request);
We searched and couldn’t find any reference to this in MSDN and other obvious places.
We wondered about these mysterious, “otherwise not possible” performance enhancements. What are the implications of using this? Is there any risk of creating a black hole that would destroy the universe?
We got in contact with Kyle Marsh at Microsoft who generously enlightened us on the topic.
According to Kyle, the SimpleProxy is a performance optimization that tells OCS “to not clone requests or responses nor create unnecessary extra transactions.”
Simple Proxy can be enabled by doing the following in managed code.
- Set ServerTransaction.EnableForking to false.
- Set Request.SimpleProxy (new API) to true.
In script-only applications (using SIP Processing Language), all non-INVITEs are automatically simple proxied unless BeginFork/EndFork is called.
INVITE’s are never simple proxied, so if the SimpleProxy flag is enabled it is silently ignored.
An attempt to set the Request.SimpleProxy flag after any of the transaction level properties have changed will raise an exception. Similarly, once the SimpleProxy flag has been set, any attempt to change the transaction level properties will raise an exception.
The simple proxy is purely a performance optimization. Specifically, it reduces the amount of data marshaled, and reduces the amount of buffer cloning necessary.
This is a very good find indeed.
-John Lamb, Modality Systems