Filter messages for load balance using file-based policy (PublicIM sample)
Learn about the Microsoft Lync Server 2013 SDK PublicIM sample application and how to load balance in a Microsoft Lync 2013 topology.
Applies to: Lync 2013 | Lync Server 2013
Note
By default, the PublicIM application is copied to the %progfile%\Microsoft Lync Server 2013\SDK\Samples\PublicIM folder. PublicIM and related code samples can also be downloaded from the MSDN Code Gallery.
The PublicIM application that is distributed with the Lync Server 2013 SDK shows how to use a script-only SIP application to route incoming SIP messages from external networks to an internal Microsoft Lync Server 2013 computer.
As a routing application, the strictRoute attribute must be set to false on the requestFilter in the application manifest.
The following logic is implemented by the Microsoft SIP Processing Language (MSPL) script:
Verify that a SIP request originates from an external network by comparing the sipRequest.Origin against Messageorigin.NetworkExternal.
Selects a fully qualified domain name (FQDN) of a computer that is running Lync Server 2013. In this topic, the selection is based on a hash string of the SIP URI of the requester.
Forward the incoming request to the selected server by calling the ProxyRequest function with a new SIP URI that is constructed by using the following format: "<original request Uri>;maddr=<selected server address>;transport=tls".
For other messages, forward the message as is, by calling ProxyRequest("") or ProxyResponse().
Additional PublicIM features:
Accesses the config.txt file through the declaration of the <file> element in the application manifest.
Parses the contained data by column names.
You may need to change occurrences of Log("Debug", …); in the application manifest to Log("Debugr", …);, if they are not already updated.
Testing the application
If necessary, copy the %progfile%\Microsoft Lync Server 2013\SDK\Samples\PublicIM folder to a Lync Server 2013 computer on which the application runs.
To run the application
Log on to the Lync Server 2013 RTC Server Applications local security group account.
Update the list of server addresses in the configuration (config.txt) file. Copy the application manifest (.am) and configuration files to the %progfile%\Microsoft Lync Server 2013\Server\Core folder.
Register the application by running the following commands in a Lync Server Management Shell window:
Note
<lync.Server.Fdqn> is the placeholder for the fully qualified domain name for the test server. You may have to change the priority value so that it's larger than the UserServices application value.
new-csServerApplication -uri " http://www.microsoft.com/LC/SDK/Samples/PublicIM" -identity "service:registrar:<lync.Server.Fdqn>/PublicIM" -critical $false -priority 6 -scriptname Public.am -enabled $true
Send IM messages from a SIP client to another user.
See also
Concepts
Learn the basics of Lync Server 2013 SDK
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for