Learn how to debug a SIP application in a Microsoft Lync Server 2013 deployment.

To debug a SIP application that is loaded into a Lync Server 2013 deployment, trace the execution of the Microsoft SIP Processing Language (MSPL) script that is embedded in the application manifest in addition to the managed application components.

Debugging MSPL script

MSPL supports tracing functionality through the built-in Log function that can be called throughout the script block to log run-time data in the Windows Event Viewer log on the server or the ApiLogger utility that is distributed with Microsoft Lync Server 2013 SDK. The following example shows the C# syntax for the Logfunction.

C#  Copy codeCopy code
void Log(string name, bool detail, params string[] messages);

The nameparameter specifies the name of the log. It can be " Event, Error, or Debugr. The first two correspond to the Windows Event Viewer log. Debugris the application-specific ApiLogger debug utility. The messagesparameters contain zero or more messages that appear in the specified log. For the "Event" log, the supplied messages are logged as a warning in Windows Event Viewer. For the "Error" log, the supplied messages appear as an error in Windows Event Viewer.

The level of detail for each message in the log is set with the second parameter. If it is false , only the "Method", "To", "From", and "Request-Uri" headers are logged, together with the date/time and the application URI. If it is true , the whole SIP message is logged.

Using ApiLogger

By default, the ApiLogger.exe utility is installed in the %progfile%\Microsoft Lync Server 2013\SDK\Bin directory. To run this utility, start the executable by double-clicking the ApiLogger.Exe file or issue the following command from a Command window.

  Copy codeCopy code
 "c:\program files\Microsoft Lync Server 2013\SDK\Bin"

The utility prompts you to restart the Lync Server Front End role. To do so, issue the following command from another Command window.

  Copy codeCopy code
Net stop rtcsrv
Net start rtcsrv

You can also restart this service by using the Services utility. Right-click the Lync Server Front-Endentry, and then selecting Restart.

When the RtcSrv service is restarted, ApiLogger is connected to the server and the debug messages from all the loaded MSPL scripts appear in the ApiLogger window.

The following table describes the ApiLogger error messages.

Application error message


"Branched requests must be sent on new client transactions."

The application is trying to call SendRequest(Request) two times on a ClientTransaction instance. Only one request may be sent for each ClientTransactioninstance.

"Cannot proxy more than once if ServerTransaction.EnableForking is set to false."

The application is trying to call CreateBranch () () () () on the same ServerTransaction again, but EnableForking is set to false . By default, EnableForkingis set to true .

"Failed to proxy message. Are you trying to proxy the same response twice?"

Your application attempted to proxy the same response for the same ServerTransaction instance at least two times.

"Invalid status code."

The application supplied an invalid status code in the StatusCode property of the Response object that is passed to the SendResponse(Response) method.

"Cannot send two requests on the same transaction."

The application is trying to send two different requests through the same ClientTransaction object. Check your code and ensure that you are not passing more than one Request object for the same ClientTransaction instance by calling the SendRequest(Request) method multiple times on it.

"Cannot proxy multiple final responses."

Your application has tried to proxy two different final responses for the same ServerTransaction instance.

"Cannot proxy. Transaction is in canceled / timed out state."

The Transaction object, ( ServerTransaction or ClientTransaction ), timed out when it tried to service a request or response. Examine the message log for the specific message that might have caused the time-out or unexpected cancellation.

"Only sip: URIs are supported."

The application tried to proxy a message that uses a "tel:", "sips:" or another URI scheme that is not specifically "sip:". Consider filtering all messages with URIs that do not use the sip: scheme if they are encountered frequently.

"Internal errors"

Internal error messages represent internal Lync Server 2013 failures, such as unavailable memory for specific operations. Internal error messages are prefixed with "Internal error:".

See also