mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 13:15:03 +00:00
Updated UpdateCallStatus method to fix call status references previously looking at Status.Call.Sharing.State. Added else statement to 'if(ActiveCalls.Count == 0)' used to cleanup after calls that refreshs the participant list. Added GetCurrentCallParticipant method used to poll the participant list.
This commit is contained in:
@@ -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
|
||||||
@@ -49,11 +50,16 @@ 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
|
||||||
{
|
{
|
||||||
_currentParticipants = value;
|
_currentParticipants = value;
|
||||||
|
foreach (var participant in _currentParticipants)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "[CurrentParticipants] participant UserId: {0} Name: {1} IsHost: {2}", participant.UserId, participant.Name, participant.IsHost);
|
||||||
|
}
|
||||||
OnParticipantsChanged();
|
OnParticipantsChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,6 +75,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces
|
|||||||
{
|
{
|
||||||
var handler = ParticipantsListHasChanged;
|
var handler = ParticipantsListHasChanged;
|
||||||
|
|
||||||
|
Debug.Console(1, "[OnParticipantsChanged] Event Fired - handler is {0}", handler == null ? "null" : "not null");
|
||||||
|
|
||||||
if (handler == null) return;
|
if (handler == null) return;
|
||||||
|
|
||||||
handler(this, new EventArgs());
|
handler(this, new EventArgs());
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO.Ports;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
@@ -763,12 +764,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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -876,7 +877,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;
|
||||||
@@ -1110,6 +1111,10 @@ 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":
|
||||||
@@ -1135,10 +1140,37 @@ 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));
|
||||||
|
|
||||||
|
// found matching 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);
|
||||||
|
|
||||||
|
//var emptyList = new List<Participant>();
|
||||||
|
//Participants.CurrentParticipants = emptyList;
|
||||||
|
|
||||||
|
//GetCurrentCallParticipants();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, this, "[DeserializeResponse] zCommands.listparticipantresult - participant.event: {0} ***********************************", participant.Event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1148,7 +1180,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
|||||||
Status.Call.Participants);
|
Status.Call.Participants);
|
||||||
|
|
||||||
Participants.CurrentParticipants = participants;
|
Participants.CurrentParticipants = participants;
|
||||||
|
|
||||||
PrintCurrentCallParticipants();
|
PrintCurrentCallParticipants();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -1282,6 +1313,9 @@ 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)
|
||||||
@@ -1290,15 +1324,20 @@ 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>();
|
var emptyList = new List<Participant>();
|
||||||
Participants.CurrentParticipants = emptyList;
|
Participants.CurrentParticipants = emptyList;
|
||||||
|
//Participants.OnParticipantsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, this, "[DeserializeResponse] zEvent.calldisconnect ********************************************");
|
||||||
|
|
||||||
UpdateCallStatus();
|
UpdateCallStatus();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1431,6 +1470,12 @@ 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;
|
||||||
@@ -1536,12 +1581,17 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
|||||||
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, "************************************************************************");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GetCurrentCallParticipants()
|
||||||
|
{
|
||||||
|
SendText("zCommand Call ListParticipants");
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves bookings list
|
/// Retrieves bookings list
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1557,16 +1607,18 @@ 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");
|
||||||
|
|
||||||
|
//var emptyList = new List<Participant>();
|
||||||
|
|
||||||
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 });
|
||||||
@@ -1591,24 +1643,34 @@ 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,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Participants.CurrentParticipants = emptyList;
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
//Participants.CurrentParticipants = emptyList;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1620,18 +1682,22 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
|||||||
existingCall.Status = eCodecCallStatus.Connected;
|
existingCall.Status = eCodecCallStatus.Connected;
|
||||||
break;
|
break;
|
||||||
case zStatus.eCallStatus.NOT_IN_MEETING:
|
case zStatus.eCallStatus.NOT_IN_MEETING:
|
||||||
|
//Participants.CurrentParticipants = emptyList;
|
||||||
existingCall.Status = eCodecCallStatus.Disconnected;
|
existingCall.Status = eCodecCallStatus.Disconnected;
|
||||||
break;
|
break;
|
||||||
|
//default:
|
||||||
|
// Participants.CurrentParticipants = emptyList;
|
||||||
|
// 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++)
|
||||||
@@ -1639,19 +1705,21 @@ 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)
|
if (ActiveCalls.Count == 0)
|
||||||
@@ -1659,6 +1727,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
|||||||
var emptyList = new List<Participant>();
|
var emptyList = new List<Participant>();
|
||||||
Participants.CurrentParticipants = emptyList;
|
Participants.CurrentParticipants = emptyList;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var emptyList = new List<Participant>();
|
||||||
|
Participants.CurrentParticipants = emptyList;
|
||||||
|
GetCurrentCallParticipants();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnCallStatusChange(CodecActiveCallItem item)
|
protected override void OnCallStatusChange(CodecActiveCallItem item)
|
||||||
@@ -1666,7 +1740,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)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user