How to: Debug a Lync Server SIP application
Learn how to debug a SIP application in a Microsoft Lync Server 2013 deployment.
Last modified: August 16, 2013
Applies to: Lync Server 2013
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.
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 Log function.
The name parameter specifies the name of the log. It can be "Event, Error, or Debugr. The first two correspond to the Windows Event Viewer log. Debugr is the application-specific ApiLogger debug utility. The messages parameters 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.
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.
"c:\program files\Microsoft Lync Server 2013\SDK\Bin" ApiLogger.exe
The utility prompts you to restart the Lync Server Front End role. To do so, issue the following command from another Command window.
Net stop rtcsrv Net start rtcsrv
You can also restart this service by using the Services utility. Right-click the Lync Server Front-End entry, 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."
"Cannot proxy more than once if ServerTransaction.EnableForking is set to false."
"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."
"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 error messages represent internal Lync Server 2013 failures, such as unavailable memory for specific operations. Internal error messages are prefixed with "Internal error:".