MSPL Built-in Variables

Microsoft SIP Processing Language (MSPL) defines nine built-in variables for use with SIP message processing:

  • Message sipMessage;

  • Request sipRequest;

  • Response sipResponse;

  • SourceInfo RequestSource(Introduced in Microsoft Lync Server 2010.)

  • RegistrarEndpoint dbEndpoint;

  • string FQDN;

  • string ServerPool;

  • ServerRole Role;

  • TargetInfo RequestTarget;

Message (MSPL)   sipMessage;

The sipMessagevariable contains the current SIP message passed from Microsoft Lync Server 2013 to the application.

Request   sipRequest;

The sipRequestvariable contains the current SIP request message passed from Lync Server 2013 to the application.

Response   sipResponse;

The sipResponsevariable contains the current SIP response message passed from Lync Server 2013 to the application.

SourceInfo   RequestSource

The RequestSourcevariable contains the source of the current SIP request message passed from Lync Server 2013 to the application. Introduced in Lync Server 2010.

Scripts test for the message type (request or response) by first determining if the corresponding built-in variable evaluates to true or false . If it evaluates to true , the message is the one tested for. If false , it is not.

For example, to test if the current message is a request.

  Copy codeCopy code
if (sipRequest) {
  // Process the request here.

Then, to test if the message is a response:

  Copy codeCopy code
if (sipResponse) {
		 // Process the request here.

This test should always be performed before any expressions involving fields on the request/response are performed. For example, if you attempt to access the StatusClassfield on the sipResponsevariable before determining that the message is, in fact, a response, it will return false instead of the expected status code string when a request or server notification is encountered instead of a response. This leads to logical errors when code like

  Copy codeCopy code
sipResponse.StatusClass != StatusClass._2xx;

is encountered when a message type determination has not been made. The previous code always evaluates to true for anything but a response; in this case, checking the message type is important to ensure proper filtering.

You can store the body of a message in the Content field. As a result, the following expressions are valid in MSPL.

  Copy codeCopy code
sipMessage.Content = "this is the body of a message";
sipRequest.Content = "this is the body of a request";
sipResponse.Content = "this is the body of a response";

RegistrarEndpoint   dbEndpoint;

The dbEndpointvariable contains a network endpoint as stored in the Lync Server 2013 registrar database. This variable is valid only within the scope of a foreachloop that iterates over the collection returned by a QueryEndpoints function call.

  Copy codeCopy code
foreach (dbEndpoint in QueryEndpoints("")) {

string FQDN;

The FQDN variable contains the fully qualified DNS name of the local server.

string ServerPool;

The ServerPoolvariable specifies the name of the pool of the server on which the application is running.

Note Note

All references to built-in variables are read-only.

ServerRole  Role;

The Rolevariable contains the role of the server where the SPL is executing.

TargetInfo  RequestTarget;

The RequestTargetvariable contains details about the target of the request. This is valid only if the script is executing because of a request (as opposed to a response).

See also