diff --git a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs index 17c319e1..7c0fc0c6 100644 --- a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs @@ -40,6 +40,20 @@ namespace PepperDash.Essentials.AppServer.Messengers MessagePath = messagePath; Codec = codec; codec.CallStatusChange += new EventHandler(codec_CallStatusChange); + codec.IsReadyChange += new EventHandler(codec_IsReadyChange); + } + + /// + /// + /// + /// + /// + void codec_IsReadyChange(object sender, EventArgs e) + { + PostStatusMessage(new + { + isReady = true + }); } /// @@ -53,6 +67,8 @@ namespace PepperDash.Essentials.AppServer.Messengers AppServerController = appServerController; + appServerController.AddAction("/device/videoCodec/isReady", new Action(SendIsReady)); + appServerController.AddAction("/device/videoCodec/fullStatus", new Action(SendVtcFullMessageObject)); appServerController.AddAction("/device/videoCodec/dial", new Action(s => Codec.Dial(s))); appServerController.AddAction("/device/videoCodec/endCallById", new Action(s => { @@ -60,7 +76,7 @@ namespace PepperDash.Essentials.AppServer.Messengers if (call != null) Codec.EndCall(call); })); - appServerController.AddAction(MessagePath + "/endAllCalls", new Action(() => Codec.EndAllCalls())); + appServerController.AddAction(MessagePath + "/endAllCalls", new Action(Codec.EndAllCalls)); appServerController.AddAction(MessagePath + "/dtmf", new Action(s => Codec.SendDtmf(s))); appServerController.AddAction(MessagePath + "/rejectById", new Action(s => { @@ -74,13 +90,13 @@ namespace PepperDash.Essentials.AppServer.Messengers if (call != null) Codec.AcceptCall(call); })); - appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(() => Codec.PrivacyModeOn())); - appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(() => Codec.PrivacyModeOff())); - appServerController.AddAction(MessagePath + "/privacyModeToggle", new Action(() => Codec.PrivacyModeToggle())); - appServerController.AddAction(MessagePath + "/sharingStart", new Action(() => Codec.StartSharing())); - appServerController.AddAction(MessagePath + "/sharingStop", new Action(() => Codec.StopSharing())); - appServerController.AddAction(MessagePath + "/standbyOn", new Action(() => Codec.StandbyActivate())); - appServerController.AddAction(MessagePath + "/standbyOff", new Action(() => Codec.StandbyDeactivate())); + appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(Codec.PrivacyModeOn)); + appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(Codec.PrivacyModeOff)); + appServerController.AddAction(MessagePath + "/privacyModeToggle", new Action(Codec.PrivacyModeToggle)); + appServerController.AddAction(MessagePath + "/sharingStart", new Action(Codec.StartSharing)); + appServerController.AddAction(MessagePath + "/sharingStop", new Action(Codec.StopSharing)); + appServerController.AddAction(MessagePath + "/standbyOn", new Action(Codec.StandbyActivate)); + appServerController.AddAction(MessagePath + "/standbyOff", new Action(Codec.StandbyDeactivate)); } public void GetFullStatusMessage() @@ -102,25 +118,33 @@ namespace PepperDash.Essentials.AppServer.Messengers /// Handler for codec changes /// void codec_CallStatusChange(object sender, CodecCallStatusItemChangeEventArgs e) + { + SendVtcFullMessageObject(); + } + + void SendIsReady() { PostStatusMessage(new { - vtc = GetVtcCallsMessageObject() + isReady = Codec.IsReady }); - } /// /// Helper method to build call status for vtc /// /// - object GetVtcCallsMessageObject() + void SendVtcFullMessageObject() { + if (!Codec.IsReady) + { + return; + } + var info = Codec.CodecInfo; - return new + PostStatusMessage(new { isInCall = Codec.IsInCall, - isReady = Codec.IsReady, privacyModeIsOn = Codec.PrivacyModeIsOnFeedback.BoolValue, sharingContentIsOn = Codec.SharingContentIsOnFeedback.BoolValue, sharingSource = Codec.SharingSourceFeedback.StringValue, @@ -132,12 +156,11 @@ namespace PepperDash.Essentials.AppServer.Messengers e164Alias = info.E164Alias, h323Id = info.H323Id, ipAddress = info.IpAddress, - multiSiteEnabled = info.MultiSiteOptionIsEnabled, sipPhoneNumber = info.SipPhoneNumber, sipURI = info.SipUri }, showSelfViewByDefault = Codec.ShowSelfViewByDefault - }; + }); } ///