Adds call history messages to VideoCodecBaseMessenger. Removes all call related messages from CotijaEssentialsHuddleSpaceRoomBridge

This commit is contained in:
Neil Dorin
2018-12-19 16:03:08 -07:00
parent 3a3f6db692
commit 034c6913f7
3 changed files with 98 additions and 54 deletions

View File

@@ -41,8 +41,32 @@ namespace PepperDash.Essentials.AppServer.Messengers
{ {
dirCodec.DirectoryResultReturned += new EventHandler<DirectoryEventArgs>(dirCodec_DirectoryResultReturned); dirCodec.DirectoryResultReturned += new EventHandler<DirectoryEventArgs>(dirCodec_DirectoryResultReturned);
} }
var recCodec = codec as IHasCallHistory;
if (recCodec != null)
{
recCodec.CallHistory.RecentCallsListHasChanged += new EventHandler<EventArgs>(CallHistory_RecentCallsListHasChanged);
}
} }
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void CallHistory_RecentCallsListHasChanged(object sender, EventArgs e)
{
var recents = (sender as CodecCallHistory).RecentCalls;
if (recents != null)
{
PostStatusMessage(new
{
recentCalls = recents
});
}
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@@ -50,7 +74,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// <param name="e"></param> /// <param name="e"></param>
void dirCodec_DirectoryResultReturned(object sender, DirectoryEventArgs e) void dirCodec_DirectoryResultReturned(object sender, DirectoryEventArgs e)
{ {
var dir = e.Directory;
PostStatusMessage(new PostStatusMessage(new
{ {
currentDirectory = e.Directory currentDirectory = e.Directory
@@ -102,6 +125,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
appServerController.AddAction(MessagePath + "/directoryRoot", new Action(GetDirectoryRoot)); appServerController.AddAction(MessagePath + "/directoryRoot", new Action(GetDirectoryRoot));
appServerController.AddAction(MessagePath + "/directoryById", new Action<string>(s => GetDirectory(s))); appServerController.AddAction(MessagePath + "/directoryById", new Action<string>(s => GetDirectory(s)));
appServerController.AddAction(MessagePath + "/directorySearch", new Action<string>(s => DirectorySearch(s))); appServerController.AddAction(MessagePath + "/directorySearch", new Action<string>(s => DirectorySearch(s)));
appServerController.AddAction(MessagePath + "/getCallHistory", new Action(GetCallHistory));
appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(Codec.PrivacyModeOn)); appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(Codec.PrivacyModeOn));
appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(Codec.PrivacyModeOff)); appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(Codec.PrivacyModeOff));
appServerController.AddAction(MessagePath + "/privacyModeToggle", new Action(Codec.PrivacyModeToggle)); 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)); 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() public void GetFullStatusMessage()
{ {
@@ -228,7 +270,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
sipURI = info.SipUri sipURI = info.SipUri
}, },
showSelfViewByDefault = Codec.ShowSelfViewByDefault, showSelfViewByDefault = Codec.ShowSelfViewByDefault,
hasDirectory = Codec is IHasDirectory hasDirectory = Codec is IHasDirectory,
hasRecents = Codec is IHasCallHistory,
hasCameras = Codec is IHasCameraControl
}); });
} }
} }

View File

@@ -100,7 +100,7 @@ namespace PepperDash.Essentials
VCMessenger.RegisterWithAppServer(Parent); VCMessenger.RegisterWithAppServer(Parent);
// May need to move this or remove this // May need to move this or remove this
codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange); //codec.CallStatusChange += new EventHandler<CodecCallStatusItemChangeEventArgs>(codec_CallStatusChange);
vcRoom.IsSharingFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(IsSharingFeedback_OutputChange); vcRoom.IsSharingFeedback.OutputChange += new EventHandler<FeedbackEventArgs>(IsSharingFeedback_OutputChange);
@@ -170,18 +170,18 @@ namespace PepperDash.Essentials
}); });
} }
/// <summary> ///// <summary>
/// Handler for codec changes ///// Handler for codec changes
/// </summary> ///// </summary>
void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e) //void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e)
{ //{
PostStatusMessage(new // PostStatusMessage(new
{ // {
calls = GetCallsMessageObject(), // calls = GetCallsMessageObject(),
//vtc = GetVtcCallsMessageObject() // //vtc = GetVtcCallsMessageObject()
}); // });
} //}
/// <summary> /// <summary>
/// Helper for posting status message /// Helper for posting status message
@@ -426,52 +426,52 @@ namespace PepperDash.Essentials
PostStatusMessage(new PostStatusMessage(new
{ {
calls = GetCallsMessageObject(), //calls = GetCallsMessageObject(),
isOn = room.OnFeedback.BoolValue, isOn = room.OnFeedback.BoolValue,
selectedSourceKey = sourceKey, selectedSourceKey = sourceKey,
vtc = GetVtcCallsMessageObject(), //vtc = GetVtcCallsMessageObject(),
volumes = volumes volumes = volumes
}); });
} }
/// <summary> ///// <summary>
/// Helper to return a anonymous object with the call data for JSON message ///// Helper to return a anonymous object with the call data for JSON message
/// </summary> ///// </summary>
/// <returns></returns> ///// <returns></returns>
object GetCallsMessageObject() //object GetCallsMessageObject()
{ //{
var callRm = Room as IHasVideoCodec; // var callRm = Room as IHasVideoCodec;
if (callRm == null) // if (callRm == null)
return null; // return null;
return new // return new
{ // {
activeCalls = callRm.VideoCodec.ActiveCalls, // activeCalls = callRm.VideoCodec.ActiveCalls,
callType = callRm.CallTypeFeedback.IntValue, // callType = callRm.CallTypeFeedback.IntValue,
inCall = callRm.InCallFeedback.BoolValue, // inCall = callRm.InCallFeedback.BoolValue,
isSharing = callRm.IsSharingFeedback.BoolValue, // isSharing = callRm.IsSharingFeedback.BoolValue,
privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue // privacyModeIsOn = callRm.PrivacyModeIsOnFeedback.BoolValue
}; // };
} //}
/// <summary> ///// <summary>
/// Helper method to build call status for vtc ///// Helper method to build call status for vtc
/// </summary> ///// </summary>
/// <returns></returns> ///// <returns></returns>
object GetVtcCallsMessageObject() //object GetVtcCallsMessageObject()
{ //{
var callRm = Room as IHasVideoCodec; // var callRm = Room as IHasVideoCodec;
object vtc = null; // object vtc = null;
if (callRm != null) // if (callRm != null)
{ // {
var codec = callRm.VideoCodec; // var codec = callRm.VideoCodec;
vtc = new // vtc = new
{ // {
isInCall = codec.IsInCall, // isInCall = codec.IsInCall,
calls = codec.ActiveCalls // calls = codec.ActiveCalls
}; // };
} // }
return vtc; // return vtc;
} //}
} }
/// <summary> /// <summary>