From 034c6913f7b15a29f8736e56fe0904b371ebbad0 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 19 Dec 2018 16:03:08 -0700 Subject: [PATCH] Adds call history messages to VideoCodecBaseMessenger. Removes all call related messages from CotijaEssentialsHuddleSpaceRoomBridge --- .../Messengers/VideoCodecBaseMessenger.cs | 48 ++++++++- .../CotijaEssentialsHuddleSpaceRoomBridge.cs | 102 +++++++++--------- essentials-framework | 2 +- 3 files changed, 98 insertions(+), 54 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs index 3076cb56..af07366f 100644 --- a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs @@ -41,7 +41,31 @@ namespace PepperDash.Essentials.AppServer.Messengers { dirCodec.DirectoryResultReturned += new EventHandler(dirCodec_DirectoryResultReturned); } + + var recCodec = codec as IHasCallHistory; + if (recCodec != null) + { + recCodec.CallHistory.RecentCallsListHasChanged += new EventHandler(CallHistory_RecentCallsListHasChanged); + } } + + /// + /// + /// + /// + /// + void CallHistory_RecentCallsListHasChanged(object sender, EventArgs e) + { + var recents = (sender as CodecCallHistory).RecentCalls; + + if (recents != null) + { + PostStatusMessage(new + { + recentCalls = recents + }); + } + } /// /// @@ -50,7 +74,6 @@ namespace PepperDash.Essentials.AppServer.Messengers /// void dirCodec_DirectoryResultReturned(object sender, DirectoryEventArgs e) { - var dir = e.Directory; PostStatusMessage(new { currentDirectory = e.Directory @@ -102,6 +125,7 @@ namespace PepperDash.Essentials.AppServer.Messengers appServerController.AddAction(MessagePath + "/directoryRoot", new Action(GetDirectoryRoot)); appServerController.AddAction(MessagePath + "/directoryById", new Action(s => GetDirectory(s))); appServerController.AddAction(MessagePath + "/directorySearch", new Action(s => DirectorySearch(s))); + appServerController.AddAction(MessagePath + "/getCallHistory", new Action(GetCallHistory)); appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(Codec.PrivacyModeOn)); appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(Codec.PrivacyModeOff)); appServerController.AddAction(MessagePath + "/privacyModeToggle", new Action(Codec.PrivacyModeToggle)); @@ -111,6 +135,24 @@ namespace PepperDash.Essentials.AppServer.Messengers appServerController.AddAction(MessagePath + "/standbyOff", new Action(Codec.StandbyDeactivate)); } + void GetCallHistory() + { + var codec = (Codec as IHasCallHistory); + + if (codec != null) + { + var recents = codec.CallHistory.RecentCalls; + + if (recents != null) + { + PostStatusMessage(new + { + recentCalls = recents + }); + } + } + } + public void GetFullStatusMessage() { @@ -228,7 +270,9 @@ namespace PepperDash.Essentials.AppServer.Messengers sipURI = info.SipUri }, showSelfViewByDefault = Codec.ShowSelfViewByDefault, - hasDirectory = Codec is IHasDirectory + hasDirectory = Codec is IHasDirectory, + hasRecents = Codec is IHasCallHistory, + hasCameras = Codec is IHasCameraControl }); } } diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs index 36ae6c03..913158bb 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs @@ -100,7 +100,7 @@ namespace PepperDash.Essentials VCMessenger.RegisterWithAppServer(Parent); // May need to move this or remove this - codec.CallStatusChange += new EventHandler(codec_CallStatusChange); + //codec.CallStatusChange += new EventHandler(codec_CallStatusChange); vcRoom.IsSharingFeedback.OutputChange += new EventHandler(IsSharingFeedback_OutputChange); @@ -170,18 +170,18 @@ namespace PepperDash.Essentials }); } - /// - /// Handler for codec changes - /// - void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e) - { - PostStatusMessage(new - { - calls = GetCallsMessageObject(), - //vtc = GetVtcCallsMessageObject() - }); + ///// + ///// Handler for codec changes + ///// + //void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e) + //{ + // PostStatusMessage(new + // { + // calls = GetCallsMessageObject(), + // //vtc = GetVtcCallsMessageObject() + // }); - } + //} /// /// Helper for posting status message @@ -426,52 +426,52 @@ namespace PepperDash.Essentials PostStatusMessage(new { - calls = GetCallsMessageObject(), + //calls = GetCallsMessageObject(), isOn = room.OnFeedback.BoolValue, selectedSourceKey = sourceKey, - vtc = GetVtcCallsMessageObject(), + //vtc = GetVtcCallsMessageObject(), volumes = volumes }); } - /// - /// Helper to return a anonymous object with the call data for JSON message - /// - /// - object GetCallsMessageObject() - { - var callRm = Room as IHasVideoCodec; - if (callRm == null) - return null; - return new - { - activeCalls = callRm.VideoCodec.ActiveCalls, - callType = callRm.CallTypeFeedback.IntValue, - inCall = callRm.InCallFeedback.BoolValue, - isSharing = callRm.IsSharingFeedback.BoolValue, - privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue - }; - } + ///// + ///// Helper to return a anonymous object with the call data for JSON message + ///// + ///// + //object GetCallsMessageObject() + //{ + // var callRm = Room as IHasVideoCodec; + // if (callRm == null) + // return null; + // return new + // { + // activeCalls = callRm.VideoCodec.ActiveCalls, + // callType = callRm.CallTypeFeedback.IntValue, + // inCall = callRm.InCallFeedback.BoolValue, + // isSharing = callRm.IsSharingFeedback.BoolValue, + // privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue + // }; + //} - /// - /// Helper method to build call status for vtc - /// - /// - object GetVtcCallsMessageObject() - { - var callRm = Room as IHasVideoCodec; - object vtc = null; - if (callRm != null) - { - var codec = callRm.VideoCodec; - vtc = new - { - isInCall = codec.IsInCall, - calls = codec.ActiveCalls - }; - } - return vtc; - } + ///// + ///// Helper method to build call status for vtc + ///// + ///// + //object GetVtcCallsMessageObject() + //{ + // var callRm = Room as IHasVideoCodec; + // object vtc = null; + // if (callRm != null) + // { + // var codec = callRm.VideoCodec; + // vtc = new + // { + // isInCall = codec.IsInCall, + // calls = codec.ActiveCalls + // }; + // } + // return vtc; + //} } /// diff --git a/essentials-framework b/essentials-framework index d703be80..e5b7b411 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit d703be80d7512e10ae801103d45a794420182ba2 +Subproject commit e5b7b4112b9ef815f1edb92f1853f5e554f41173