Blocking Lync Audio and Video with Federated Contacts Using MSPL

I am a huge fan of MSPL scripting. I have published a few here on VoIPNorm and I have pointed numerous IT Pros to them. Certainly there is common theme to controlling Lync federated partners whether it be for file transfer or other with these scripts.

 

The following is a script that was written by Santosh More from Microsoft that blocks audio and video with federated contacts. The scripts I post aren't always going to be block buster scripts that everyone will use but they can be great starting points to accomplish other tasks if you new to MSPL.

 

Thanks to Santosh for allowing me to share this with everyone.

 

<?xml version="1.0"?>

<lc:applicationManifest lc:appUri="http://fabrikam.com/BlockFederatedAudioCalls" xmlns:lc="http://schemas.microsoft.com/lcs/2006/05">

<lc:requestFilter methodNames="INVITE" strictRoute="true"  phoneUris="true"/>

  <lc:responseFilter reasonCodes="ALL"/>

  <lc:scriptOnly/>

  <lc:proxyByDefault action="true"/>

<lc:splScript><![CDATA[

  

 

                if (sipRequest)

                {

       

                 if (!ContainsString(sipRequest.To, "conf:audio-video"))

                  {

 

                                if (ContainsString(sipRequest.From, "@contoso.com"))

                                {

       

                                  if (IndexOfString(sipRequest.Content, "m=audio") >= 0)

                                  {

                                  Respond(403, "AV call with federated domain is not allowed");

                                  }

    

                                }

               

                                if (ContainsString(sipRequest.To, "@contoso.com"))

                                {

       

                                  if (IndexOfString(sipRequest.Content, "m=audio") >= 0)

                                  {

                                  Respond(403, "AV call with federated domain is not allowed");

                                  }

    

                                }

 

                    }

 

                  }

               

]]>

 

</lc:splScript>

</lc:applicationManifest>

 

Following are the Steps to deploy the application

 

1. Modify the Script replace @contoso.com with the domain name of the Federated partner and save the file as BlockFederatedAudioCalls.am in following folder C:\LyncScripts\BlockFederatedAudioCalls  on all the Edge Servers.

 

2. On FrontEnd Server run following command to create a server application

 

New-CsServerApplication -Identity "EdgeServer:edgepool.fabrkam.com/BlockFederatedAudioCalls" -Uri "http://fabrikam.com/BlockFederatedAudioCalls" -ScriptName

"C:\LyncScripts\BlockFederatedAudioCalls\BlockFederatedAudioCalls.am" -Enabled $true

 

3. This change needs to be replicated to all the Edge Servers so wait for CMS  replication to complete with Edge servers

   Or Export the Configuration and Import it on the Edge servers.

  

4. Restart Access Edge Service on All Edge Servers

 

If you have a script that you want to share with the world let me know. I am happy to post it on VoIPNorm and give full credit to the creator.

 

VoIPNorm

No comments:

Post a Comment