This commit is contained in:
jdevito
2021-08-17 22:52:54 +00:00
committed by GitHub
2 changed files with 955 additions and 846 deletions

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces
@@ -15,7 +16,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces
/// <summary> /// <summary>
/// Describes the ability to mute and unmute a participant's video in a meeting /// Describes the ability to mute and unmute a participant's video in a meeting
/// </summary> /// </summary>
public interface IHasParticipantVideoMute:IHasParticipants public interface IHasParticipantVideoMute : IHasParticipants
{ {
void MuteVideoForParticipant(int userId); void MuteVideoForParticipant(int userId);
void UnmuteVideoForParticipant(int userId); void UnmuteVideoForParticipant(int userId);
@@ -49,7 +50,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces
{ {
private List<Participant> _currentParticipants; private List<Participant> _currentParticipants;
public List<Participant> CurrentParticipants { public List<Participant> CurrentParticipants
{
get { return _currentParticipants; } get { return _currentParticipants; }
set set
{ {

View File

@@ -3,13 +3,11 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.Reflection;
using Crestron.SimplSharpPro.CrestronThread; using Crestron.SimplSharpPro.CrestronThread;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Core.Intersystem.Tokens;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
@@ -26,7 +24,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
public class ZoomRoom : VideoCodecBase, IHasCodecSelfView, IHasDirectoryHistoryStack, ICommunicationMonitor, public class ZoomRoom : VideoCodecBase, IHasCodecSelfView, IHasDirectoryHistoryStack, ICommunicationMonitor,
IRouting, IRouting,
IHasScheduleAwareness, IHasCodecCameras, IHasParticipants, IHasCameraOff, IHasCameraMute, IHasCameraAutoMode, IHasScheduleAwareness, IHasCodecCameras, IHasParticipants, IHasCameraOff, IHasCameraMute, IHasCameraAutoMode,
IHasFarEndContentStatus, IHasSelfviewPosition, IHasPhoneDialing, IHasZoomRoomLayouts, IHasParticipantPinUnpin, IHasParticipantAudioMute, IHasSelfviewSize IHasFarEndContentStatus, IHasSelfviewPosition, IHasPhoneDialing, IHasZoomRoomLayouts, IHasParticipantPinUnpin,
IHasParticipantAudioMute, IHasSelfviewSize
{ {
private const long MeetingRefreshTimer = 60000; private const long MeetingRefreshTimer = 60000;
private const uint DefaultMeetingDurationMin = 30; private const uint DefaultMeetingDurationMin = 30;
@@ -83,7 +82,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
PhonebookSyncState = new CodecPhonebookSyncState(Key + "--PhonebookSync"); PhonebookSyncState = new CodecPhonebookSyncState(Key + "--PhonebookSync");
PortGather = new CommunicationGather(Communication, "\x0A") { IncludeDelimiter = true }; PortGather = new CommunicationGather(Communication, "\x0A") {IncludeDelimiter = true};
PortGather.LineReceived += Port_LineReceived; PortGather.LineReceived += Port_LineReceived;
CodecOsdIn = new RoutingInputPort(RoutingPortNames.CodecOsd, CodecOsdIn = new RoutingInputPort(RoutingPortNames.CodecOsd,
@@ -138,7 +137,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
ContentSwappedWithThumbnailFeedback = new BoolFeedback(ContentSwappedWithThumbnailFeedbackFunc); ContentSwappedWithThumbnailFeedback = new BoolFeedback(ContentSwappedWithThumbnailFeedbackFunc);
NumberOfScreensFeedback = new IntFeedback(NumberOfScreensFeedbackFunc); NumberOfScreensFeedback = new IntFeedback(NumberOfScreensFeedbackFunc);
} }
public CommunicationGather PortGather { get; private set; } public CommunicationGather PortGather { get; private set; }
@@ -163,7 +161,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
if (Configuration.Audio.Output.Volume != 0) if (Configuration.Audio.Output.Volume != 0)
{ {
Debug.Console(2, this, "Storing previous volume level as: {0}, scaled: {1}", Configuration.Audio.Output.Volume, scaledVol); Debug.Console(2, this, "Storing previous volume level as: {0}, scaled: {1}", Configuration.Audio.Output.Volume,
scaledVol);
_previousVolumeLevel = scaledVol; // Store the previous level for recall _previousVolumeLevel = scaledVol; // Store the previous level for recall
} }
@@ -370,7 +369,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
{ {
_currentDirectoryResult = value; _currentDirectoryResult = value;
Debug.Console(2, this, "CurrentDirectoryResult Updated. ResultsFolderId: {0}", _currentDirectoryResult.ResultsFolderId); Debug.Console(2, this, "CurrentDirectoryResult Updated. ResultsFolderId: {0}",
_currentDirectoryResult.ResultsFolderId);
CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate(); CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate();
@@ -390,12 +390,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
DirectoryBrowseHistoryStack.Clear(); DirectoryBrowseHistoryStack.Clear();
CurrentDirectoryResult = directoryResults; CurrentDirectoryResult = directoryResults;
} }
public void GetDirectoryFolderContents(string folderId) public void GetDirectoryFolderContents(string folderId)
{ {
var directoryResults = new CodecDirectory { ResultsFolderId = folderId }; var directoryResults = new CodecDirectory {ResultsFolderId = folderId};
directoryResults.AddContactsToDirectory( directoryResults.AddContactsToDirectory(
DirectoryRoot.CurrentDirectoryResults.FindAll(c => c.ParentFolderId.Equals(folderId))); DirectoryRoot.CurrentDirectoryResults.FindAll(c => c.ParentFolderId.Equals(folderId)));
@@ -403,7 +402,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
DirectoryBrowseHistoryStack.Push(_currentDirectoryResult); DirectoryBrowseHistoryStack.Push(_currentDirectoryResult);
CurrentDirectoryResult = directoryResults; CurrentDirectoryResult = directoryResults;
} }
public void SetCurrentDirectoryToRoot() public void SetCurrentDirectoryToRoot()
@@ -560,12 +558,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
break; break;
} }
} }
}; };
// This is to deal with incorrect object structure coming back from the Zoom Room on v 5.6.3 // This is to deal with incorrect object structure coming back from the Zoom Room on v 5.6.3
Configuration.Client.Call.Layout.PropertyChanged += (o,a) => Configuration.Client.Call.Layout.PropertyChanged += (o, a) =>
{ {
switch (a.PropertyName) switch (a.PropertyName)
{ {
@@ -587,7 +584,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
LocalLayoutFeedback.FireUpdate(); LocalLayoutFeedback.FireUpdate();
break; break;
} }
} }
}; };
@@ -689,7 +685,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
private void SetUpDirectory() private void SetUpDirectory()
{ {
DirectoryRoot = new CodecDirectory() { ResultsFolderId = "root" }; DirectoryRoot = new CodecDirectory() {ResultsFolderId = "root"};
CurrentDirectoryResultIsNotDirectoryRoot = new BoolFeedback(() => CurrentDirectoryResult.ResultsFolderId != "root"); CurrentDirectoryResultIsNotDirectoryRoot = new BoolFeedback(() => CurrentDirectoryResult.ResultsFolderId != "root");
@@ -697,7 +693,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
DirectoryBrowseHistory = new List<CodecDirectory>(); DirectoryBrowseHistory = new List<CodecDirectory>();
DirectoryBrowseHistoryStack = new Stack<CodecDirectory>(); DirectoryBrowseHistoryStack = new Stack<CodecDirectory>();
} }
private void SetUpRouting() private void SetUpRouting()
@@ -772,12 +767,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
if (s == "1") if (s == "1")
{ {
CommDebuggingIsOn = true; CommDebuggingIsOn = true;
Debug.Console(0, this, "Comm Debug Enabled."); Debug.Console(1, this, "Comm Debug Enabled.");
} }
else else
{ {
CommDebuggingIsOn = false; CommDebuggingIsOn = false;
Debug.Console(0, this, "Comm Debug Disabled."); Debug.Console(1, this, "Comm Debug Disabled.");
} }
} }
@@ -885,7 +880,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
// Counts the curly braces // Counts the curly braces
if (message.Contains("client_loop: send disconnect: Broken pipe")) if (message.Contains("client_loop: send disconnect: Broken pipe"))
{ {
Debug.Console(0, this, Debug.ErrorLogLevel.Error, Debug.Console(1, this, Debug.ErrorLogLevel.Error,
"Zoom Room Controller or App connected. Essentials will NOT control the Zoom Room until it is disconnected."); "Zoom Room Controller or App connected. Essentials will NOT control the Zoom Room until it is disconnected.");
return; return;
@@ -1015,7 +1010,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
var eType = var eType =
(eZoomRoomResponseType) (eZoomRoomResponseType)
Enum.Parse(typeof(eZoomRoomResponseType), message["type"].Value<string>(), true); Enum.Parse(typeof (eZoomRoomResponseType), message["type"].Value<string>(), true);
var topKey = message["topKey"].Value<string>(); var topKey = message["topKey"].Value<string>();
@@ -1119,6 +1114,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
if (participant != null) if (participant != null)
{ {
Debug.Console(1, this,
"[DeserializeResponse] zCommands.listparticipantresult - participant.event: {0} **********************************",
participant.Event);
Debug.Console(1, this,
"[DeserializeResponse] zCommands.listparticipantresult - participant.event: {0} - UserId: {1} Name: {2} IsHost: {3}",
participant.Event, participant.UserId, participant.UserName, participant.IsHost);
switch (participant.Event) switch (participant.Event)
{ {
case "ZRCUserChangedEventUserInfoUpdated": case "ZRCUserChangedEventUserInfoUpdated":
@@ -1144,10 +1146,35 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
} }
break; break;
case "ZRCUserChangedEventJoinedMeeting": case "ZRCUserChangedEventJoinedMeeting":
{
var existingParticipant =
Status.Call.Participants.FirstOrDefault(p => p.UserId.Equals(participant.UserId));
if (existingParticipant != null)
{
Debug.Console(1, this,
"[DeserializeResponse] zCommands.listparticipantresult - participant.event: {0} ...updating matching UserId participant with UserId: {1} UserName: {2}",
participant.Event, participant.UserId, participant.UserName);
JsonConvert.PopulateObject(responseObj.ToString(), existingParticipant);
}
else
{
Debug.Console(1, this,
"[DeserializeResponse] zCommands.listparticipantresult - participant.event: {0} ...adding participant with UserId: {1} UserName: {2}",
participant.Event, participant.UserId, participant.UserName);
Status.Call.Participants.Add(participant); Status.Call.Participants.Add(participant);
}
break; break;
} }
} }
Debug.Console(1, this,
"[DeserializeResponse] zCommands.listparticipantresult - participant.event: {0} ***********************************",
participant.Event);
}
} }
break; break;
} }
@@ -1157,7 +1184,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
Status.Call.Participants); Status.Call.Participants);
Participants.CurrentParticipants = participants; Participants.CurrentParticipants = participants;
PrintCurrentCallParticipants(); PrintCurrentCallParticipants();
break; break;
@@ -1291,6 +1317,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
var disconnectEvent = var disconnectEvent =
JsonConvert.DeserializeObject<zEvent.CallDisconnect>(responseObj.ToString()); JsonConvert.DeserializeObject<zEvent.CallDisconnect>(responseObj.ToString());
Debug.Console(1, this,
"[DeserializeResponse] zEvent.calldisconnect ********************************************");
Debug.Console(1, this, "[DeserializeResponse] zEvent.calldisconnect - disconnectEvent.Successful: {0}",
disconnectEvent.Successful);
if (disconnectEvent.Successful) if (disconnectEvent.Successful)
{ {
if (ActiveCalls.Count > 0) if (ActiveCalls.Count > 0)
@@ -1299,15 +1330,19 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
if (activeCall != null) if (activeCall != null)
{ {
Debug.Console(1, this,
"[DeserializeResponse] zEvent.calldisconnect - ActiveCalls.Count: {0} activeCall.Id: {1}, activeCall.Number: {2} activeCall.Name: {3}, activeCall.IsActive: {4}",
ActiveCalls.Count, activeCall.Id, activeCall.Number, activeCall.Name, activeCall.IsActiveCall);
activeCall.Status = eCodecCallStatus.Disconnected; activeCall.Status = eCodecCallStatus.Disconnected;
OnCallStatusChange(activeCall); OnCallStatusChange(activeCall);
} }
} }
var emptyList = new List<Participant>();
Participants.CurrentParticipants = emptyList;
} }
Debug.Console(1, this,
"[DeserializeResponse] zEvent.calldisconnect ********************************************");
UpdateCallStatus(); UpdateCallStatus();
break; break;
} }
@@ -1358,20 +1393,23 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
{ {
var status = responseObj.ToObject<zEvent.PinStatusOfScreenNotification>(); var status = responseObj.ToObject<zEvent.PinStatusOfScreenNotification>();
Debug.Console(1, this, "Pin Status notification for UserId: {0}, ScreenIndex: {1}", status.PinnedUserId, status.ScreenIndex); Debug.Console(1, this, "Pin Status notification for UserId: {0}, ScreenIndex: {1}", status.PinnedUserId,
status.ScreenIndex);
Participant alreadyPinnedParticipant = null; Participant alreadyPinnedParticipant = null;
// Check for a participant already pinned to the same screen index. // Check for a participant already pinned to the same screen index.
if (status.PinnedUserId > 0) if (status.PinnedUserId > 0)
{ {
alreadyPinnedParticipant = Participants.CurrentParticipants.FirstOrDefault(p => p.ScreenIndexIsPinnedToFb.Equals(status.ScreenIndex)); alreadyPinnedParticipant =
Participants.CurrentParticipants.FirstOrDefault(p => p.ScreenIndexIsPinnedToFb.Equals(status.ScreenIndex));
// Make sure that the already pinned participant isn't the same ID as for this message. If true, clear the pinned fb. // Make sure that the already pinned participant isn't the same ID as for this message. If true, clear the pinned fb.
if (alreadyPinnedParticipant != null && alreadyPinnedParticipant.UserId != status.PinnedUserId) if (alreadyPinnedParticipant != null && alreadyPinnedParticipant.UserId != status.PinnedUserId)
{ {
Debug.Console(1, this, "Participant: {0} with id: {1} already pinned to screenIndex {2}. Clearing pinned fb.", Debug.Console(1, this, "Participant: {0} with id: {1} already pinned to screenIndex {2}. Clearing pinned fb.",
alreadyPinnedParticipant.Name, alreadyPinnedParticipant.UserId, alreadyPinnedParticipant.ScreenIndexIsPinnedToFb); alreadyPinnedParticipant.Name, alreadyPinnedParticipant.UserId,
alreadyPinnedParticipant.ScreenIndexIsPinnedToFb);
alreadyPinnedParticipant.IsPinnedFb = false; alreadyPinnedParticipant.IsPinnedFb = false;
alreadyPinnedParticipant.ScreenIndexIsPinnedToFb = -1; alreadyPinnedParticipant.ScreenIndexIsPinnedToFb = -1;
} }
@@ -1386,16 +1424,19 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
} }
else else
{ {
participant = Participants.CurrentParticipants.FirstOrDefault(p => p.ScreenIndexIsPinnedToFb.Equals(status.ScreenIndex)); participant =
Participants.CurrentParticipants.FirstOrDefault(p => p.ScreenIndexIsPinnedToFb.Equals(status.ScreenIndex));
if (participant == null && alreadyPinnedParticipant == null) if (participant == null && alreadyPinnedParticipant == null)
{ {
Debug.Console(1, this, "no matching participant found by pinned_user_id: {0} or screen_index: {1}", status.PinnedUserId, status.ScreenIndex); Debug.Console(1, this, "no matching participant found by pinned_user_id: {0} or screen_index: {1}",
status.PinnedUserId, status.ScreenIndex);
return; return;
} }
else if (participant != null) else if (participant != null)
{ {
Debug.Console(2, this, "Unpinning {0} with id: {1} from screen index: {2}", participant.Name, participant.UserId, status.ScreenIndex); Debug.Console(2, this, "Unpinning {0} with id: {1} from screen index: {2}", participant.Name,
participant.UserId, status.ScreenIndex);
participant.IsPinnedFb = false; participant.IsPinnedFb = false;
participant.ScreenIndexIsPinnedToFb = -1; participant.ScreenIndexIsPinnedToFb = -1;
} }
@@ -1440,6 +1481,16 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
{ {
JsonConvert.PopulateObject(responseObj.ToString(), Status.Call); JsonConvert.PopulateObject(responseObj.ToString(), Status.Call);
Debug.Console(1, this,
"[DeserializeResponse] zStatus.call - Status.Call.Info.meeting_id: {0} Status.Call.Info.meeting_list_item.meetingName: {1}",
Status.Call.Info.meeting_id, Status.Call.Info.meeting_list_item.meetingName);
foreach (var participant in Status.Call.Participants)
{
Debug.Console(1, this,
"[DeserializeResponse] zStatus.call - Status.Call.Participants participant.UserId: {0} participant.UserName: {1}",
participant.UserId, participant.UserName);
}
UpdateCallStatus(); UpdateCallStatus();
break; break;
@@ -1535,18 +1586,26 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
} }
} }
/// <summary>
/// Retrieves the current call participants list
/// </summary>
public void GetCurrentCallParticipants()
{
SendText("zCommand Call ListParticipants");
}
/// <summary>
/// Prints the current call particiapnts list
/// </summary>
public void PrintCurrentCallParticipants() public void PrintCurrentCallParticipants()
{ {
if (Debug.Level <= 0) if (Debug.Level <= 0) return;
{
return;
}
Debug.Console(1, this, "*************************** Call Participants **************************"); Debug.Console(1, this, "*************************** Call Participants **************************");
foreach (var participant in Participants.CurrentParticipants) foreach (var participant in Participants.CurrentParticipants)
{ {
Debug.Console(1, this, "Name: {0} Audio: {1} IsHost: {2}", participant.Name, Debug.Console(1, this, "UserId: {3} Name: {0} Audio: {1} IsHost: {2}",
participant.AudioMuteFb, participant.IsHost); participant.Name, participant.AudioMuteFb, participant.IsHost, participant.UserId);
} }
Debug.Console(1, this, "************************************************************************"); Debug.Console(1, this, "************************************************************************");
} }
@@ -1566,19 +1625,19 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
private void UpdateCallStatus() private void UpdateCallStatus()
{ {
Debug.Console(1, this, "[UpdateCallStatus] Current Call Status: {0}", Debug.Console(1, this, "[UpdateCallStatus] Current Call Status: {0}",
Status.Call != null ? Status.Call.Sharing.State.ToString() : "no call"); Status.Call != null ? Status.Call.Status.ToString() : "no call");
if (Status.Call != null) if (Status.Call != null)
{ {
var callStatus = Status.Call.Status; var callStatus = Status.Call.Status;
// If not currently in a meeting, intialize the call object // If not crrently in a meeting, intialize the call object
if (callStatus != zStatus.eCallStatus.IN_MEETING && callStatus != zStatus.eCallStatus.CONNECTING_MEETING) if (callStatus != zStatus.eCallStatus.IN_MEETING && callStatus != zStatus.eCallStatus.CONNECTING_MEETING)
{ {
Debug.Console(1, this, "Creating new Status.Call object"); Debug.Console(1, this, "[UpdateCallStatus] Creating new Status.Call object");
Status.Call = new zStatus.Call { Status = callStatus }; Status.Call = new zStatus.Call {Status = callStatus};
OnCallStatusChange( new CodecActiveCallItem() { Status = eCodecCallStatus.Disconnected }); OnCallStatusChange(new CodecActiveCallItem() {Status = eCodecCallStatus.Disconnected});
SetUpCallFeedbackActions(); SetUpCallFeedbackActions();
} }
@@ -1600,10 +1659,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
break; break;
} }
if (!string.IsNullOrEmpty(Status.Call.Info.meeting_id))
{
var newCall = new CodecActiveCallItem var newCall = new CodecActiveCallItem
{ {
Name = Status.Call.Info.meeting_list_item.meetingName, Name = Status.Call.Info.meeting_list_item.meetingName,
Number = Status.Call.Info.meeting_id, Number = Status.Call.Info.meeting_list_item.meetingNumber,
Id = Status.Call.Info.meeting_id, Id = Status.Call.Info.meeting_id,
Status = newStatus, Status = newStatus,
Type = eCodecCallType.Video, Type = eCodecCallType.Video,
@@ -1611,13 +1672,17 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
ActiveCalls.Add(newCall); ActiveCalls.Add(newCall);
Debug.Console(1, this, "[UpdateCallStatus] Current Call Status: {0}", Debug.Console(1, this, "[UpdateCallStatus] IF w/ meeting_id AcitveCalls.Count == {1} - Current Call Status: {0}",
Status.Call != null ? Status.Call.Sharing.State.ToString() : "no call"); Status.Call != null ? Status.Call.Status.ToString() : "no call", ActiveCalls.Count);
OnCallStatusChange(newCall); OnCallStatusChange(newCall);
} }
else
{
Debug.Console(1, this, "[UpdateCallStatus] IF w/o meeting_id AcitveCalls.Count == {1} - Current Call Status: {0}",
Status.Call != null ? Status.Call.Status.ToString() : "no call", ActiveCalls.Count);
}
}
} }
else else
{ {
@@ -1633,14 +1698,14 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
break; break;
} }
Debug.Console(1, this, "[UpdateCallStatus] Current Call Status: {0}", Debug.Console(1, this, "[UpdateCallStatus] ELSE ActiveCalls.Count == {1} - Current Call Status: {0}",
Status.Call != null ? Status.Call.Sharing.State.ToString() : "no call"); Status.Call != null ? Status.Call.Status.ToString() : "no call", ActiveCalls.Count);
OnCallStatusChange(existingCall); OnCallStatusChange(existingCall);
} }
} }
Debug.Console(1, this, "*************************** Active Calls ********************************"); Debug.Console(1, this, "[UpdateCallStatus] Active Calls ------------------------------");
// Clean up any disconnected calls left in the list // Clean up any disconnected calls left in the list
for (int i = 0; i < ActiveCalls.Count; i++) for (int i = 0; i < ActiveCalls.Count; i++)
@@ -1648,26 +1713,27 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
var call = ActiveCalls[i]; var call = ActiveCalls[i];
Debug.Console(1, this, Debug.Console(1, this,
@"Name: {0} @"ID: {1}
ID: {1} Number: {5}
Name: {0}
IsActive: {2} IsActive: {2}
Status: {3} Status: {3}
Direction: {4}", call.Name, call.Id, call.IsActiveCall, call.Status, call.Direction); Direction: {4}
IsActiveCall: {6}", call.Name, call.Id, call.IsActiveCall, call.Status, call.Direction, call.Number,
call.IsActiveCall);
if (!call.IsActiveCall) if (!call.IsActiveCall)
{ {
Debug.Console(1, this, "***** Removing Inactive Call: {0} *****", call.Name); Debug.Console(1, this, "[UpdateCallStatus] Removing Inactive call.Id: {1} call.Name: {0}", call.Name, call.Id);
ActiveCalls.Remove(call); ActiveCalls.Remove(call);
} }
} }
Debug.Console(1, this, "**************************************************************************"); Debug.Console(1, this, "[UpdateCallStatus] Active Calls ------------------------------");
//clear participants list after call cleanup //clear participants list after call cleanup
if (ActiveCalls.Count == 0)
{
var emptyList = new List<Participant>(); var emptyList = new List<Participant>();
Participants.CurrentParticipants = emptyList; Participants.CurrentParticipants = emptyList;
} if (ActiveCalls.Count > 0) GetCurrentCallParticipants();
} }
protected override void OnCallStatusChange(CodecActiveCallItem item) protected override void OnCallStatusChange(CodecActiveCallItem item)
@@ -1675,7 +1741,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
base.OnCallStatusChange(item); base.OnCallStatusChange(item);
Debug.Console(1, this, "[OnCallStatusChange] Current Call Status: {0}", Debug.Console(1, this, "[OnCallStatusChange] Current Call Status: {0}",
Status.Call != null ? Status.Call.Sharing.State.ToString() : "no call"); Status.Call != null ? Status.Call.Status.ToString() : "no call");
if (_props.AutoDefaultLayouts) if (_props.AutoDefaultLayouts)
{ {
@@ -1721,12 +1787,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
public override void MuteOff() public override void MuteOff()
{ {
Debug.Console(2, this, "Unmuting to previous level: {0}", _previousVolumeLevel); Debug.Console(2, this, "Unmuting to previous level: {0}", _previousVolumeLevel);
SetVolume((ushort)_previousVolumeLevel); SetVolume((ushort) _previousVolumeLevel);
} }
public override void MuteOn() public override void MuteOn()
{ {
SetVolume(0); SetVolume(0);
} }
@@ -1828,13 +1893,20 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
layoutsCodec.AvailableLayoutsChanged += (o, a) => layoutsCodec.AvailableLayoutsChanged += (o, a) =>
{ {
trilist.SetBool(joinMap.LayoutGalleryIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.Gallery trilist.SetBool(joinMap.LayoutGalleryIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.Gallery
== (a.AvailableLayouts & zConfiguration.eLayoutStyle.Gallery)); ==
(a.AvailableLayouts &
zConfiguration.eLayoutStyle.Gallery));
trilist.SetBool(joinMap.LayoutSpeakerIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.Speaker trilist.SetBool(joinMap.LayoutSpeakerIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.Speaker
== (a.AvailableLayouts & zConfiguration.eLayoutStyle.Speaker)); ==
(a.AvailableLayouts &
zConfiguration.eLayoutStyle.Speaker));
trilist.SetBool(joinMap.LayoutStripIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.Strip trilist.SetBool(joinMap.LayoutStripIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.Strip
== (a.AvailableLayouts & zConfiguration.eLayoutStyle.Strip)); ==
(a.AvailableLayouts & zConfiguration.eLayoutStyle.Strip));
trilist.SetBool(joinMap.LayoutShareAllIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.ShareAll trilist.SetBool(joinMap.LayoutShareAllIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.ShareAll
== (a.AvailableLayouts & zConfiguration.eLayoutStyle.ShareAll)); ==
(a.AvailableLayouts &
zConfiguration.eLayoutStyle.ShareAll));
// pass the names used to set the layout through the bridge // pass the names used to set the layout through the bridge
trilist.SetString(joinMap.LayoutGalleryIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.Gallery.ToString()); trilist.SetString(joinMap.LayoutGalleryIsAvailable.JoinNumber, zConfiguration.eLayoutStyle.Gallery.ToString());
@@ -1845,10 +1917,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
trilist.SetSigFalseAction(joinMap.SwapContentWithThumbnail.JoinNumber, () => layoutsCodec.SwapContentWithThumbnail()); trilist.SetSigFalseAction(joinMap.SwapContentWithThumbnail.JoinNumber, () => layoutsCodec.SwapContentWithThumbnail());
layoutsCodec.CanSwapContentWithThumbnailFeedback.LinkInputSig(trilist.BooleanInput[joinMap.CanSwapContentWithThumbnail.JoinNumber]); layoutsCodec.CanSwapContentWithThumbnailFeedback.LinkInputSig(
layoutsCodec.ContentSwappedWithThumbnailFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SwapContentWithThumbnail.JoinNumber]); trilist.BooleanInput[joinMap.CanSwapContentWithThumbnail.JoinNumber]);
layoutsCodec.ContentSwappedWithThumbnailFeedback.LinkInputSig(
trilist.BooleanInput[joinMap.SwapContentWithThumbnail.JoinNumber]);
layoutsCodec.LayoutViewIsOnFirstPageFeedback.LinkInputSig(trilist.BooleanInput[joinMap.LayoutIsOnFirstPage.JoinNumber]); layoutsCodec.LayoutViewIsOnFirstPageFeedback.LinkInputSig(
trilist.BooleanInput[joinMap.LayoutIsOnFirstPage.JoinNumber]);
layoutsCodec.LayoutViewIsOnLastPageFeedback.LinkInputSig(trilist.BooleanInput[joinMap.LayoutIsOnLastPage.JoinNumber]); layoutsCodec.LayoutViewIsOnLastPageFeedback.LinkInputSig(trilist.BooleanInput[joinMap.LayoutIsOnLastPage.JoinNumber]);
trilist.SetSigFalseAction(joinMap.LayoutTurnToNextPage.JoinNumber, () => layoutsCodec.LayoutTurnNextPage()); trilist.SetSigFalseAction(joinMap.LayoutTurnToNextPage.JoinNumber, () => layoutsCodec.LayoutTurnNextPage());
trilist.SetSigFalseAction(joinMap.LayoutTurnToPreviousPage.JoinNumber, () => layoutsCodec.LayoutTurnPreviousPage()); trilist.SetSigFalseAction(joinMap.LayoutTurnToPreviousPage.JoinNumber, () => layoutsCodec.LayoutTurnPreviousPage());
@@ -1858,7 +1933,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
{ {
try try
{ {
var style = (zConfiguration.eLayoutStyle)Enum.Parse(typeof(zConfiguration.eLayoutStyle), s, true); var style = (zConfiguration.eLayoutStyle) Enum.Parse(typeof (zConfiguration.eLayoutStyle), s, true);
SetLayout(style); SetLayout(style);
} }
catch (Exception e) catch (Exception e)
@@ -1888,7 +1963,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
{ {
try try
{ {
var size = (zConfiguration.eLayoutSize)Enum.Parse(typeof(zConfiguration.eLayoutSize), s, true); var size = (zConfiguration.eLayoutSize) Enum.Parse(typeof (zConfiguration.eLayoutSize), s, true);
var cmd = SelfviewPipSizes.FirstOrDefault(c => c.Command.Equals(size.ToString())); var cmd = SelfviewPipSizes.FirstOrDefault(c => c.Command.Equals(size.ToString()));
SelfviewPipSizeSet(cmd); SelfviewPipSizeSet(cmd);
} }
@@ -2037,14 +2112,16 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
directoryResult.ResultsFolderId = result.ResultsFolderId; directoryResult.ResultsFolderId = result.ResultsFolderId;
directoryResult.AddFoldersToDirectory(result.Folders); directoryResult.AddFoldersToDirectory(result.Folders);
directoryResult.AddContactsToDirectory(result.Contacts.Where((c) => c.ParentFolderId == result.ResultsFolderId).ToList()); directoryResult.AddContactsToDirectory(
result.Contacts.Where((c) => c.ParentFolderId == result.ResultsFolderId).ToList());
} }
else else
{ {
directoryResult = result; directoryResult = result;
} }
Debug.Console(2, this, "Updating directoryResult. IsOnRoot: {0}", !CurrentDirectoryResultIsNotDirectoryRoot.BoolValue); Debug.Console(2, this, "Updating directoryResult. IsOnRoot: {0}",
!CurrentDirectoryResultIsNotDirectoryRoot.BoolValue);
// This will return the latest results to all UIs. Multiple indendent UI Directory browsing will require a different methodology // This will return the latest results to all UIs. Multiple indendent UI Directory browsing will require a different methodology
var handler = DirectoryResultReturned; var handler = DirectoryResultReturned;
@@ -2188,7 +2265,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
#region IHasParticipantPinUnpin Members #region IHasParticipantPinUnpin Members
private Func<int> NumberOfScreensFeedbackFunc { get { return () => Status.NumberOfScreens.NumOfScreens; } } private Func<int> NumberOfScreensFeedbackFunc
{
get { return () => Status.NumberOfScreens.NumOfScreens; }
}
public IntFeedback NumberOfScreensFeedback { get; private set; } public IntFeedback NumberOfScreensFeedback { get; private set; }
@@ -2330,6 +2410,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
#endregion #endregion
// TODO: #714 [ ] Implementation of IHasSelfviewPipSize // TODO: #714 [ ] Implementation of IHasSelfviewPipSize
#region Implementation of IHasSelfviewPipSize #region Implementation of IHasSelfviewPipSize
private CodecCommandWithLabel _currentSelfviewPipSize; private CodecCommandWithLabel _currentSelfviewPipSize;
@@ -2371,14 +2452,24 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
p => p.Command.ToLower().Equals(Configuration.Call.Layout.Size.ToString().ToLower())); p => p.Command.ToLower().Equals(Configuration.Call.Layout.Size.ToString().ToLower()));
} }
#endregion #endregion
#region Implementation of IHasPhoneDialing #region Implementation of IHasPhoneDialing
private Func<bool> PhoneOffHookFeedbackFunc { get { return () => Status.PhoneCall.OffHook; } } private Func<bool> PhoneOffHookFeedbackFunc
private Func<string> CallerIdNameFeedbackFunc { get { return () => Status.PhoneCall.PeerDisplayName; } } {
private Func<string> CallerIdNumberFeedbackFunc { get { return () => Status.PhoneCall.PeerNumber; } } get { return () => Status.PhoneCall.OffHook; }
}
private Func<string> CallerIdNameFeedbackFunc
{
get { return () => Status.PhoneCall.PeerDisplayName; }
}
private Func<string> CallerIdNumberFeedbackFunc
{
get { return () => Status.PhoneCall.PeerNumber; }
}
public BoolFeedback PhoneOffHookFeedback { get; private set; } public BoolFeedback PhoneOffHookFeedback { get; private set; }
public StringFeedback CallerIdNameFeedback { get; private set; } public StringFeedback CallerIdNameFeedback { get; private set; }
@@ -2405,10 +2496,25 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
public event EventHandler<LayoutInfoChangedEventArgs> AvailableLayoutsChanged; public event EventHandler<LayoutInfoChangedEventArgs> AvailableLayoutsChanged;
private Func<bool> LayoutViewIsOnFirstPageFeedbackFunc { get { return () => Status.Layout.is_In_First_Page; } } private Func<bool> LayoutViewIsOnFirstPageFeedbackFunc
private Func<bool> LayoutViewIsOnLastPageFeedbackFunc { get { return () => Status.Layout.is_In_Last_Page; } } {
private Func<bool> CanSwapContentWithThumbnailFeedbackFunc { get { return () => Status.Layout.can_Switch_Floating_Share_Content; } } get { return () => Status.Layout.is_In_First_Page; }
private Func<bool> ContentSwappedWithThumbnailFeedbackFunc { get { return () => Configuration.Call.Layout.ShareThumb; } } }
private Func<bool> LayoutViewIsOnLastPageFeedbackFunc
{
get { return () => Status.Layout.is_In_Last_Page; }
}
private Func<bool> CanSwapContentWithThumbnailFeedbackFunc
{
get { return () => Status.Layout.can_Switch_Floating_Share_Content; }
}
private Func<bool> ContentSwappedWithThumbnailFeedbackFunc
{
get { return () => Configuration.Call.Layout.ShareThumb; }
}
public BoolFeedback LayoutViewIsOnFirstPageFeedback { get; private set; } public BoolFeedback LayoutViewIsOnFirstPageFeedback { get; private set; }
@@ -2457,7 +2563,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
var handler = AvailableLayoutsChanged; var handler = AvailableLayoutsChanged;
if (handler != null) if (handler != null)
{ {
handler(this, new LayoutInfoChangedEventArgs() { AvailableLayouts = availableLayouts }); handler(this, new LayoutInfoChangedEventArgs() {AvailableLayouts = availableLayouts});
} }
AvailableLayouts = availableLayouts; AvailableLayouts = availableLayouts;
@@ -2478,7 +2584,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
{ {
if (CanSwapContentWithThumbnailFeedback.BoolValue) if (CanSwapContentWithThumbnailFeedback.BoolValue)
{ {
var oppositeValue = ContentSwappedWithThumbnailFeedback.BoolValue ? "on" : "off"; // Get the value based on the opposite of the current state var oppositeValue = ContentSwappedWithThumbnailFeedback.BoolValue ? "on" : "off";
// Get the value based on the opposite of the current state
// TODO: #697 [*] Need to verify the ternary above and make sure that the correct on/off value is being send based on the true/false value of the feedback // TODO: #697 [*] Need to verify the ternary above and make sure that the correct on/off value is being send based on the true/false value of the feedback
// to toggle the state // to toggle the state
SendText(String.Format("zConfiguration Call Layout ShareThumb: {0}", oppositeValue)); SendText(String.Format("zConfiguration Call Layout ShareThumb: {0}", oppositeValue));
@@ -2519,7 +2626,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
{ {
var currentLayout = LocalLayoutFeedback.StringValue; var currentLayout = LocalLayoutFeedback.StringValue;
var eCurrentLayout = (int)Enum.Parse(typeof(zConfiguration.eLayoutStyle), currentLayout, true); var eCurrentLayout = (int) Enum.Parse(typeof (zConfiguration.eLayoutStyle), currentLayout, true);
var nextLayout = GetNextLayout(eCurrentLayout); var nextLayout = GetNextLayout(eCurrentLayout);
@@ -2543,13 +2650,14 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
zConfiguration.eLayoutStyle nextLayout; zConfiguration.eLayoutStyle nextLayout;
if (((zConfiguration.eLayoutStyle)currentLayout & zConfiguration.eLayoutStyle.ShareAll) == zConfiguration.eLayoutStyle.ShareAll) if (((zConfiguration.eLayoutStyle) currentLayout & zConfiguration.eLayoutStyle.ShareAll) ==
zConfiguration.eLayoutStyle.ShareAll)
{ {
nextLayout = zConfiguration.eLayoutStyle.Gallery; nextLayout = zConfiguration.eLayoutStyle.Gallery;
} }
else else
{ {
nextLayout = (zConfiguration.eLayoutStyle)(currentLayout << 1); nextLayout = (zConfiguration.eLayoutStyle) (currentLayout << 1);
} }
if ((AvailableLayouts & nextLayout) == nextLayout) if ((AvailableLayouts & nextLayout) == nextLayout)
@@ -2558,7 +2666,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
} }
else else
{ {
return GetNextLayout((int)nextLayout); return GetNextLayout((int) nextLayout);
} }
} }
@@ -2573,7 +2681,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
} }
#endregion #endregion
} }
/// <summary> /// <summary>
@@ -2790,7 +2897,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
{ {
public ZoomRoomFactory() public ZoomRoomFactory()
{ {
TypeNames = new List<string> { "zoomroom" }; TypeNames = new List<string> {"zoomroom"};
} }
public override EssentialsDevice BuildDevice(DeviceConfig dc) public override EssentialsDevice BuildDevice(DeviceConfig dc)