Skip to content

Commit

Permalink
change compliance to policy (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathowar authored Mar 10, 2020
1 parent a06becf commit 06dfb4f
Show file tree
Hide file tree
Showing 33 changed files with 58 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Common.Beta", "..\..\Common\Sample.Common.Beta\Sample.Common.Beta.csproj", "{3268E59C-90DC-4D7B-97EA-A1DBB2716DF3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CRFrontEnd", "ComplianceRecordingBot\FrontEnd\CRFrontEnd.csproj", "{739D09C4-47E8-42B7-9B89-94DCB890AC0F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CRFrontEnd", "PolicyRecordingBot\FrontEnd\CRFrontEnd.csproj", "{739D09C4-47E8-42B7-9B89-94DCB890AC0F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CRWorkerRole", "ComplianceRecordingBot\WorkerRole\CRWorkerRole.csproj", "{EAF11F22-C267-4C02-820D-12B622FEBFC1}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CRWorkerRole", "PolicyRecordingBot\WorkerRole\CRWorkerRole.csproj", "{EAF11F22-C267-4C02-820D-12B622FEBFC1}"
EndProject
Project("{CC5FD16D-436D-48AD-A40C-5A424C6E3E79}") = "ComplianceRecordingBot", "ComplianceRecordingBot\ComplianceRecordingBot.ccproj", "{69051056-B313-432E-8CE3-D7164CD82DC9}"
Project("{CC5FD16D-436D-48AD-A40C-5A424C6E3E79}") = "PolicyRecordingBot", "PolicyRecordingBot\PolicyRecordingBot.ccproj", "{69051056-B313-432E-8CE3-D7164CD82DC9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Licensed under the MIT license.
// </copyright>

namespace Sample.ComplianceRecordingBot.FrontEnd.Bot
namespace Sample.PolicyRecordingBot.FrontEnd.Bot
{
using System;
using System.Collections.Concurrent;
Expand All @@ -21,7 +21,7 @@ namespace Sample.ComplianceRecordingBot.FrontEnd.Bot
using Sample.Common;
using Sample.Common.Authentication;
using Sample.Common.Logging;
using Sample.ComplianceRecordingBot.FrontEnd;
using Sample.PolicyRecordingBot.FrontEnd;

/// <summary>
/// The core bot logic.
Expand Down Expand Up @@ -177,7 +177,7 @@ private void CallsOnIncoming(ICallCollection sender, CollectionEventArgs<ICall>
{
args.AddedResources.ForEach(call =>
{
// Get the compliance recording parameters.
// Get the policy recording parameters.

// The context associated with the incoming call.
IncomingContext incomingContext =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample.ComplianceRecordingBot.FrontEnd.Bot
namespace Sample.PolicyRecordingBot.FrontEnd.Bot
{
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -182,7 +182,7 @@ private void OnAudioMediaReceived(object sender, AudioMediaReceivedEventArgs e)
{
this.GraphLogger.Info($"Received Audio: [VideoMediaReceivedEventArgs(Data=<{e.Buffer.Data.ToString()}>, Length={e.Buffer.Length}, Timestamp={e.Buffer.Timestamp})]");

// TBD: Compliance Recording bots can record the Audio here
// TBD: Policy Recording bots can record the Audio here
e.Buffer.Dispose();
}

Expand All @@ -199,7 +199,7 @@ private void OnVideoMediaReceived(object sender, VideoMediaReceivedEventArgs e)
{
this.GraphLogger.Info($"[{e.SocketId}]: Received Video: [VideoMediaReceivedEventArgs(Data=<{e.Buffer.Data.ToString()}>, Length={e.Buffer.Length}, Timestamp={e.Buffer.Timestamp}, Width={e.Buffer.VideoFormat.Width}, Height={e.Buffer.VideoFormat.Height}, ColorFormat={e.Buffer.VideoFormat.VideoColorFormat}, FrameRate={e.Buffer.VideoFormat.FrameRate})]");

// TBD: Compliance Recording bots can record the Video here
// TBD: Policy Recording bots can record the Video here
e.Buffer.Dispose();
}

Expand All @@ -216,7 +216,7 @@ private void OnVbssMediaReceived(object sender, VideoMediaReceivedEventArgs e)
{
this.GraphLogger.Info($"[{e.SocketId}]: Received VBSS: [VideoMediaReceivedEventArgs(Data=<{e.Buffer.Data.ToString()}>, Length={e.Buffer.Length}, Timestamp={e.Buffer.Timestamp}, Width={e.Buffer.VideoFormat.Width}, Height={e.Buffer.VideoFormat.Height}, ColorFormat={e.Buffer.VideoFormat.VideoColorFormat}, FrameRate={e.Buffer.VideoFormat.FrameRate})]");

// TBD: Compliance Recording bots can record the VBSS here
// TBD: Policy Recording bots can record the VBSS here
e.Buffer.Dispose();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Licensed under the MIT license.
// </copyright>

namespace Sample.ComplianceRecordingBot.FrontEnd.Bot
namespace Sample.PolicyRecordingBot.FrontEnd.Bot
{
using System;
using System.Collections.Concurrent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample.ComplianceRecordingBot.FrontEnd.Bot
namespace Sample.PolicyRecordingBot.FrontEnd.Bot
{
using System;
using System.Net;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<ProjectGuid>{739D09C4-47E8-42B7-9B89-94DCB890AC0F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sample.ComplianceRecordingBot.FrontEnd</RootNamespace>
<AssemblyName>Sample.ComplianceRecordingBot.FrontEnd</AssemblyName>
<RootNamespace>Sample.PolicyRecordingBot.FrontEnd</RootNamespace>
<AssemblyName>Sample.PolicyRecordingBot.FrontEnd</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample.ComplianceRecordingBot.FrontEnd.Http
namespace Sample.PolicyRecordingBot.FrontEnd.Http
{
using System;
using System.Collections.Generic;
Expand All @@ -20,7 +20,7 @@ namespace Sample.ComplianceRecordingBot.FrontEnd.Http
using Microsoft.Graph.Communications.Common.Telemetry;
using Microsoft.Graph.Communications.Core.Serialization;
using Sample.Common.Logging;
using Sample.ComplianceRecordingBot.FrontEnd.Bot;
using Sample.PolicyRecordingBot.FrontEnd.Bot;

/// <summary>
/// DemoController serves as the gateway to explore the bot.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample.ComplianceRecordingBot.FrontEnd.Http
namespace Sample.PolicyRecordingBot.FrontEnd.Http
{
/// <summary>
/// HTTP route constants for routing requests to CallController methods.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Licensed under the MIT license.
// </copyright>

namespace Sample.ComplianceRecordingBot.FrontEnd.Http
namespace Sample.PolicyRecordingBot.FrontEnd.Http
{
using System;
using System.Diagnostics;
Expand All @@ -19,7 +19,7 @@ namespace Sample.ComplianceRecordingBot.FrontEnd.Http
using Microsoft.Graph.Communications.Common.Telemetry;
using Microsoft.Graph.Communications.Common.Transport;
using Microsoft.Graph.Communications.Core.Notifications;
using Sample.ComplianceRecordingBot.FrontEnd.Bot;
using Sample.PolicyRecordingBot.FrontEnd.Bot;
using ErrorConstants = Microsoft.Graph.Communications.Core.Exceptions.ErrorConstants;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample.ComplianceRecordingBot.FrontEnd.Http
namespace Sample.PolicyRecordingBot.FrontEnd.Http
{
using System.Threading;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample.ComplianceRecordingBot.FrontEnd.Http
namespace Sample.PolicyRecordingBot.FrontEnd.Http
{
using System.Web.Http;
using System.Web.Http.ExceptionHandling;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample.ComplianceRecordingBot.FrontEnd.Http
namespace Sample.PolicyRecordingBot.FrontEnd.Http
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample.ComplianceRecordingBot.FrontEnd
namespace Sample.PolicyRecordingBot.FrontEnd
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample.ComplianceRecordingBot.FrontEnd
namespace Sample.PolicyRecordingBot.FrontEnd
{
using System;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample.ComplianceRecordingBot.FrontEnd
namespace Sample.PolicyRecordingBot.FrontEnd
{
/// <summary>
/// Contants used by the bot.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample.ComplianceRecordingBot.FrontEnd
namespace Sample.PolicyRecordingBot.FrontEnd
{
using System;
using Microsoft.Graph.Communications.Common.Telemetry;
using Microsoft.Owin.Hosting;
using Sample.ComplianceRecordingBot.FrontEnd.Http;
using Sample.PolicyRecordingBot.FrontEnd.Http;

/// <summary>
/// Service is the main entry point independent of Azure. Anyone instantiating Service needs to first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample.ComplianceRecordingBot.FrontEnd
namespace Sample.PolicyRecordingBot.FrontEnd
{
using Microsoft.Skype.Bots.Media;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
<ProjectGuid>{69051056-b313-432e-8ce3-d7164cd82dc9}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ComplianceRecordingBot</RootNamespace>
<AssemblyName>ComplianceRecordingBot</AssemblyName>
<RootNamespace>PolicyRecordingBot</RootNamespace>
<AssemblyName>PolicyRecordingBot</AssemblyName>
<StartDevelopmentStorage>True</StartDevelopmentStorage>
<Name>ComplianceRecordingBot</Name>
<Name>PolicyRecordingBot</Name>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -48,6 +48,9 @@
<RoleName>CRWorkerRole</RoleName>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PublishProfile Include="Profiles\SampleGraphBotProduction1.azurePubxml" />
</ItemGroup>
<!-- Import the target files for this project template -->
<PropertyGroup>
<VisualStudioVersion Condition=" '$(VisualStudioVersion)' == '' ">10.0</VisualStudioVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Introduction

## Note

The system will load the bot and join it to appropriate calls and meetings in order for the bot to enforce compliance with the administrative set policy.

## About

The Compliance Recording bot sample guides you through building, deploying and testing a bot. This sample demonstrates how a bot can receive media streams for recording. Please note that the sample does not actually record. This logic is left up to the developer.
The Policy Recording bot sample guides you through building, deploying and testing a bot. This sample demonstrates how a bot can receive media streams for recording. Please note that the sample does not actually record. This logic is left up to the developer.

## Getting Started

Expand All @@ -11,8 +15,8 @@ This section walks you through the process of deploying and testing the sample b
### Bot Registration

1. Follow the steps in [Register Calling Bot](https://microsoftgraph.github.io/microsoft-graph-comms-samples/docs/articles/calls/register-calling-bot.html). Save the bot name, bot app id and bot secret for configuration.
* For the calling webhook, by default the notification will go to https://{your domain}/api/calling. This is configured with the `CallSignalingRoutePrefix` in [HttpRouteConstants.cs](https://github.com/microsoftgraph/microsoft-graph-comms-samples/blob/master/Samples/BetaSamples/LocalMediaSamples/ComplianceRecordingBot/FrontEnd/Http/Controllers/HttpRouteConstants.cs).
* Ignore the "Register bot in Microsoft Teams" section as the Compliance Recording bot won't be called directly. These bots are related to the policies discussed below, and are "attached" to users, and will be automatically invited to the call.
* For the calling webhook, by default the notification will go to https://{your domain}/api/calling. This is configured with the `CallSignalingRoutePrefix` in [HttpRouteConstants.cs](https://github.com/microsoftgraph/microsoft-graph-comms-samples/blob/master/Samples/BetaSamples/LocalMediaSamples/PolicyRecordingBot/FrontEnd/Http/Controllers/HttpRouteConstants.cs).
* Ignore the "Register bot in Microsoft Teams" section as the Policy Recording bot won't be called directly. These bots are related to the policies discussed below, and are "attached" to users, and will be automatically invited to the call.

1. Add the following Application Permissions to the bot:

Expand All @@ -31,20 +35,20 @@ Open powershell (in admin mode) and run the following commands. When prompted fo
* `> New-CsOnlineApplicationInstance -UserPrincipalName <[email protected]> -DisplayName <displayName> -ApplicationId <your_botappId>`
* `> Sync-CsOnlineApplicationInstance -ObjectId <objectId>`

### Create a Compliance Recording Policy
### Create a Recording Policy
Requires the application instance ID created above. Continue your powershell session and run the following commands.
* `> New-CsTeamsComplianceRecordingPolicy -Enabled $true -Description "Test policy created by <yourName>" <policyIdentity>`
* ```> Set-CsTeamsComplianceRecordingPolicy -Identity <policyIdentity> -ComplianceRecordingApplications ` @(New-CsTeamsComplianceRecordingApplication -Parent <policyIdentity> -Id <objectId>)```

After 30-60 seconds, the policy should show up. To verify your policy was created correctly:
* `> Get-CsTeamsComplianceRecordingPolicy <policyIdentity>`

### Assign the Compliance Recording Policy
### Assign the Recording Policy
Requries the policy identity created above. Contine your powershell session and run the following commands.
* `> Grant-CsTeamsComplianceRecordingPolicy -Identity <userUnderCompliance@contoso.com> -PolicyName <policyIdentity>`
* `> Grant-CsTeamsComplianceRecordingPolicy -Identity <userUnderPolicy@contoso.com> -PolicyName <policyIdentity>`

To verify your policy was assigned correctly:
* `> Get-CsOnlineUser <userUnderCompliance@contoso.com> | ft sipaddress, tenantid, TeamsComplianceRecordingPolicy`
* `> Get-CsOnlineUser <userUnderPolicy@contoso.com> | ft sipaddress, tenantid, TeamsComplianceRecordingPolicy`

### Prerequisites

Expand All @@ -64,10 +68,10 @@ To verify your policy was assigned correctly:
1. Set up cloud service configuration
1. Open powershell, go to the folder that contains file `configure_cloud.ps1`. The file is in the `Samples` directory.
2. Run the powershell script with parameters:
* `> .\configure_cloud.ps1 -p .\BetaSamples\LocalMediaSamples\ComplianceRecordingBot\ -dns {your DNS name} -cn {your CN name, should be the same as your DNS name} -thumb {your certificate thumbprint} -bid {your bot name} -aid {your bot app id} -as {your bot secret}`, for example `.\configure_cloud.ps1 -p .\BetaSamples\LocalMediaSamples\ComplianceRecordingBot\ -dns bot.contoso.com -cn bot.contoso.com -thumb ABC0000000000000000000000000000000000CBA -bid bot -aid 3853f935-2c6f-43d7-859d-6e8f83b519ae -as 123456!@#$%^`
* `> .\configure_cloud.ps1 -p .\BetaSamples\LocalMediaSamples\PolicyRecordingBot\ -dns {your DNS name} -cn {your CN name, should be the same as your DNS name} -thumb {your certificate thumbprint} -bid {your bot name} -aid {your bot app id} -as {your bot secret}`, for example `.\configure_cloud.ps1 -p .\BetaSamples\LocalMediaSamples\PolicyRecordingBot\ -dns bot.contoso.com -cn bot.contoso.com -thumb ABC0000000000000000000000000000000000CBA -bid bot -aid 3853f935-2c6f-43d7-859d-6e8f83b519ae -as 123456!@#$%^`

1. Publish the bot from VS:
1. Right click ComplianceRecordingBot, then click `Publish...`. Publish it to the cloud service you created earlier.
1. Right click PolicyRecordingBot, then click `Publish...`. Publish it to the cloud service you created earlier.

### Test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="ComplianceRecordingBot" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="6" osVersion="*" schemaVersion="2015-04.2.6">
<ServiceConfiguration serviceName="PolicyRecordingBot" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="6" osVersion="*" schemaVersion="2015-04.2.6">
<Role name="CRWorkerRole">
<Instances count="2" />
<ConfigurationSettings>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="ComplianceRecordingBot" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="6" osVersion="*" schemaVersion="2015-04.2.6">
<ServiceConfiguration serviceName="PolicyRecordingBot" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="6" osVersion="*" schemaVersion="2015-04.2.6">
<Role name="CRWorkerRole">
<Instances count="1" />
<ConfigurationSettings>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="ComplianceRecordingBot" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
<ServiceDefinition name="PolicyRecordingBot" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
<WorkerRole name="CRWorkerRole" vmsize="Standard_D3_v2">
<Runtime executionContext="elevated" />
<Startup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample.ComplianceRecordingBot.WorkerRole
namespace Sample.PolicyRecordingBot.WorkerRole
{
using System;
using System.Collections.Generic;
Expand All @@ -21,8 +21,8 @@ namespace Sample.ComplianceRecordingBot.WorkerRole
using Microsoft.Graph.Communications.Common.Telemetry;
using Microsoft.Skype.Bots.Media;
using Microsoft.WindowsAzure.ServiceRuntime;
using Sample.ComplianceRecordingBot.FrontEnd;
using Sample.ComplianceRecordingBot.FrontEnd.Http;
using Sample.PolicyRecordingBot.FrontEnd;
using Sample.PolicyRecordingBot.FrontEnd.Http;

/// <summary>
/// Reads the Configuration from service Configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<ProjectGuid>{EAF11F22-C267-4C02-820D-12B622FEBFC1}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sample.ComplianceRecordingBot.WorkerRole</RootNamespace>
<AssemblyName>Sample.ComplianceRecordingBot.WorkerRole</AssemblyName>
<RootNamespace>Sample.PolicyRecordingBot.WorkerRole</RootNamespace>
<AssemblyName>Sample.PolicyRecordingBot.WorkerRole</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample.ComplianceRecordingBot.WorkerRole
namespace Sample.PolicyRecordingBot.WorkerRole
{
using System;

Expand Down
Loading

0 comments on commit 06dfb4f

Please sign in to comment.