diff --git a/Essentials Core/PepperDashEssentialsBase/Devices/CodecInterfaces.cs b/Essentials Core/PepperDashEssentialsBase/Devices/CodecInterfaces.cs index 49f02cfb..b1a0fb36 100644 --- a/Essentials Core/PepperDashEssentialsBase/Devices/CodecInterfaces.cs +++ b/Essentials Core/PepperDashEssentialsBase/Devices/CodecInterfaces.cs @@ -6,35 +6,6 @@ using Crestron.SimplSharp; namespace PepperDash.Essentials.Core { - /// - /// Requirements for a device that has dialing capabilities - /// - public interface IHasDialer - { - // Add requirements for Dialer functionality - - void Dial(string number); - void EndCall(object activeCall); - void EndAllCalls(); - void AcceptCall(); - void RejectCall(); - void SendDtmf(string digit); - - IntFeedback ActiveCallCountFeedback { get; } - BoolFeedback IncomingCallFeedback { get; } - - - - } - - /// - /// Defines minimum volume controls for a codec device with dialing capabilities - /// - public interface ICodecAudio : IBasicVolumeWithFeedback, IPrivacy - { - - } - /// /// Adds control of codec receive volume /// @@ -72,20 +43,4 @@ namespace PepperDash.Essentials.Core void PrivacyModeToggle(); BoolFeedback PrivacyModeIsOnFeedback { get; } } - - public interface IHasCallHistory - { - // Add recent calls list - } - - public interface IHasDirectory - { - - } - - public interface IHasObtp - { - - // Upcoming Meeting warning event - } } \ No newline at end of file diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs b/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs index 2063a546..b85b2089 100644 --- a/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs +++ b/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs @@ -1,18 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec - -{ - public class CodecActiveCallItem - { - public string Name { get; set; } - - public string Number { get; set; } - +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Devices.Common.Codec + +{ + public class CodecActiveCallItem + { + public string Name { get; set; } + + public string Number { get; set; } + public eCodecCallType Type { get; set; } public eCodecCallStatus Status { get; set; } @@ -21,21 +21,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec public string Id { get; set; } - public object CallMetaData { get; set; } - } - - public enum eCodecCallType - { - Unknown = 0, Audio, Video, AudioCanEscalate, ForwardAllCall + public object CallMetaData { get; set; } } - public enum eCodecCallStatus - { - Unknown = 0, Idle, Dialing, Ringing, Connecting, Connected, Disconnecting, Incoming, OnHold, EarlyMedia, Preserved, RemotePreserved, Disconnected - } - - public enum eCodecCallDirection - { - Unknown = 0, Incoming, Outgoing - } } \ No newline at end of file diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs.orig b/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs.orig new file mode 100644 index 00000000..46746037 --- /dev/null +++ b/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs.orig @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Devices.Common.Codec + +{ + public class CodecActiveCallItem + { + public string Name { get; set; } + + public string Number { get; set; } + +<<<<<<< HEAD:Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs + public eCodecCallType Type { get; set; } + + public eCodecCallStatus Status { get; set; } + + public string Id { get; set; } +======= + public eCodecCallType Type { get; set; } + + public eCodecCallStatus Status { get; set; } + + public string Id { get; set; } + + public object CallMetaData { get; set; } +>>>>>>> origin/feature/cisco-spark-2:Essentials Devices Common/Essentials Devices Common/VideoCodec/CodecActiveCallItem.cs + } + + public enum eCodecCallType + { + Unknown = 0, Audio, Video +<<<<<<< HEAD:Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs + } + + public enum eCodecCallStatus + { + Unknown = 0, Dialing, Connected, Incoming, OnHold, Disconnected +======= + } + + public enum eCodecCallStatus + { + Unknown = 0, Dialing, Connected, Incoming, OnHold, Disconnected +>>>>>>> origin/feature/cisco-spark-2:Essentials Devices Common/Essentials Devices Common/VideoCodec/CodecActiveCallItem.cs + } +} \ No newline at end of file diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallDirection.cs b/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallDirection.cs new file mode 100644 index 00000000..41d68eeb --- /dev/null +++ b/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallDirection.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Devices.Common.Codec + +{ + public enum eCodecCallDirection + { + Unknown = 0, Incoming, Outgoing + } +} \ No newline at end of file diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs b/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs new file mode 100644 index 00000000..c73fabe5 --- /dev/null +++ b/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Devices.Common.Codec + +{ + public enum eCodecCallStatus + { + Unknown = 0, + Idle, + Dialing, + Ringing, + Connecting, + Connected, + Disconnecting, + Incoming, + OnHold, + EarlyMedia, + Preserved, + RemotePreserved, + Disconnected + } + + public class CodecCallStatus + { + + /// + /// Takes the Cisco status and converts to the matching enum + /// + /// + /// + public static eCodecCallStatus ConvertToStatusEnum(string s) + { + switch (s) + { + case "Idle": + { + return eCodecCallStatus.Idle; + } + case "Dialling": + { + return eCodecCallStatus.Dialing; + } + case "Ringing": + { + return eCodecCallStatus.Ringing; + } + case "Connecting": + { + return eCodecCallStatus.Connecting; + } + case "Connected": + { + return eCodecCallStatus.Connected; + } + case "Disconnecting": + { + return eCodecCallStatus.Disconnecting; + } + case "Incoming": + { + return eCodecCallStatus.Incoming; + } + case "OnHold": + { + return eCodecCallStatus.OnHold; + } + case "EarlyMedia": + { + return eCodecCallStatus.EarlyMedia; + } + case "Preserved": + { + return eCodecCallStatus.Preserved; + } + case "RemotePreserved": + { + return eCodecCallStatus.RemotePreserved; + } + case "Disconnected": + { + return eCodecCallStatus.Disconnected; + } + default: + return eCodecCallStatus.Unknown; + } + } + } +} \ No newline at end of file diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallType.cs b/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallType.cs new file mode 100644 index 00000000..6c7ab627 --- /dev/null +++ b/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallType.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Devices.Common.Codec + +{ + public enum eCodecCallType + { + Unknown = 0, + Audio, + Video, + AudioCanEscalate, + ForwardAllCall + } + + public class CodecCallType + { + + /// + /// Takes the Cisco call type and converts to the matching enum + /// + /// + /// + public static eCodecCallType ConvertToTypeEnum(string s) + { + switch (s) + { + case "Audio": + { + return eCodecCallType.Audio; + } + case "Video": + { + return eCodecCallType.Video; + } + case "AudioCanEscalate": + { + return eCodecCallType.AudioCanEscalate; + } + case "ForwardAllCall": + { + return eCodecCallType.ForwardAllCall; + } + default: + return eCodecCallType.Unknown; + } + + } + + } +} \ No newline at end of file diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/iHasCallHistory.cs b/Essentials Devices Common/Essentials Devices Common/Codec/iHasCallHistory.cs new file mode 100644 index 00000000..90668fa4 --- /dev/null +++ b/Essentials Devices Common/Essentials Devices Common/Codec/iHasCallHistory.cs @@ -0,0 +1,184 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Devices.Common.Codec +{ + public interface IHasCallHistory + { + List RecentCalls { get; } + + void RemoveEntry(CallHistory.CallHistoryEntry entry); + } + + public enum eCodecOccurrenctType + { + Unknown = 0, + Placed, + Received, + NoAnswer + } + + public class CallHistory + { + + /// + /// Generic call history entry, not device specific + /// + public class CallHistoryEntry + { + public string DisplayName { get; set; } + public string CallBackNumber { get; set; } + public DateTime StartTime { get; set; } + public eCodecOccurrenctType OccurenceType { get; set; } + public string OccurrenceHistoryId { get; set; } + } + + /// + /// Converts a list of call history entries returned by a Cisco codec to the generic list type + /// + /// + /// + public static List ConvertCiscoCallHistoryToGeneric(List entries) + { + var genericEntries = new List(); + + foreach (CiscoCallHistory.Entry entry in entries) + { + genericEntries.Add(new CallHistoryEntry() + { + DisplayName = entry.DisplayName.Value, + CallBackNumber = entry.CallbackNumber.Value, + StartTime = entry.LastOccurrenceStartTime.Value, + OccurrenceHistoryId = entry.LastOccurrenceHistoryId.Value, + OccurenceType = ConvertToOccurenceTypeEnum(entry.OccurrenceType.Value) + }); + } + + return genericEntries; + + } + + /// + /// Takes the Cisco occurence type and converts it to the matching enum + /// + /// Entry { get; set; } + public ResultInfo ResultInfo { get; set; } + } + + public class CommandResponse + { + public CallHistoryRecentsResult CallHistoryRecentsResult { get; set; } + } + + public class RootObject + { + public CommandResponse CommandResponse { get; set; } + } + } +} \ No newline at end of file diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/iHasDialer.cs b/Essentials Devices Common/Essentials Devices Common/Codec/iHasDialer.cs index c19f6d44..9ec7ba71 100644 --- a/Essentials Devices Common/Essentials Devices Common/Codec/iHasDialer.cs +++ b/Essentials Devices Common/Essentials Devices Common/Codec/iHasDialer.cs @@ -24,5 +24,17 @@ namespace PepperDash.Essentials.Devices.Common.Codec IntFeedback ActiveCallCountFeedback { get; } BoolFeedback IncomingCallFeedback { get; } + } + + + public interface IHasDirectory + { + + } + + public interface IHasObtp + { + + // Upcoming Meeting warning event } } \ No newline at end of file diff --git a/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj b/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj index 35459fa8..fca8c23d 100644 --- a/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj +++ b/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj @@ -103,7 +103,11 @@ + + + + diff --git a/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs b/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs index 73f99579..fa622342 100644 --- a/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs +++ b/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs @@ -19,7 +19,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { enum eCommandType { SessionStart, SessionEnd, Command, GetStatus, GetConfiguration }; - public class CiscoCodec : VideoCodecBase + public class CiscoCodec : VideoCodecBase, IHasCallHistory { public IBasicCommunication Communication { get; private set; } public CommunicationGather PortGather { get; private set; } @@ -31,7 +31,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco public BoolFeedback RoomIsOccupiedFeedback { get; private set; } - public BoolFeedback PeopleCountFeedback { get; private set; } + public IntFeedback PeopleCountFeedback { get; private set; } public BoolFeedback SpeakerTrackIsOnFeedback { get; private set; } @@ -41,7 +41,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco private CiscoCodecConfiguration.RootObject CodecConfiguration; - private CiscoCodecStatus.RootObject CodecStatus; + private CiscoCodecStatus.RootObject CodecStatus; + + private CiscoCallHistory.RootObject CodecCallHistory; + + public List RecentCalls { get; private set; } //private CiscoCodecEvents.RootObject CodecEvent; @@ -72,11 +76,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco } } + /// + /// Gets the value of the currently shared source, or returns null + /// protected override Func SharingSourceFeedbackFunc { +#warning figure out how to return the key of the shared source somehow get - { - return () => "Todo"; + { + return () => "todo"; } } @@ -110,7 +118,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { return () => CodecStatus.Status.Cameras.SpeakerTrack.Status.BoolValue; } - } + } + + protected override Func ActiveCallCountFeedbackFunc + { + get { return () => ActiveCalls.Count; } + } //private HttpsClient Client; @@ -142,36 +155,61 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco public CiscoCodec(string key, string name, IBasicCommunication comm, int serverPort) : base(key, name) { - StandbyIsOnFeedback = new BoolFeedback(StandbyStateFeedbackFunc); + StandbyIsOnFeedback = new BoolFeedback(StandbyStateFeedbackFunc); + RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); + PeopleCountFeedback = new IntFeedback(PeopleCountFeedbackFunc); + SpeakerTrackIsOnFeedback = new BoolFeedback(SpeakerTrackIsOnFeedbackFunc); + Communication = comm; - SyncState = new CodecSyncState(key + "--sync"); + SyncState = new CodecSyncState(key + "--sync"); + + SyncState.InitialSyncCompleted += new EventHandler(SyncState_InitialSyncCompleted); PortGather = new CommunicationGather(Communication, Delimiter); PortGather.IncludeDelimiter = true; PortGather.LineReceived += this.Port_LineReceived; - //ServerPort = serverPort; - CodecObtp = new CiscoOneButtonToPush(); PhoneBook = new Corporate_Phone_Book(); CodecConfiguration = new CiscoCodecConfiguration.RootObject(); - CodecStatus = new CiscoCodecStatus.RootObject(); - - //CodecEvent = new CiscoCodecEvents.RootObject(); - - CodecStatus.Status.Audio.Volume.ValueChangedAction = VolumeLevelFeedback.FireUpdate; - CodecStatus.Status.Audio.VolumeMute.ValueChangedAction = MuteFeedback.FireUpdate; - CodecStatus.Status.Audio.Microphones.Mute.ValueChangedAction = PrivacyModeIsOnFeedback.FireUpdate; - CodecStatus.Status.Standby.State.ValueChangedAction = StandbyIsOnFeedback.FireUpdate; + CodecStatus = new CiscoCodecStatus.RootObject(); + + CodecCallHistory = new CiscoCallHistory.RootObject(); + + CodecStatus.Status.Audio.Volume.ValueChangedAction = VolumeLevelFeedback.FireUpdate; + CodecStatus.Status.Audio.VolumeMute.ValueChangedAction = MuteFeedback.FireUpdate; + CodecStatus.Status.Audio.Microphones.Mute.ValueChangedAction = PrivacyModeIsOnFeedback.FireUpdate; + CodecStatus.Status.Standby.State.ValueChangedAction = StandbyIsOnFeedback.FireUpdate; + CodecStatus.Status.RoomAnalytics.PeoplePresence.ValueChangedAction = RoomIsOccupiedFeedback.FireUpdate; + CodecStatus.Status.RoomAnalytics.PeopleCount.Current.ValueChangedAction = PeopleCountFeedback.FireUpdate; + CodecStatus.Status.Cameras.SpeakerTrack.Status.ValueChangedAction = SpeakerTrackIsOnFeedback.FireUpdate; + + //ServerPort = serverPort; //Client = new HttpsClient(); //Server = new HttpApiServer(); + } + + /// + /// Fires when initial codec sync is completed. Used to then send commands to get call history, phonebook, bookings, etc. + /// + /// + /// + void SyncState_InitialSyncCompleted(object sender, EventArgs e) + { + SendText("xCommand CallHistory Recents Limit: 20 Order: OccurrenceTime"); + + // Get bookings for the day + //SendText("xCommand Bookings List Days: 1 DayOffset: 0"); + + // Get Phonebook (determine local/corporate from config, and set results limit) + //SendText("xCommand Phonebook Search PhonebookType: {0} ContactType: Folder Limit: {0}", PhonebookType, PhonebookResultsLimit); } /// @@ -230,6 +268,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco prefix + "/Configuration" + Delimiter + prefix + "/Status/Audio" + Delimiter + prefix + "/Status/Call" + Delimiter + + prefix + "/Status/Conference/Presentation" + Delimiter + prefix + "/Status/Cameras/SpeakerTrack" + Delimiter + prefix + "/Status/RoomAnalytics" + Delimiter + prefix + "/Status/Standby" + Delimiter + @@ -312,30 +351,31 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco //Debug.Console(1, this, "Building JSON:\n{0}", JsonMessage.ToString()); return; + } + + if (!SyncState.InitialSyncComplete) + { + switch (args.Text.Trim().ToLower()) // remove the whitespace + { + case "*r login successful": + { + SendText("xPreferences outputmode json"); + break; + } + case "xpreferences outputmode json": + { + if (!SyncState.InitialStatusMessageWasReceived) + SendText("xStatus"); + break; + } + case "xfeedback register /event/calldisconnect": + { + SyncState.FeedbackRegistered(); + break; + } + } } - - if (!SyncState.InitialSyncComplete) - { - switch (args.Text.Trim().ToLower()) // remove the whitespace - { - case "*r login successful": - { - SendText("xPreferences outputmode json"); - break; - } - case "xpreferences outputmode json": - { - if(!SyncState.InitialStatusMessageWasReceived) - SendText("xStatus"); - break; - } - case "xfeedback register": - { - SyncState.FeedbackRegistered(); - break; - } - } - } + } public void SendText(string command) @@ -519,6 +559,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco if (response.IndexOf("\"Status\":{") > -1) { + // Status Message + // Check to see if this is a call status message received after the initial status message if(SyncState.InitialStatusMessageWasReceived && response.IndexOf("\"Call\":{") > -1) { @@ -536,15 +578,38 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { // If an existing call object is found with a matching ID, populate the existing call with the new data. // (must reserialize the object so that we can use PopulateObject() to overlay the new or updated properties on the existing object) - JsonConvert.PopulateObject(JsonConvert.SerializeObject(call), existingCall); + JsonConvert.PopulateObject(JsonConvert.SerializeObject(call), existingCall); + + var tempActiveCall = ActiveCalls.FirstOrDefault(c => c.Id.Equals(call.id)); + + // store previous status to pass to event handler + var previousStatus = tempActiveCall.Status; + + // Update properties of ActiveCallItem + tempActiveCall.Status = CodecCallStatus.ConvertToStatusEnum(call.Status.Value); + tempActiveCall.Type = CodecCallType.ConvertToTypeEnum(call.CallType.Value); + tempActiveCall.Name = call.DisplayName.Value; + + SetNewCallStatusAndFireCallStatusChange(previousStatus, tempActiveCall); } else { // Add the call - callStatus.Status.Call.Add(call); + callStatus.Status.Call.Add(call); + + var newCallItem = new CodecActiveCallItem() + { + Id = call.id, + Status = CodecCallStatus.ConvertToStatusEnum(call.Status.Value), + Name = call.DisplayName.Value, + Number = call.RemoteNumber.Value, + Type = CodecCallType.ConvertToTypeEnum(call.CallType.Value) + }; // Add a call to the ActiveCalls List - //ActiveCalls.Add(new CodecActiveCallItem() { Id = call.id, Status = call.Status.Value, Name = call.DisplayName.Value, Number = call.RemoteNumber.Value, Type = call.Status.Value.ToString() + ActiveCalls.Add(newCallItem); + + SetNewCallStatusAndFireCallStatusChange(newCallItem.Status, newCallItem); } // Handle call.status to determine if we need to fire an event notifying of an incoming call or a call disconnect @@ -562,6 +627,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco } else if (response.IndexOf("\"Configuration\":{") > -1) { + // Configuration Message + JsonConvert.PopulateObject(response, CodecConfiguration); if (!SyncState.InitialConfigurationMessageWasReceived) @@ -576,11 +643,36 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco } else if (response.IndexOf("\"Event\":{") > -1) { + // Event Message + CiscoCodecEvents.RootObject eventReceived = new CiscoCodecEvents.RootObject(); JsonConvert.PopulateObject(response, eventReceived); EvalutateEvent(eventReceived); + } + else if (response.IndexOf("\"CommandResponse\":{") > -1) + { + // CommandResponse Message + + if (response.IndexOf("\"CallHistoryRecentsResult\":{") > -1) + { + JsonConvert.PopulateObject(response, CodecCallHistory); + + RecentCalls = CallHistory.ConvertCiscoCallHistoryToGeneric(CodecCallHistory.CommandResponse.CallHistoryRecentsResult.Entry); + + if (Debug.Level == 1) + { + + Debug.Console(1, this, "RecentCalls:\n"); + + foreach (CallHistory.CallHistoryEntry entry in RecentCalls) + { + Debug.Console(1, this, "\nName: {0}\nNumber{1}\nStartTime{2}\nType{3}\n", entry.DisplayName, entry.CallBackNumber, entry.StartTime.ToString(), entry.OccurenceType); + } + } + } + } } @@ -588,7 +680,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { Debug.Console(1, this, "Error Deserializing feedback from codec: {0}", ex); } - } + } + /// /// Evaluates an event received from the codec @@ -598,12 +691,21 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { if (eventReceived.Event.CallDisconnect != null) { - var tempCall = CodecStatus.Status.Call.FirstOrDefault(c => c.id.Equals(eventReceived.Event.CallDisconnect.CallId)); + var tempCall = CodecStatus.Status.Call.FirstOrDefault(c => c.id.Equals(eventReceived.Event.CallDisconnect.CallId.Value)); if(tempCall != null) { - CodecStatus.Status.Call.Remove(tempCall); - + // Remove the call from the xStatus object + CodecStatus.Status.Call.Remove(tempCall); + + var tempActiveCall = ActiveCalls.FirstOrDefault(c => c.Id.Equals(eventReceived.Event.CallDisconnect.CallId.Value)); + + // Remove the call from the Active calls list + if (tempActiveCall != null) + ActiveCalls.Remove(tempActiveCall); + + // Notify of the call disconnection + SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, tempActiveCall); } } } @@ -798,22 +900,44 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco public void Reboot() { SendText("xCommand SystemUnit Boot Action: Restart"); + } + + public void RemoveEntry(CallHistory.CallHistoryEntry entry) + { + if (RecentCalls != null) + { + RecentCalls.Remove(entry); + } } - protected override Func ActiveCallCountFeedbackFunc - { - get { return () => 0; } - } + } /// /// Tracks the initial sycnronization state of the codec when making a connection /// public class CodecSyncState : IKeyed - { + { + bool _InitialSyncComplete; + + public event EventHandler InitialSyncCompleted; + public string Key { get; private set; } - public bool InitialSyncComplete { get; private set; } + public bool InitialSyncComplete + { + get { return _InitialSyncComplete; } + private set + { + if (value == true) + { + var handler = InitialSyncCompleted; + if (handler != null) + handler(this, new EventArgs()); + } + _InitialSyncComplete = value; + } + } public bool InitialStatusMessageWasReceived { get; private set; } diff --git a/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs.orig b/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs.orig index b29dad03..197e2315 100644 --- a/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs.orig +++ b/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs.orig @@ -13,6 +13,7 @@ using Cisco_SX80_Corporate_Phone_Book; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Routing; +using PepperDash.Essentials.Devices.Common.Codec; namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { @@ -28,6 +29,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco public BoolFeedback StandbyIsOnFeedback { get; private set; } + public BoolFeedback RoomIsOccupiedFeedback { get; private set; } + + public BoolFeedback PeopleCountFeedback { get; private set; } + + public BoolFeedback SpeakerTrackIsOnFeedback { get; private set; } + private CiscoOneButtonToPush CodecObtp; private Corporate_Phone_Book PhoneBook; @@ -36,7 +43,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco private CiscoCodecStatus.RootObject CodecStatus; +<<<<<<< HEAD private CiscoCodecEvents.RootObject CodecEvent; +======= + //private CiscoCodecEvents.RootObject CodecEvent; +>>>>>>> origin/feature/cisco-spark-2 /// /// Gets and returns the scaled volume of the codec @@ -67,12 +78,42 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco protected override Func SharingSourceFeedbackFunc { - get { return () => "Fix me fuckers"; } + get + { + return () => "Todo"; + } } protected override Func MuteFeedbackFunc { - get { return () => false; } + get + { + return () => CodecStatus.Status.Audio.VolumeMute.BoolValue; + } + } + + protected Func RoomIsOccupiedFeedbackFunc + { + get + { + return () => CodecStatus.Status.RoomAnalytics.PeoplePresence.BoolValue; + } + } + + protected Func PeopleCountFeedbackFunc + { + get + { + return () => CodecStatus.Status.RoomAnalytics.PeopleCount.Current.IntValue; + } + } + + protected Func SpeakerTrackIsOnFeedbackFunc + { + get + { + return () => CodecStatus.Status.Cameras.SpeakerTrack.Status.BoolValue; + } } //private HttpsClient Client; @@ -125,7 +166,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco CodecStatus = new CiscoCodecStatus.RootObject(); - CodecEvent = new CiscoCodecEvents.RootObject(); + //CodecEvent = new CiscoCodecEvents.RootObject(); CodecStatus.Status.Audio.Volume.ValueChangedAction = VolumeLevelFeedback.FireUpdate; CodecStatus.Status.Audio.VolumeMute.ValueChangedAction = MuteFeedback.FireUpdate; @@ -482,6 +523,38 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco if (response.IndexOf("\"Status\":{") > -1) { + // Check to see if this is a call status message received after the initial status message + if(SyncState.InitialStatusMessageWasReceived && response.IndexOf("\"Call\":{") > -1) + { + CiscoCodecStatus.RootObject callStatus = new CiscoCodecStatus.RootObject(); + + JsonConvert.PopulateObject(response, callStatus); + + // Iterate through the call objects in the response + foreach (CiscoCodecStatus.Call call in callStatus.Status.Call) + { + // Look for a matching call id in the existing status structure + var existingCall = CodecStatus.Status.Call.FirstOrDefault(c => c.id.Equals(call.id)); + + if (existingCall != null) + { + // If an existing call object is found with a matching ID, populate the existing call with the new data. + // (must reserialize the object so that we can use PopulateObject() to overlay the new or updated properties on the existing object) + JsonConvert.PopulateObject(JsonConvert.SerializeObject(call), existingCall); + } + else + { + // Add the call + callStatus.Status.Call.Add(call); + + // Add a call to the ActiveCalls List + //ActiveCalls.Add(new CodecActiveCallItem() { Id = call.id, Status = call.Status.Value, Name = call.DisplayName.Value, Number = call.RemoteNumber.Value, Type = call.Status.Value.ToString() + } + + // Handle call.status to determine if we need to fire an event notifying of an incoming call or a call disconnect + } + } + JsonConvert.PopulateObject(response, CodecStatus); if (!SyncState.InitialStatusMessageWasReceived) @@ -507,7 +580,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco } else if (response.IndexOf("\"Event\":{") > -1) { - JsonConvert.PopulateObject(response, CodecEvent); + CiscoCodecEvents.RootObject eventReceived = new CiscoCodecEvents.RootObject(); + + JsonConvert.PopulateObject(response, eventReceived); + + EvalutateEvent(eventReceived); } } @@ -517,6 +594,24 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco } } + /// + /// Evaluates an event received from the codec + /// + /// + void EvalutateEvent(CiscoCodecEvents.RootObject eventReceived) + { + if (eventReceived.Event.CallDisconnect != null) + { + var tempCall = CodecStatus.Status.Call.FirstOrDefault(c => c.id.Equals(eventReceived.Event.CallDisconnect.CallId)); + + if(tempCall != null) + { + CodecStatus.Status.Call.Remove(tempCall); + + } + } + } + public override void ExecuteSwitch(object selector) { (selector as Action)(); @@ -551,11 +646,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco SendText(string.Format("xCommand Dial BookingId: {0}", s)); } -<<<<<<< HEAD - public override void EndCall(string s) - { - SendText(string.Format("xCommand Call Disconnect CallId: {0}", GetCallId())); -======= public override void EndCall(CodecActiveCallItem activeCall) { SendText(string.Format("xCommand Call Disconnect CallId: {0}", activeCall.Id)); @@ -567,15 +657,14 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { SendText(string.Format("xCommand Call Disconnect CallId: {0}", activeCall.Id)); } ->>>>>>> origin/feature/cisco-spark-2 } - public override void AcceptCall() + public override void AcceptCall(CodecActiveCallItem item) { SendText("xCommand Call Accept"); } - public override void RejectCall() + public override void RejectCall(CodecActiveCallItem item) { SendText("xCommand Call Reject"); } diff --git a/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/xStatus.cs b/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/xStatus.cs index 60516378..60857d91 100644 --- a/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/xStatus.cs +++ b/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/xStatus.cs @@ -1,247 +1,361 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharp.CrestronXml.Serialization; - -namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco -{ - public class CiscoCodecStatus - { - // Helper Classes for Proerties - public abstract class ValueProperty - { - /// - /// Triggered when Value is set - /// - public Action ValueChangedAction { get; set; } - - protected void OnValueChanged() - { - var a = ValueChangedAction; - if (a != null) - a(); - } - - } - - public class ConnectionStatus - { - public string Value { get; set; } - } - - public class Microphone - { - public string id { get; set; } - public ConnectionStatus ConnectionStatus { get; set; } - } - - public class Connectors - { - public List Microphone { get; set; } - } - - public class Input - { - public Connectors Connectors { get; set; } - } - - public class Mute : ValueProperty - { - public bool BoolValue { get; private set; } - - public string Value - { - set - { - // If the incoming value is "On" it sets the BoolValue true, otherwise sets it false - BoolValue = value == "On"; - OnValueChanged(); - } - } - } - - public class Microphones - { - public Mute Mute { get; set; } - } - - public class ConnectionStatus2 - { - public string Value { get; set; } - } - - public class DelayMs - { - public string Value { get; set; } - } - - public class Line - { - public string id { get; set; } - public ConnectionStatus2 ConnectionStatus { get; set; } - public DelayMs DelayMs { get; set; } - } - - public class Connectors2 - { - public List Line { get; set; } - } - - public class Output - { - public Connectors2 Connectors { get; set; } - } - - public class Volume : ValueProperty - { - string _Value; - - /// - /// Sets Value and triggers the action when set - /// - public string Value - { - get - { - return _Value; - } - set - { - _Value = value; - OnValueChanged(); - } - } - - /// - /// Converted value of _Value for use as feedback - /// - public int IntValue - { - get - { - if (!string.IsNullOrEmpty(_Value)) - return Convert.ToInt32(_Value); - else - return 0; - } - } - } - - public class VolumeMute : ValueProperty - { - public bool BoolValue { get; private set; } - - public string Value - { - set - { - // If the incoming value is "On" it sets the BoolValue true, otherwise sets it false - BoolValue = value == "On"; - OnValueChanged(); - } - } - } - - public class Audio - { - public Input Input { get; set; } - public Microphones Microphones { get; set; } // Can we have this setter fire the update on the CiscoCodec feedback? - public Output Output { get; set; } - public Volume Volume { get; set; } - public VolumeMute VolumeMute { get; set; } - - public Audio() - { - Volume = new Volume(); - } - } - - public class Id - { - public string Value { get; set; } - } - - public class Current - { - public Id Id { get; set; } - } - - public class Bookings - { - public Current Current { get; set; } - } - - public class Options - { - public string Value { get; set; } - } - - public class Capabilities - { - public Options Options { get; set; } - } - - public class Connected - { - public string Value { get; set; } - } - - public class Framerate - { - public string Value { get; set; } - } - - public class Manufacturer - { - public string Value { get; set; } - } - - public class Model - { - public string Value { get; set; } - } - - public class Pan - { - public string Value { get; set; } - } - - public class Tilt - { - public string Value { get; set; } - } - - public class Zoom - { - public string Value { get; set; } - } - - public class Position - { - public Pan Pan { get; set; } - public Tilt Tilt { get; set; } - public Zoom Zoom { get; set; } - } - - public class Camera - { - public string id { get; set; } - public Capabilities Capabilities { get; set; } - public Connected Connected { get; set; } - public Framerate Framerate { get; set; } - public Manufacturer Manufacturer { get; set; } - public Model Model { get; set; } - public Position Position { get; set; } - } - - public class Availability - { - public string Value { get; set; } - } - - public class Status2 : ValueProperty +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharp.CrestronXml.Serialization; + +namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco +{ + public class CiscoCodecStatus + { + // Helper Classes for Proerties + public abstract class ValueProperty + { + /// + /// Triggered when Value is set + /// + public Action ValueChangedAction { get; set; } + + protected void OnValueChanged() + { + var a = ValueChangedAction; + if (a != null) + a(); + } + + } + + public class ConnectionStatus + { + public string Value { get; set; } + } + + public class Microphone + { + public string id { get; set; } + public ConnectionStatus ConnectionStatus { get; set; } + } + + public class Connectors + { + public List Microphone { get; set; } + } + + public class Input + { + public Connectors Connectors { get; set; } + } + + public class Mute : ValueProperty + { + public bool BoolValue { get; private set; } + + public string Value + { + set + { + // If the incoming value is "On" it sets the BoolValue true, otherwise sets it false + BoolValue = value == "On"; + OnValueChanged(); + } + } + } + + public class Microphones + { + public Mute Mute { get; set; } + + public Microphones() + { + Mute = new Mute(); + } + } + + public class ConnectionStatus2 + { + public string Value { get; set; } + } + + public class DelayMs + { + public string Value { get; set; } + } + + public class Line + { + public string id { get; set; } + public ConnectionStatus2 ConnectionStatus { get; set; } + public DelayMs DelayMs { get; set; } + } + + public class Connectors2 + { + public List Line { get; set; } + } + + public class Output + { + public Connectors2 Connectors { get; set; } + } + + public class Volume : ValueProperty + { + string _Value; + + /// + /// Sets Value and triggers the action when set + /// + public string Value + { + get + { + return _Value; + } + set + { + _Value = value; + OnValueChanged(); + } + } + + /// + /// Converted value of _Value for use as feedback + /// + public int IntValue + { + get + { + if (!string.IsNullOrEmpty(_Value)) + return Convert.ToInt32(_Value); + else + return 0; + } + } + } + + public class VolumeMute : ValueProperty + { + public bool BoolValue { get; private set; } + + public string Value + { + set + { + // If the incoming value is "On" it sets the BoolValue true, otherwise sets it false + BoolValue = value == "On"; + OnValueChanged(); + } + } + } + + public class Audio + { + public Input Input { get; set; } + public Microphones Microphones { get; set; } // Can we have this setter fire the update on the CiscoCodec feedback? + public Output Output { get; set; } + public Volume Volume { get; set; } + public VolumeMute VolumeMute { get; set; } + + public Audio() + { + Volume = new Volume(); + VolumeMute = new VolumeMute(); + Microphones = new Microphones(); + } + } + + public class Id + { + public string Value { get; set; } + } + + public class Current + { + public Id Id { get; set; } + } + + public class Bookings + { + public Current Current { get; set; } + } + + public class Options + { + public string Value { get; set; } + } + + public class Capabilities + { + public Options Options { get; set; } + } + + public class Connected + { + public string Value { get; set; } + } + + public class Framerate + { + public string Value { get; set; } + } + + public class Manufacturer + { + public string Value { get; set; } + } + + public class Model + { + public string Value { get; set; } + } + + public class Pan + { + public string Value { get; set; } + } + + public class Tilt + { + public string Value { get; set; } + } + + public class Zoom + { + public string Value { get; set; } + } + + public class Position + { + public Pan Pan { get; set; } + public Tilt Tilt { get; set; } + public Zoom Zoom { get; set; } + } + + public class Camera + { + public string id { get; set; } + public Capabilities Capabilities { get; set; } + public Connected Connected { get; set; } + public Framerate Framerate { get; set; } + public Manufacturer Manufacturer { get; set; } + public Model Model { get; set; } + public Position Position { get; set; } + } + + public class Availability + { + public string Value { get; set; } + } + + public class Status2 : ValueProperty + { + string _Value; + public bool BoolValue { get; private set; } + + public string Value + { + get + { + return _Value; + } + set + { + // If the incoming value is "Active" it sets the BoolValue true, otherwise sets it false + _Value = value; + BoolValue = value == "Active"; + OnValueChanged(); + } + } + } + + public class SpeakerTrack + { + public Availability Availability { get; set; } + public Status2 Status { get; set; } + + public SpeakerTrack() + { + Status = new Status2(); + } + } + + public class Cameras + { + public List Camera { get; set; } + public SpeakerTrack SpeakerTrack { get; set; } + + public Cameras() + { + Camera = new List(); + SpeakerTrack = new SpeakerTrack(); + } + } + + public class MaxActiveCalls + { + public string Value { get; set; } + } + + public class MaxAudioCalls + { + public string Value { get; set; } + } + + public class MaxCalls + { + public string Value { get; set; } + } + + public class MaxVideoCalls + { + public string Value { get; set; } + } + + public class Conference + { + public MaxActiveCalls MaxActiveCalls { get; set; } + public MaxAudioCalls MaxAudioCalls { get; set; } + public MaxCalls MaxCalls { get; set; } + public MaxVideoCalls MaxVideoCalls { get; set; } + } + + public class Capabilities2 + { + public Conference Conference { get; set; } + } + + public class CallId + { + public string Value { get; set; } + } + + public class ActiveSpeaker + { + public CallId CallId { get; set; } + } + + public class DoNotDisturb + { + public string Value { get; set; } + } + + public class Mode + { + public string Value { get; set; } + } + + public class Multipoint + { + public Mode Mode { get; set; } + } + + public class CallId2 + { + public string Value { get; set; } + } + + public class Mode2 : ValueProperty { public bool BoolValue { get; private set; } @@ -250,675 +364,594 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco set { // If the incoming value is "Active" it sets the BoolValue true, otherwise sets it false - BoolValue = value == "Active"; + BoolValue = value == "On"; OnValueChanged(); } - } - } - - public class SpeakerTrack - { - public Availability Availability { get; set; } - public Status2 Status { get; set; } + } + } - public SpeakerTrack() - { - Status = new Status2(); - } - } - - public class Cameras - { - public List Camera { get; set; } - public SpeakerTrack SpeakerTrack { get; set; } + public class Mode3 + { + public string Value { get; set; } + } - public Cameras() + public class ReleaseFloorAvailability + { + public string Value { get; set; } + } + + public class RequestFloorAvailability + { + public string Value { get; set; } + } + + public class Whiteboard + { + public Mode3 Mode { get; set; } + public ReleaseFloorAvailability ReleaseFloorAvailability { get; set; } + public RequestFloorAvailability RequestFloorAvailability { get; set; } + } + + public class Presentation + { + public CallId2 CallId { get; set; } + public Mode2 Mode { get; set; } + public Whiteboard Whiteboard { get; set; } + + public Presentation() { - Camera = new List(); - SpeakerTrack = new SpeakerTrack(); - } - } - - public class MaxActiveCalls - { - public string Value { get; set; } - } - - public class MaxAudioCalls - { - public string Value { get; set; } - } - - public class MaxCalls - { - public string Value { get; set; } - } - - public class MaxVideoCalls - { - public string Value { get; set; } - } - - public class Conference - { - public MaxActiveCalls MaxActiveCalls { get; set; } - public MaxAudioCalls MaxAudioCalls { get; set; } - public MaxCalls MaxCalls { get; set; } - public MaxVideoCalls MaxVideoCalls { get; set; } - } - - public class Capabilities2 - { - public Conference Conference { get; set; } - } - - public class CallId - { - public string Value { get; set; } - } - - public class ActiveSpeaker - { - public CallId CallId { get; set; } - } - - public class DoNotDisturb - { - public string Value { get; set; } - } - - public class Mode - { - public string Value { get; set; } - } - - public class Multipoint - { - public Mode Mode { get; set; } - } - - public class CallId2 - { - public string Value { get; set; } - } - - public class Mode2 - { - public string Value { get; set; } - } - - public class Mode3 - { - public string Value { get; set; } - } - - public class ReleaseFloorAvailability - { - public string Value { get; set; } - } - - public class RequestFloorAvailability - { - public string Value { get; set; } - } - - public class Whiteboard - { - public Mode3 Mode { get; set; } - public ReleaseFloorAvailability ReleaseFloorAvailability { get; set; } - public RequestFloorAvailability RequestFloorAvailability { get; set; } - } - - public class Presentation - { - public CallId2 CallId { get; set; } - public Mode2 Mode { get; set; } - public Whiteboard Whiteboard { get; set; } - } - - public class CallId3 - { - public string Value { get; set; } - } - - public class Mode4 - { - public string Value { get; set; } - } - - public class SpeakerLock - { - public CallId3 CallId { get; set; } - public Mode4 Mode { get; set; } - } - - public class Conference2 - { - public ActiveSpeaker ActiveSpeaker { get; set; } - public DoNotDisturb DoNotDisturb { get; set; } - public Multipoint Multipoint { get; set; } - public Presentation Presentation { get; set; } - public SpeakerLock SpeakerLock { get; set; } - } - - public class Description - { - public string Value { get; set; } - } - - public class Level - { - public string Value { get; set; } - } - - public class References - { - public string Value { get; set; } - } - - public class Type - { - public string Value { get; set; } - } - - public class Message - { - public string id { get; set; } - public Description Description { get; set; } - public Level Level { get; set; } - public References References { get; set; } - public Type Type { get; set; } - } - - public class Diagnostics - { - public List Message { get; set; } - } - - public class Conference3 - { - } - - public class Experimental - { - public Conference3 Conference { get; set; } - } - - public class Address - { - public string Value { get; set; } - } - - public class Port - { - public string Value { get; set; } - } - - public class Reason - { - public string Value { get; set; } - } - - public class Status3 - { - public string Value { get; set; } - } - - public class Gatekeeper - { - public Address Address { get; set; } - public Port Port { get; set; } - public Reason Reason { get; set; } - public Status3 Status { get; set; } - } - - public class Reason2 - { - public string Value { get; set; } - } - - public class Status4 - { - public string Value { get; set; } - } - - public class Mode5 - { - public Reason2 Reason { get; set; } - public Status4 Status { get; set; } - } - - public class H323 - { - public Gatekeeper Gatekeeper { get; set; } - public Mode5 Mode { get; set; } - } - - public class Expression - { - public string id { get; set; } - public string Value { get; set; } - } - - public class Format - { - public string Value { get; set; } - } - - public class URL - { - public string Value { get; set; } - } - - public class HttpFeedback - { - public string id { get; set; } - public List Expression { get; set; } - public Format Format { get; set; } - public URL URL { get; set; } - } - - public class MediaChannels - { - } - - public class Address2 - { - public string Value { get; set; } - } - - public class Capabilities3 - { - public string Value { get; set; } - } - - public class DeviceId - { - public string Value { get; set; } - } - - public class Duplex - { - public string Value { get; set; } - } - - public class Platform - { - public string Value { get; set; } - } - - public class PortID - { - public string Value { get; set; } - } - - public class PrimaryMgmtAddress - { - public string Value { get; set; } - } - - public class SysName - { - public string Value { get; set; } - } - - public class SysObjectID - { - public string Value { get; set; } - } - - public class VTPMgmtDomain - { - public string Value { get; set; } - } - - public class Version - { - public string Value { get; set; } - } - - public class VoIPApplianceVlanID - { - public string Value { get; set; } - } - - public class CDP - { - public Address2 Address { get; set; } - public Capabilities3 Capabilities { get; set; } - public DeviceId DeviceId { get; set; } - public Duplex Duplex { get; set; } - public Platform Platform { get; set; } - public PortID PortID { get; set; } - public PrimaryMgmtAddress PrimaryMgmtAddress { get; set; } - public SysName SysName { get; set; } - public SysObjectID SysObjectID { get; set; } - public VTPMgmtDomain VTPMgmtDomain { get; set; } - public Version Version { get; set; } - public VoIPApplianceVlanID VoIPApplianceVlanID { get; set; } - } - - public class Name - { - public string Value { get; set; } - } - - public class Domain - { - public Name Name { get; set; } - } - - public class Address3 - { - public string Value { get; set; } - } - - public class Server - { - public string id { get; set; } - public Address3 Address { get; set; } - } - - public class DNS - { - public Domain Domain { get; set; } - public List Server { get; set; } - } - - public class MacAddress - { - public string Value { get; set; } - } - - public class Speed - { - public string Value { get; set; } - } - - public class Ethernet - { - public MacAddress MacAddress { get; set; } - public Speed Speed { get; set; } - } - - public class Address4 - { - public string Value { get; set; } - } - - public class Gateway - { - public string Value { get; set; } - } - - public class SubnetMask - { - public string Value { get; set; } - } - - public class IPv4 - { - public Address4 Address { get; set; } - public Gateway Gateway { get; set; } - public SubnetMask SubnetMask { get; set; } - } - - public class Address5 - { - public string Value { get; set; } - } - - public class Gateway2 - { - public string Value { get; set; } - } - - public class IPv6 - { - public Address5 Address { get; set; } - public Gateway2 Gateway { get; set; } - } - - public class VlanId - { - public string Value { get; set; } - } - - public class Voice - { - public VlanId VlanId { get; set; } - } - - public class VLAN - { - public Voice Voice { get; set; } - } - - public class Network - { - public string id { get; set; } - public CDP CDP { get; set; } - public DNS DNS { get; set; } - public Ethernet Ethernet { get; set; } - public IPv4 IPv4 { get; set; } - public IPv6 IPv6 { get; set; } - public VLAN VLAN { get; set; } - } - - public class CurrentAddress - { - public string Value { get; set; } - } - - public class Address6 - { - public string Value { get; set; } - } - - public class Server2 - { - public string id { get; set; } - public Address6 Address { get; set; } - } - - public class Status5 - { - public string Value { get; set; } - } - - public class NTP - { - public CurrentAddress CurrentAddress { get; set; } - public List Server { get; set; } - public Status5 Status { get; set; } - } - - public class NetworkServices - { - public NTP NTP { get; set; } - } - - public class HardwareInfo - { - public string Value { get; set; } - } - - public class ID2 - { - public string Value { get; set; } - } - - public class Name2 - { - public string Value { get; set; } - } - - public class SoftwareInfo - { - public string Value { get; set; } - } - - public class Status6 - { - public string Value { get; set; } - } - - public class Type2 - { - public string Value { get; set; } - } - - public class UpgradeStatus - { - public string Value { get; set; } - } - - public class ConnectedDevice - { - public string id { get; set; } - public HardwareInfo HardwareInfo { get; set; } - public ID2 ID { get; set; } - public Name2 Name { get; set; } - public SoftwareInfo SoftwareInfo { get; set; } - public Status6 Status { get; set; } - public Type2 Type { get; set; } - public UpgradeStatus UpgradeStatus { get; set; } - } - - public class Peripherals - { - public List ConnectedDevice { get; set; } - } - - public class Enabled - { - public string Value { get; set; } - } - - public class LastLoggedInUserId - { - public string Value { get; set; } - } - - public class LoggedIn - { - public string Value { get; set; } - } - - public class ExtensionMobility - { - public Enabled Enabled { get; set; } - public LastLoggedInUserId LastLoggedInUserId { get; set; } - public LoggedIn LoggedIn { get; set; } - } - - public class CUCM - { - public ExtensionMobility ExtensionMobility { get; set; } - } - - public class CompletedAt - { - public string Value { get; set; } - } - - public class URL2 - { - public string Value { get; set; } - } - - public class VersionId - { - public string Value { get; set; } - } - - public class Current2 - { - public CompletedAt CompletedAt { get; set; } - public URL2 URL { get; set; } - public VersionId VersionId { get; set; } - } - - public class LastChange - { - public string Value { get; set; } - } - - public class Message2 - { - public string Value { get; set; } - } - - public class Phase - { - public string Value { get; set; } - } - - public class SessionId - { - public string Value { get; set; } - } - - public class Status7 - { - public string Value { get; set; } - } - - public class URL3 - { - public string Value { get; set; } - } - - public class VersionId2 - { - public string Value { get; set; } - } - - public class UpgradeStatus2 - { - public LastChange LastChange { get; set; } - public Message2 Message { get; set; } - public Phase Phase { get; set; } - public SessionId SessionId { get; set; } - public Status7 Status { get; set; } - public URL3 URL { get; set; } - public VersionId2 VersionId { get; set; } - } - - public class Software - { - public Current2 Current { get; set; } - public UpgradeStatus2 UpgradeStatus { get; set; } - } - - public class Status8 - { - public string Value { get; set; } - } - - public class Provisioning - { - public CUCM CUCM { get; set; } - public Software Software { get; set; } - public Status8 Status { get; set; } - } - - public class Availability2 - { - public string Value { get; set; } - } - - public class Services - { - public Availability2 Availability { get; set; } - } - - public class Proximity - { - public Services Services { get; set; } - } - - public class Current3 : ValueProperty + Mode = new Mode2(); + } + } + + public class CallId3 + { + public string Value { get; set; } + } + + public class Mode4 + { + public string Value { get; set; } + } + + public class SpeakerLock + { + public CallId3 CallId { get; set; } + public Mode4 Mode { get; set; } + } + + public class Conference2 + { + public ActiveSpeaker ActiveSpeaker { get; set; } + public DoNotDisturb DoNotDisturb { get; set; } + public Multipoint Multipoint { get; set; } + public Presentation Presentation { get; set; } + public SpeakerLock SpeakerLock { get; set; } + + public Conference2() + { + Presentation = new Presentation(); + } + } + + public class Description + { + public string Value { get; set; } + } + + public class Level + { + public string Value { get; set; } + } + + public class References + { + public string Value { get; set; } + } + + public class Type + { + public string Value { get; set; } + } + + public class Message + { + public string id { get; set; } + public Description Description { get; set; } + public Level Level { get; set; } + public References References { get; set; } + public Type Type { get; set; } + } + + public class Diagnostics + { + public List Message { get; set; } + } + + public class Conference3 + { + } + + public class Experimental + { + public Conference3 Conference { get; set; } + } + + public class Address + { + public string Value { get; set; } + } + + public class Port + { + public string Value { get; set; } + } + + public class Reason + { + public string Value { get; set; } + } + + public class Status3 + { + public string Value { get; set; } + } + + public class Gatekeeper + { + public Address Address { get; set; } + public Port Port { get; set; } + public Reason Reason { get; set; } + public Status3 Status { get; set; } + } + + public class Reason2 + { + public string Value { get; set; } + } + + public class Status4 + { + public string Value { get; set; } + } + + public class Mode5 + { + public Reason2 Reason { get; set; } + public Status4 Status { get; set; } + } + + public class H323 + { + public Gatekeeper Gatekeeper { get; set; } + public Mode5 Mode { get; set; } + } + + public class Expression + { + public string id { get; set; } + public string Value { get; set; } + } + + public class Format + { + public string Value { get; set; } + } + + public class URL + { + public string Value { get; set; } + } + + public class HttpFeedback + { + public string id { get; set; } + public List Expression { get; set; } + public Format Format { get; set; } + public URL URL { get; set; } + } + + public class MediaChannels + { + } + + public class Address2 + { + public string Value { get; set; } + } + + public class Capabilities3 + { + public string Value { get; set; } + } + + public class DeviceId + { + public string Value { get; set; } + } + + public class Duplex + { + public string Value { get; set; } + } + + public class Platform + { + public string Value { get; set; } + } + + public class PortID + { + public string Value { get; set; } + } + + public class PrimaryMgmtAddress + { + public string Value { get; set; } + } + + public class SysName + { + public string Value { get; set; } + } + + public class SysObjectID + { + public string Value { get; set; } + } + + public class VTPMgmtDomain + { + public string Value { get; set; } + } + + public class Version + { + public string Value { get; set; } + } + + public class VoIPApplianceVlanID + { + public string Value { get; set; } + } + + public class CDP + { + public Address2 Address { get; set; } + public Capabilities3 Capabilities { get; set; } + public DeviceId DeviceId { get; set; } + public Duplex Duplex { get; set; } + public Platform Platform { get; set; } + public PortID PortID { get; set; } + public PrimaryMgmtAddress PrimaryMgmtAddress { get; set; } + public SysName SysName { get; set; } + public SysObjectID SysObjectID { get; set; } + public VTPMgmtDomain VTPMgmtDomain { get; set; } + public Version Version { get; set; } + public VoIPApplianceVlanID VoIPApplianceVlanID { get; set; } + } + + public class Name + { + public string Value { get; set; } + } + + public class Domain + { + public Name Name { get; set; } + } + + public class Address3 + { + public string Value { get; set; } + } + + public class Server + { + public string id { get; set; } + public Address3 Address { get; set; } + } + + public class DNS + { + public Domain Domain { get; set; } + public List Server { get; set; } + } + + public class MacAddress + { + public string Value { get; set; } + } + + public class Speed + { + public string Value { get; set; } + } + + public class Ethernet + { + public MacAddress MacAddress { get; set; } + public Speed Speed { get; set; } + } + + public class Address4 + { + public string Value { get; set; } + } + + public class Gateway + { + public string Value { get; set; } + } + + public class SubnetMask + { + public string Value { get; set; } + } + + public class IPv4 + { + public Address4 Address { get; set; } + public Gateway Gateway { get; set; } + public SubnetMask SubnetMask { get; set; } + } + + public class Address5 + { + public string Value { get; set; } + } + + public class Gateway2 + { + public string Value { get; set; } + } + + public class IPv6 + { + public Address5 Address { get; set; } + public Gateway2 Gateway { get; set; } + } + + public class VlanId + { + public string Value { get; set; } + } + + public class Voice + { + public VlanId VlanId { get; set; } + } + + public class VLAN + { + public Voice Voice { get; set; } + } + + public class Network + { + public string id { get; set; } + public CDP CDP { get; set; } + public DNS DNS { get; set; } + public Ethernet Ethernet { get; set; } + public IPv4 IPv4 { get; set; } + public IPv6 IPv6 { get; set; } + public VLAN VLAN { get; set; } + } + + public class CurrentAddress + { + public string Value { get; set; } + } + + public class Address6 + { + public string Value { get; set; } + } + + public class Server2 + { + public string id { get; set; } + public Address6 Address { get; set; } + } + + public class Status5 + { + public string Value { get; set; } + } + + public class NTP + { + public CurrentAddress CurrentAddress { get; set; } + public List Server { get; set; } + public Status5 Status { get; set; } + } + + public class NetworkServices + { + public NTP NTP { get; set; } + } + + public class HardwareInfo + { + public string Value { get; set; } + } + + public class ID2 + { + public string Value { get; set; } + } + + public class Name2 + { + public string Value { get; set; } + } + + public class SoftwareInfo + { + public string Value { get; set; } + } + + public class Status6 + { + public string Value { get; set; } + } + + public class Type2 + { + public string Value { get; set; } + } + + public class UpgradeStatus + { + public string Value { get; set; } + } + + public class ConnectedDevice + { + public string id { get; set; } + public HardwareInfo HardwareInfo { get; set; } + public ID2 ID { get; set; } + public Name2 Name { get; set; } + public SoftwareInfo SoftwareInfo { get; set; } + public Status6 Status { get; set; } + public Type2 Type { get; set; } + public UpgradeStatus UpgradeStatus { get; set; } + } + + public class Peripherals + { + public List ConnectedDevice { get; set; } + } + + public class Enabled + { + public string Value { get; set; } + } + + public class LastLoggedInUserId + { + public string Value { get; set; } + } + + public class LoggedIn + { + public string Value { get; set; } + } + + public class ExtensionMobility + { + public Enabled Enabled { get; set; } + public LastLoggedInUserId LastLoggedInUserId { get; set; } + public LoggedIn LoggedIn { get; set; } + } + + public class CUCM + { + public ExtensionMobility ExtensionMobility { get; set; } + } + + public class CompletedAt + { + public string Value { get; set; } + } + + public class URL2 + { + public string Value { get; set; } + } + + public class VersionId + { + public string Value { get; set; } + } + + public class Current2 + { + public CompletedAt CompletedAt { get; set; } + public URL2 URL { get; set; } + public VersionId VersionId { get; set; } + } + + public class LastChange + { + public string Value { get; set; } + } + + public class Message2 + { + public string Value { get; set; } + } + + public class Phase + { + public string Value { get; set; } + } + + public class SessionId + { + public string Value { get; set; } + } + + public class Status7 + { + public string Value { get; set; } + } + + public class URL3 + { + public string Value { get; set; } + } + + public class VersionId2 + { + public string Value { get; set; } + } + + public class UpgradeStatus2 + { + public LastChange LastChange { get; set; } + public Message2 Message { get; set; } + public Phase Phase { get; set; } + public SessionId SessionId { get; set; } + public Status7 Status { get; set; } + public URL3 URL { get; set; } + public VersionId2 VersionId { get; set; } + } + + public class Software + { + public Current2 Current { get; set; } + public UpgradeStatus2 UpgradeStatus { get; set; } + } + + public class Status8 + { + public string Value { get; set; } + } + + public class Provisioning + { + public CUCM CUCM { get; set; } + public Software Software { get; set; } + public Status8 Status { get; set; } + } + + public class Availability2 + { + public string Value { get; set; } + } + + public class Services + { + public Availability2 Availability { get; set; } + } + + public class Proximity + { + public Services Services { get; set; } + } + + public class Current3 : ValueProperty { string _Value; @@ -950,20 +983,20 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco else return 0; } - } - } - - public class PeopleCount - { + } + } + + public class PeopleCount + { public Current3 Current { get; set; } public PeopleCount() { Current = new Current3(); - } - } - - public class PeoplePresence : ValueProperty + } + } + + public class PeoplePresence : ValueProperty { public bool BoolValue { get; private set; } @@ -975,735 +1008,741 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco BoolValue = value == "Yes"; OnValueChanged(); } - } - } - - public class RoomAnalytics - { - public PeopleCount PeopleCount { get; set; } + } + } + + public class RoomAnalytics + { + public PeopleCount PeopleCount { get; set; } public PeoplePresence PeoplePresence { get; set; } public RoomAnalytics() { PeopleCount = new PeopleCount(); PeoplePresence = new PeoplePresence(); - } - } - - public class Authentication - { - public string Value { get; set; } - } - - public class DisplayName - { - public string Value { get; set; } - } - - public class Mode6 - { - public string Value { get; set; } - } - - public class URI - { - public string Value { get; set; } - } - - public class CallForward - { - public DisplayName DisplayName { get; set; } - public Mode6 Mode { get; set; } - public URI URI { get; set; } - } - - public class MessagesWaiting - { - public string Value { get; set; } - } - - public class URI2 - { - public string Value { get; set; } - } - - public class Mailbox - { - public MessagesWaiting MessagesWaiting { get; set; } - public URI2 URI { get; set; } - } - - public class Address7 - { - public string Value { get; set; } - } - - public class Status9 - { - public string Value { get; set; } - } - - public class Proxy - { - public string id { get; set; } - public Address7 Address { get; set; } - public Status9 Status { get; set; } - } - - public class Reason3 - { - public string Value { get; set; } - } - - public class Status10 - { - public string Value { get; set; } - } - - public class URI3 - { - public string Value { get; set; } - } - - public class Registration - { - public string id { get; set; } - public Reason3 Reason { get; set; } - public Status10 Status { get; set; } - public URI3 URI { get; set; } - } - - public class Secure - { - public string Value { get; set; } - } - - public class Verified - { - public string Value { get; set; } - } - - public class SIP - { - public Authentication Authentication { get; set; } - public CallForward CallForward { get; set; } - public Mailbox Mailbox { get; set; } - public List Proxy { get; set; } - public List Registration { get; set; } - public Secure Secure { get; set; } - public Verified Verified { get; set; } - } - - public class Mode7 - { - public string Value { get; set; } - } - - public class FIPS - { - public Mode7 Mode { get; set; } - } - - public class CallHistory - { - public string Value { get; set; } - } - - public class Configurations - { - public string Value { get; set; } - } - - public class DHCP - { - public string Value { get; set; } - } - - public class InternalLogging - { - public string Value { get; set; } - } - - public class LocalPhonebook - { - public string Value { get; set; } - } - - public class Persistency - { - public CallHistory CallHistory { get; set; } - public Configurations Configurations { get; set; } - public DHCP DHCP { get; set; } - public InternalLogging InternalLogging { get; set; } - public LocalPhonebook LocalPhonebook { get; set; } - } - - public class Security - { - public FIPS FIPS { get; set; } - public Persistency Persistency { get; set; } - } - - public class State : ValueProperty - { - public bool BoolValue { get; private set; } - - public string Value // Valid values are Standby/EnteringStandby/Halfwake/Off - { - set - { - // If the incoming value is "Of" it sets the BoolValue true, otherwise sets it false - BoolValue = value == "Off"; - OnValueChanged(); - } - } - } - - public class Standby - { - public State State { get; set; } - - public Standby() - { - State = new State(); - } - } - - public class CompatibilityLevel - { - public string Value { get; set; } - } - - public class SerialNumber - { - public string Value { get; set; } - } - - public class Module - { - public CompatibilityLevel CompatibilityLevel { get; set; } - public SerialNumber SerialNumber { get; set; } - } - - public class Hardware - { - public Module Module { get; set; } - } - - public class ProductId - { - public string Value { get; set; } - } - - public class ProductPlatform - { - public string Value { get; set; } - } - - public class ProductType - { - public string Value { get; set; } - } - - public class DisplayName2 - { - public string Value { get; set; } - } - - public class Name3 - { - public string Value { get; set; } - } - - public class Encryption - { - public string Value { get; set; } - } - - public class MultiSite - { - public string Value { get; set; } - } - - public class RemoteMonitoring - { - public string Value { get; set; } - } - - public class OptionKeys - { - public Encryption Encryption { get; set; } - public MultiSite MultiSite { get; set; } - public RemoteMonitoring RemoteMonitoring { get; set; } - } - - public class ReleaseDate - { - public string Value { get; set; } - } - - public class Version2 - { - public string Value { get; set; } - } - - public class Software2 - { - public DisplayName2 DisplayName { get; set; } - public Name3 Name { get; set; } - public OptionKeys OptionKeys { get; set; } - public ReleaseDate ReleaseDate { get; set; } - public Version2 Version { get; set; } - } - - public class NumberOfActiveCalls - { - public string Value { get; set; } - } - - public class NumberOfInProgressCalls - { - public string Value { get; set; } - } - - public class NumberOfSuspendedCalls - { - public string Value { get; set; } - } - - public class State2 - { - public NumberOfActiveCalls NumberOfActiveCalls { get; set; } - public NumberOfInProgressCalls NumberOfInProgressCalls { get; set; } - public NumberOfSuspendedCalls NumberOfSuspendedCalls { get; set; } - } - - public class Uptime - { - public string Value { get; set; } - } - - public class SystemUnit - { - public Hardware Hardware { get; set; } - public ProductId ProductId { get; set; } - public ProductPlatform ProductPlatform { get; set; } - public ProductType ProductType { get; set; } - public Software2 Software { get; set; } - public State2 State { get; set; } - public Uptime Uptime { get; set; } - } - - public class SystemTime - { - public DateTime Value { get; set; } - } - - public class Time - { - public SystemTime SystemTime { get; set; } - } - - public class Number - { - public string Value { get; set; } - } - - public class ContactMethod - { - public string id { get; set; } - public Number Number { get; set; } - } - - public class Name4 - { - public string Value { get; set; } - } - - public class ContactInfo - { - public List ContactMethod { get; set; } - public Name4 Name { get; set; } - } - - public class UserInterface - { - public ContactInfo ContactInfo { get; set; } - } - - public class PIPPosition - { - public string Value { get; set; } - } - - public class ActiveSpeaker2 - { - public PIPPosition PIPPosition { get; set; } - } - - public class Connected2 - { - public string Value { get; set; } - } - - public class SignalState - { - public string Value { get; set; } - } - - public class SourceId - { - public string Value { get; set; } - } - - public class Type3 - { - public string Value { get; set; } - } - - public class Connector - { - public string id { get; set; } - public Connected2 Connected { get; set; } - public SignalState SignalState { get; set; } - public SourceId SourceId { get; set; } - public Type3 Type { get; set; } - } - - public class MainVideoSource - { - public string Value { get; set; } - } - - public class ConnectorId - { - public string Value { get; set; } - } - - public class FormatStatus - { - public string Value { get; set; } - } - - public class FormatType - { - public string Value { get; set; } - } - - public class MediaChannelId - { - public string Value { get; set; } - } - - public class Height - { - public string Value { get; set; } - } - - public class RefreshRate - { - public string Value { get; set; } - } - - public class Width - { - public string Value { get; set; } - } - - public class Resolution - { - public Height Height { get; set; } - public RefreshRate RefreshRate { get; set; } - public Width Width { get; set; } - } - - public class Source - { - public string id { get; set; } - public ConnectorId ConnectorId { get; set; } - public FormatStatus FormatStatus { get; set; } - public FormatType FormatType { get; set; } - public MediaChannelId MediaChannelId { get; set; } - public Resolution Resolution { get; set; } - } - - public class Input2 - { - public List Connector { get; set; } - public MainVideoSource MainVideoSource { get; set; } - public List Source { get; set; } - } - - public class Local - { - public string Value { get; set; } - } - - public class LayoutFamily - { - public Local Local { get; set; } - } - - public class Layout - { - public LayoutFamily LayoutFamily { get; set; } - } - - public class Monitors - { - public string Value { get; set; } - } - - public class Connected3 - { - public string Value { get; set; } - } - - public class Name5 - { - public string Value { get; set; } - } - - public class PreferredFormat - { - public string Value { get; set; } - } - - public class ConnectedDevice2 - { - public Name5 Name { get; set; } - public PreferredFormat PreferredFormat { get; set; } - } - - public class MonitorRole - { - public string Value { get; set; } - } - - public class Height2 - { - public string Value { get; set; } - } - - public class RefreshRate2 - { - public string Value { get; set; } - } - - public class Width2 - { - public string Value { get; set; } - } - - public class Resolution2 - { - public Height2 Height { get; set; } - public RefreshRate2 RefreshRate { get; set; } - public Width2 Width { get; set; } - } - - public class Type4 - { - public string Value { get; set; } - } - - public class Connector2 - { - public string id { get; set; } - public Connected3 Connected { get; set; } - public ConnectedDevice2 ConnectedDevice { get; set; } - public MonitorRole MonitorRole { get; set; } - public Resolution2 Resolution { get; set; } - public Type4 Type { get; set; } - } - - public class Output2 - { - public List Connector { get; set; } - } - - public class PIPPosition2 - { - public string Value { get; set; } - } - - public class Presentation2 - { - public PIPPosition2 PIPPosition { get; set; } - } - - public class FullscreenMode - { - public string Value { get; set; } - } - - public class Mode8 - { - public string Value { get; set; } - } - - public class OnMonitorRole - { - public string Value { get; set; } - } - - public class PIPPosition3 - { - public string Value { get; set; } - } - - public class Selfview - { - public FullscreenMode FullscreenMode { get; set; } - public Mode8 Mode { get; set; } - public OnMonitorRole OnMonitorRole { get; set; } - public PIPPosition3 PIPPosition { get; set; } - } - - public class Video - { - public ActiveSpeaker2 ActiveSpeaker { get; set; } - public Input2 Input { get; set; } - public Layout Layout { get; set; } - public Monitors Monitors { get; set; } - public Output2 Output { get; set; } - public Presentation2 Presentation { get; set; } - public Selfview Selfview { get; set; } - } - - public class AnswerState - { - public string Value { get; set; } - } - - public class CallType - { - public string Value { get; set; } - } - - public class CallbackNumber - { - public string Value { get; set; } - } - - public class DeviceType - { - public string Value { get; set; } - } - - public class Direction - { - public string Value { get; set; } - } - - public class Duration - { - public string Value { get; set; } - } - - - public class FacilityServiceId - { - public string Value { get; set; } - } - - public class HoldReason - { - public string Value { get; set; } - } - - public class PlacedOnHold - { - public string Value { get; set; } - } - - public class Protocol - { - public string Value { get; set; } - } - - public class ReceiveCallRate - { - public string Value { get; set; } - } - - public class RemoteNumber - { - public string Value { get; set; } - } - - public class TransmitCallRate - { - public string Value { get; set; } - } - - public class Call - { - public string id { get; set; } - public AnswerState AnswerState { get; set; } - public CallType CallType { get; set; } - public CallbackNumber CallbackNumber { get; set; } - public DeviceType DeviceType { get; set; } - public Direction Direction { get; set; } - public DisplayName DisplayName { get; set; } - public Duration Duration { get; set; } - public Encryption Encryption { get; set; } - public FacilityServiceId FacilityServiceId { get; set; } - public HoldReason HoldReason { get; set; } - public PlacedOnHold PlacedOnHold { get; set; } - public Protocol Protocol { get; set; } - public ReceiveCallRate ReceiveCallRate { get; set; } - public RemoteNumber RemoteNumber { get; set; } - public Status2 Status { get; set; } - public TransmitCallRate TransmitCallRate { get; set; } - } - - public class Status - { - public Audio Audio { get; set; } - public Bookings Bookings { get; set; } - public List Call { get; set; } - public Cameras Cameras { get; set; } - public Capabilities2 Capabilities { get; set; } - public Conference2 Conference { get; set; } - public Diagnostics Diagnostics { get; set; } - public Experimental Experimental { get; set; } - public H323 H323 { get; set; } - public List HttpFeedback { get; set; } - public MediaChannels MediaChannels { get; set; } - public List Network { get; set; } - public NetworkServices NetworkServices { get; set; } - public Peripherals Peripherals { get; set; } - public Provisioning Provisioning { get; set; } - public Proximity Proximity { get; set; } - public RoomAnalytics RoomAnalytics { get; set; } - public SIP SIP { get; set; } - public Security Security { get; set; } - public Standby Standby { get; set; } - public SystemUnit SystemUnit { get; set; } - public Time Time { get; set; } - public UserInterface UserInterface { get; set; } - public Video Video { get; set; } - - public Status() - { - Audio = new Audio(); - Call = new List(); + } + } + + public class Authentication + { + public string Value { get; set; } + } + + public class DisplayName + { + public string Value { get; set; } + } + + public class Mode6 + { + public string Value { get; set; } + } + + public class URI + { + public string Value { get; set; } + } + + public class CallForward + { + public DisplayName DisplayName { get; set; } + public Mode6 Mode { get; set; } + public URI URI { get; set; } + } + + public class MessagesWaiting + { + public string Value { get; set; } + } + + public class URI2 + { + public string Value { get; set; } + } + + public class Mailbox + { + public MessagesWaiting MessagesWaiting { get; set; } + public URI2 URI { get; set; } + } + + public class Address7 + { + public string Value { get; set; } + } + + public class Status9 + { + public string Value { get; set; } + } + + public class Proxy + { + public string id { get; set; } + public Address7 Address { get; set; } + public Status9 Status { get; set; } + } + + public class Reason3 + { + public string Value { get; set; } + } + + public class Status10 + { + public string Value { get; set; } + } + + public class URI3 + { + public string Value { get; set; } + } + + public class Registration + { + public string id { get; set; } + public Reason3 Reason { get; set; } + public Status10 Status { get; set; } + public URI3 URI { get; set; } + } + + public class Secure + { + public string Value { get; set; } + } + + public class Verified + { + public string Value { get; set; } + } + + public class SIP + { + public Authentication Authentication { get; set; } + public CallForward CallForward { get; set; } + public Mailbox Mailbox { get; set; } + public List Proxy { get; set; } + public List Registration { get; set; } + public Secure Secure { get; set; } + public Verified Verified { get; set; } + } + + public class Mode7 + { + public string Value { get; set; } + } + + public class FIPS + { + public Mode7 Mode { get; set; } + } + + public class CallHistory + { + public string Value { get; set; } + } + + public class Configurations + { + public string Value { get; set; } + } + + public class DHCP + { + public string Value { get; set; } + } + + public class InternalLogging + { + public string Value { get; set; } + } + + public class LocalPhonebook + { + public string Value { get; set; } + } + + public class Persistency + { + public CallHistory CallHistory { get; set; } + public Configurations Configurations { get; set; } + public DHCP DHCP { get; set; } + public InternalLogging InternalLogging { get; set; } + public LocalPhonebook LocalPhonebook { get; set; } + } + + public class Security + { + public FIPS FIPS { get; set; } + public Persistency Persistency { get; set; } + } + + public class State : ValueProperty + { + public bool BoolValue { get; private set; } + + public string Value // Valid values are Standby/EnteringStandby/Halfwake/Off + { + set + { + // If the incoming value is "Of" it sets the BoolValue true, otherwise sets it false + BoolValue = value == "Off"; + OnValueChanged(); + } + } + } + + public class Standby + { + public State State { get; set; } + + public Standby() + { + State = new State(); + } + } + + public class CompatibilityLevel + { + public string Value { get; set; } + } + + public class SerialNumber + { + public string Value { get; set; } + } + + public class Module + { + public CompatibilityLevel CompatibilityLevel { get; set; } + public SerialNumber SerialNumber { get; set; } + } + + public class Hardware + { + public Module Module { get; set; } + } + + public class ProductId + { + public string Value { get; set; } + } + + public class ProductPlatform + { + public string Value { get; set; } + } + + public class ProductType + { + public string Value { get; set; } + } + + public class DisplayName2 + { + public string Value { get; set; } + } + + public class Name3 + { + public string Value { get; set; } + } + + public class Encryption + { + public string Value { get; set; } + } + + public class MultiSite + { + public string Value { get; set; } + } + + public class RemoteMonitoring + { + public string Value { get; set; } + } + + public class OptionKeys + { + public Encryption Encryption { get; set; } + public MultiSite MultiSite { get; set; } + public RemoteMonitoring RemoteMonitoring { get; set; } + } + + public class ReleaseDate + { + public string Value { get; set; } + } + + public class Version2 + { + public string Value { get; set; } + } + + public class Software2 + { + public DisplayName2 DisplayName { get; set; } + public Name3 Name { get; set; } + public OptionKeys OptionKeys { get; set; } + public ReleaseDate ReleaseDate { get; set; } + public Version2 Version { get; set; } + } + + public class NumberOfActiveCalls + { + public string Value { get; set; } + } + + public class NumberOfInProgressCalls + { + public string Value { get; set; } + } + + public class NumberOfSuspendedCalls + { + public string Value { get; set; } + } + + public class State2 + { + public NumberOfActiveCalls NumberOfActiveCalls { get; set; } + public NumberOfInProgressCalls NumberOfInProgressCalls { get; set; } + public NumberOfSuspendedCalls NumberOfSuspendedCalls { get; set; } + } + + public class Uptime + { + public string Value { get; set; } + } + + public class SystemUnit + { + public Hardware Hardware { get; set; } + public ProductId ProductId { get; set; } + public ProductPlatform ProductPlatform { get; set; } + public ProductType ProductType { get; set; } + public Software2 Software { get; set; } + public State2 State { get; set; } + public Uptime Uptime { get; set; } + } + + public class SystemTime + { + public DateTime Value { get; set; } + } + + public class Time + { + public SystemTime SystemTime { get; set; } + } + + public class Number + { + public string Value { get; set; } + } + + public class ContactMethod + { + public string id { get; set; } + public Number Number { get; set; } + } + + public class Name4 + { + public string Value { get; set; } + } + + public class ContactInfo + { + public List ContactMethod { get; set; } + public Name4 Name { get; set; } + } + + public class UserInterface + { + public ContactInfo ContactInfo { get; set; } + } + + public class PIPPosition + { + public string Value { get; set; } + } + + public class ActiveSpeaker2 + { + public PIPPosition PIPPosition { get; set; } + } + + public class Connected2 + { + public string Value { get; set; } + } + + public class SignalState + { + public string Value { get; set; } + } + + public class SourceId + { + public string Value { get; set; } + } + + public class Type3 + { + public string Value { get; set; } + } + + public class Connector + { + public string id { get; set; } + public Connected2 Connected { get; set; } + public SignalState SignalState { get; set; } + public SourceId SourceId { get; set; } + public Type3 Type { get; set; } + } + + public class MainVideoSource + { + public string Value { get; set; } + } + + public class ConnectorId + { + public string Value { get; set; } + } + + public class FormatStatus + { + public string Value { get; set; } + } + + public class FormatType + { + public string Value { get; set; } + } + + public class MediaChannelId + { + public string Value { get; set; } + } + + public class Height + { + public string Value { get; set; } + } + + public class RefreshRate + { + public string Value { get; set; } + } + + public class Width + { + public string Value { get; set; } + } + + public class Resolution + { + public Height Height { get; set; } + public RefreshRate RefreshRate { get; set; } + public Width Width { get; set; } + } + + public class Source + { + public string id { get; set; } + public ConnectorId ConnectorId { get; set; } + public FormatStatus FormatStatus { get; set; } + public FormatType FormatType { get; set; } + public MediaChannelId MediaChannelId { get; set; } + public Resolution Resolution { get; set; } + } + + public class Input2 + { + public List Connector { get; set; } + public MainVideoSource MainVideoSource { get; set; } + public List Source { get; set; } + } + + public class Local + { + public string Value { get; set; } + } + + public class LayoutFamily + { + public Local Local { get; set; } + } + + public class Layout + { + public LayoutFamily LayoutFamily { get; set; } + } + + public class Monitors + { + public string Value { get; set; } + } + + public class Connected3 + { + public string Value { get; set; } + } + + public class Name5 + { + public string Value { get; set; } + } + + public class PreferredFormat + { + public string Value { get; set; } + } + + public class ConnectedDevice2 + { + public Name5 Name { get; set; } + public PreferredFormat PreferredFormat { get; set; } + } + + public class MonitorRole + { + public string Value { get; set; } + } + + public class Height2 + { + public string Value { get; set; } + } + + public class RefreshRate2 + { + public string Value { get; set; } + } + + public class Width2 + { + public string Value { get; set; } + } + + public class Resolution2 + { + public Height2 Height { get; set; } + public RefreshRate2 RefreshRate { get; set; } + public Width2 Width { get; set; } + } + + public class Type4 + { + public string Value { get; set; } + } + + public class Connector2 + { + public string id { get; set; } + public Connected3 Connected { get; set; } + public ConnectedDevice2 ConnectedDevice { get; set; } + public MonitorRole MonitorRole { get; set; } + public Resolution2 Resolution { get; set; } + public Type4 Type { get; set; } + } + + public class Output2 + { + public List Connector { get; set; } + } + + public class PIPPosition2 + { + public string Value { get; set; } + } + + public class Presentation2 + { + public PIPPosition2 PIPPosition { get; set; } + } + + public class FullscreenMode + { + public string Value { get; set; } + } + + public class Mode8 + { + public string Value { get; set; } + } + + public class OnMonitorRole + { + public string Value { get; set; } + } + + public class PIPPosition3 + { + public string Value { get; set; } + } + + public class Selfview + { + public FullscreenMode FullscreenMode { get; set; } + public Mode8 Mode { get; set; } + public OnMonitorRole OnMonitorRole { get; set; } + public PIPPosition3 PIPPosition { get; set; } + } + + public class Video + { + public ActiveSpeaker2 ActiveSpeaker { get; set; } + public Input2 Input { get; set; } + public Layout Layout { get; set; } + public Monitors Monitors { get; set; } + public Output2 Output { get; set; } + public Presentation2 Presentation { get; set; } + public Selfview Selfview { get; set; } + } + + public class AnswerState + { + public string Value { get; set; } + } + + public class CallType + { + public string Value { get; set; } + } + + public class CallbackNumber + { + public string Value { get; set; } + } + + public class DeviceType + { + public string Value { get; set; } + } + + public class Direction + { + public string Value { get; set; } + } + + public class Duration + { + public string Value { get; set; } + } + + + public class FacilityServiceId + { + public string Value { get; set; } + } + + public class HoldReason + { + public string Value { get; set; } + } + + public class PlacedOnHold + { + public string Value { get; set; } + } + + public class Protocol + { + public string Value { get; set; } + } + + public class ReceiveCallRate + { + public string Value { get; set; } + } + + public class RemoteNumber + { + public string Value { get; set; } + } + + public class TransmitCallRate + { + public string Value { get; set; } + } + + public class Call + { + public string id { get; set; } + public AnswerState AnswerState { get; set; } + public CallType CallType { get; set; } + public CallbackNumber CallbackNumber { get; set; } + public DeviceType DeviceType { get; set; } + public Direction Direction { get; set; } + public DisplayName DisplayName { get; set; } + public Duration Duration { get; set; } + public Encryption Encryption { get; set; } + public FacilityServiceId FacilityServiceId { get; set; } + public HoldReason HoldReason { get; set; } + public PlacedOnHold PlacedOnHold { get; set; } + public Protocol Protocol { get; set; } + public ReceiveCallRate ReceiveCallRate { get; set; } + public RemoteNumber RemoteNumber { get; set; } + public Status2 Status { get; set; } + public TransmitCallRate TransmitCallRate { get; set; } + + public Call() + { + CallType = new CallType(); + Status = new Status2(); + } + } + + public class Status + { + public Audio Audio { get; set; } + public Bookings Bookings { get; set; } + public List Call { get; set; } + public Cameras Cameras { get; set; } + public Capabilities2 Capabilities { get; set; } + public Conference2 Conference { get; set; } + public Diagnostics Diagnostics { get; set; } + public Experimental Experimental { get; set; } + public H323 H323 { get; set; } + public List HttpFeedback { get; set; } + public MediaChannels MediaChannels { get; set; } + public List Network { get; set; } + public NetworkServices NetworkServices { get; set; } + public Peripherals Peripherals { get; set; } + public Provisioning Provisioning { get; set; } + public Proximity Proximity { get; set; } + public RoomAnalytics RoomAnalytics { get; set; } + public SIP SIP { get; set; } + public Security Security { get; set; } + public Standby Standby { get; set; } + public SystemUnit SystemUnit { get; set; } + public Time Time { get; set; } + public UserInterface UserInterface { get; set; } + public Video Video { get; set; } + + public Status() + { + Audio = new Audio(); + Call = new List(); Standby = new Standby(); Cameras = new Cameras(); - RoomAnalytics = new RoomAnalytics(); - } -#warning Figure out how to flag codec as InCall if Call.Count > 0 - } - - public class RootObject - { - public Status Status { get; set; } - - public RootObject() - { - Status = new Status(); - } - } - } -} + RoomAnalytics = new RoomAnalytics(); + Conference = new Conference2(); + } + } + + public class RootObject + { + public Status Status { get; set; } + + public RootObject() + { + Status = new Status(); + } + } + } +} diff --git a/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs b/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs index 8de1f2a3..53e5e2f1 100644 --- a/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs +++ b/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs @@ -66,30 +66,28 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec public override void Dial(string s) { Debug.Console(1, this, "Dial: {0}", s); - var item = new CodecActiveCallItem() { Name = s, Number = s, Id = s, Status = eCodecCallStatus.Dialing }; - ActiveCalls.Add(item); - OnCallStatusChange(eCodecCallStatus.Unknown, item.Status, item); + var call = new CodecActiveCallItem() { Name = s, Number = s, Id = s, Status = eCodecCallStatus.Dialing }; + ActiveCalls.Add(call); + OnCallStatusChange(eCodecCallStatus.Unknown, call.Status, call); ActiveCallCountFeedback.FireUpdate(); - // Simulate 2-second ring + // Simulate 2-second ring, then connecting, then connected new CTimer(o => { - var prevStatus = item.Status; - item.Status = eCodecCallStatus.Connected; - item.Type = eCodecCallType.Video; - OnCallStatusChange(prevStatus, item.Status, item); + call.Type = eCodecCallType.Video; + SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Connecting, call); + new CTimer(oo => SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Connected, call), 1000); }, 2000); } /// /// /// - public override void EndCall(CodecActiveCallItem activeCall) + public override void EndCall(CodecActiveCallItem call) { Debug.Console(1, this, "EndCall"); - ActiveCalls.Remove(activeCall); - var prevStatus = activeCall.Status; - activeCall.Status = eCodecCallStatus.Disconnected; - OnCallStatusChange(prevStatus, activeCall.Status, activeCall); + ActiveCalls.Remove(call); + + SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call); ActiveCallCountFeedback.FireUpdate(); } @@ -99,23 +97,29 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec public override void EndAllCalls() { Debug.Console(1, this, "EndAllCalls"); - ActiveCalls.Clear(); + foreach (var call in ActiveCalls) + { + ActiveCalls.Remove(call); + SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call); + } ActiveCallCountFeedback.FireUpdate(); } /// /// For a call from the test methods below /// - public override void AcceptCall(CodecActiveCallItem item) + public override void AcceptCall(CodecActiveCallItem call) { Debug.Console(1, this, "AcceptCall"); - + SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Connecting, call); + new CTimer(o => SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Connected, call), 1000); + // should already be in active list } /// /// For a call from the test methods below /// - public override void RejectCall(CodecActiveCallItem item) + public override void RejectCall(CodecActiveCallItem call) { Debug.Console(1, this, "RejectCall"); } @@ -247,16 +251,32 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec /// /// /// - public void TestIncomingCall(string url) + public void TestIncomingVideoCall(string url) { - Debug.Console(1, this, "TestIncomingCall from {0}", url); - var item = new CodecActiveCallItem() { Name = url, Id = url, Number = url, Status = eCodecCallStatus.Incoming, Type= eCodecCallType.Unknown }; - ActiveCalls.Add(item); + Debug.Console(1, this, "TestIncomingVideoCall from {0}", url); + var call = new CodecActiveCallItem() { Name = url, Id = url, Number = url, Type= eCodecCallType.Video }; + ActiveCalls.Add(call); + SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Incoming, call); _IncomingCall = true; IncomingCallFeedback.FireUpdate(); - + ActiveCallCountFeedback.FireUpdate(); } + /// + /// + /// + /// + public void TestIncomingAudioCall(string url) + { + Debug.Console(1, this, "TestIncomingAudioCall from {0}", url); + var call = new CodecActiveCallItem() { Name = url, Id = url, Number = url, Type = eCodecCallType.Audio }; + ActiveCalls.Add(call); + SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Incoming, call); + _IncomingCall = true; + IncomingCallFeedback.FireUpdate(); + ActiveCallCountFeedback.FireUpdate(); + } + /// /// /// @@ -266,6 +286,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec } + /// + /// + /// public void ListCalls() { var sb = new StringBuilder(); @@ -278,7 +301,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec public RoutingPortCollection OutputPorts { - get { throw new NotImplementedException(); } + get { return new RoutingPortCollection(); } } #endregion diff --git a/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs b/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs index 7032dbe5..304fe1d8 100644 --- a/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs +++ b/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs @@ -35,9 +35,18 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec #endregion /// - /// Returns true when ActiveCallCountFeedback is > 0 - /// - public bool IsInCall { get { return ActiveCallCountFeedback.IntValue > 0; } } + /// Returns whether any call in ActiveCalls is actually "active" + /// + public bool IsInCall + { + get + { + return ActiveCalls.Any(c => + !(c.Status == eCodecCallStatus.Unknown + || c.Status == eCodecCallStatus.Disconnected + || c.Status == eCodecCallStatus.Disconnecting)); + } + } public BoolFeedback IncomingCallFeedback { get; private set; } @@ -87,11 +96,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec #region IHasDialer Members public abstract void Dial(string s); - public void EndCall(object activeCall) - { - - } - public abstract void EndCall(CodecActiveCallItem activeCall); + public abstract void EndCall(CodecActiveCallItem call); public abstract void EndAllCalls(); public abstract void AcceptCall(CodecActiveCallItem call); public abstract void RejectCall(CodecActiveCallItem call); @@ -115,13 +120,24 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec public abstract void ExecuteSwitch(object selector); /// - /// + /// Helper method to fire CallStatusChange event with old and new status + /// + protected void SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus newStatus, CodecActiveCallItem call) + { + var prevStatus = call.Status; + call.Status = newStatus; + OnCallStatusChange(prevStatus, newStatus, call); + } + + /// + /// Helper method to notify of call status change event /// /// /// /// protected void OnCallStatusChange(eCodecCallStatus previousStatus, eCodecCallStatus newStatus, CodecActiveCallItem item) - { + { + Debug.Console(1, this, "Call Status Changed from {0} to {1} on call {2}", previousStatus, newStatus, item.Id); var handler = CallStatusChange; if (handler != null) handler(this, new CodecCallStatusItemChangeEventArgs(previousStatus, newStatus, item)); diff --git a/Essentials/PepperDashEssentials/ControlSystem.cs b/Essentials/PepperDashEssentials/ControlSystem.cs index b9e6e5f6..ea17997f 100644 --- a/Essentials/PepperDashEssentials/ControlSystem.cs +++ b/Essentials/PepperDashEssentials/ControlSystem.cs @@ -31,7 +31,7 @@ namespace PepperDash.Essentials { //CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Reloads configuration file", // ConsoleAccessLevelEnum.AccessOperator); - //CrestronConsole.AddNewConsoleCommand(s => TearDown(), "ungo", "Reloads configuration file", + //CrestronConsole.AddNewConsoleCommand(s => TearDown(), "ungo", "Unloads configuration file", // ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => { diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz index 5e18ade3..849b24fc 100644 Binary files a/Release Package/PepperDashEssentials.cpz and b/Release Package/PepperDashEssentials.cpz differ diff --git a/Release Package/PepperDashEssentials.dll b/Release Package/PepperDashEssentials.dll index f4e7788c..d92b4ced 100644 Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ