diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs b/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs index b05a3a9d..48ffa977 100644 --- a/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs +++ b/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs @@ -15,8 +15,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec Disconnected, Disconnecting, EarlyMedia, - Idle, - Incoming, + Idle, OnHold, Ringing, Preserved, @@ -64,10 +63,6 @@ namespace PepperDash.Essentials.Devices.Common.Codec { return eCodecCallStatus.Idle; } - case "Incoming": - { - return eCodecCallStatus.Incoming; - } case "OnHold": { return eCodecCallStatus.OnHold; diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/iCodecInfo.cs b/Essentials Devices Common/Essentials Devices Common/Codec/iCodecInfo.cs new file mode 100644 index 00000000..5b778f86 --- /dev/null +++ b/Essentials Devices Common/Essentials Devices Common/Codec/iCodecInfo.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Devices.Common.Codec +{ + /// + /// Implements a common set of data about a codec + /// + public interface iCodecInfo + { + VideoCodecInfo CodecInfo { get; } + } + + /// + /// Stores general information about a codec + /// + public abstract class VideoCodecInfo + { + public abstract bool MultiSiteOptionIsEnabled { get; } + public abstract string IpAddress { get; } + public abstract string PhoneNumber { get; } + public abstract string SipUri { get; } + public abstract bool AutoAnswerEnabled { get; } + } +} \ 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 fd3d52e6..c6efdea9 100644 --- a/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj +++ b/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj @@ -107,6 +107,7 @@ + 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 5e6cb60b..2f14ab2f 100644 --- a/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs +++ b/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs @@ -156,8 +156,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco public bool CommDebuggingIsOn; - public bool MultiSiteOptionIsEnabled; - string Delimiter = "\r\n"; int PresentationSource; @@ -211,6 +209,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco CodecConfiguration = new CiscoCodecConfiguration.RootObject(); CodecStatus = new CiscoCodecStatus.RootObject(); + CodecInfo = new CiscoCodecInfo(CodecStatus, CodecConfiguration); + CallHistory = new CodecCallHistory(); CallFavorites = new CodecCallFavorites(); @@ -498,8 +498,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { SyncState.InitialStatusMessageReceived(); - SetStatusProperties(CodecStatus); - if (!SyncState.InitialConfigurationMessageWasReceived) SendText("xConfiguration"); } @@ -644,17 +642,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco protected override Func IncomingCallFeedbackFunc { get { return () => false; } } - - /// - /// Sets the properties based on a complete status message return - /// - /// - private void SetStatusProperties(CiscoCodecStatus.RootObject status) - { - if (status.Status.SystemUnit.Software.OptionKeys.MultiSite.Value == "true") - MultiSiteOptionIsEnabled = true; - } - /// /// Gets the first CallId or returns null /// @@ -917,6 +904,73 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { SendText(string.Format("xCommand CallHistory DeleteEntry CallHistoryId: {0} AcknowledgeConsecutiveDuplicates: True", entry.OccurrenceHistoryId)); } + + public class CiscoCodecInfo : VideoCodecInfo + { + public CiscoCodecStatus.RootObject CodecStatus { get; private set; } + + public CiscoCodecConfiguration.RootObject CodecConfiguration { get; private set; } + + public override bool MultiSiteOptionIsEnabled + { + get + { + if (CodecStatus.Status.SystemUnit.Software.OptionKeys.MultiSite.Value.ToLower() == "true") + return true; + else + return false; + } + + } + public override string IpAddress + { + get + { + if (CodecConfiguration.Configuration.Network != null) + { + if (CodecConfiguration.Configuration.Network.Count > 0) + return CodecConfiguration.Configuration.Network[0].IPv4.Address.Value; + } + return string.Empty; + } + } + public override string PhoneNumber + { + get + { + if (CodecConfiguration.Configuration.H323.H323Alias.E164 != null) + return CodecConfiguration.Configuration.H323.H323Alias.E164.Value; + else + return string.Empty; + } + } + public override string SipUri + { + get + { + if (CodecConfiguration.Configuration.H323.H323Alias.ID != null) + return CodecConfiguration.Configuration.H323.H323Alias.ID.Value; + else + return string.Empty; + } + } + public override bool AutoAnswerEnabled + { + get + { + if (CodecConfiguration.Configuration.Conference.AutoAnswer.Mode.Value.ToLower() == "on") + return true; + else + return false; + } + } + + public CiscoCodecInfo(CiscoCodecStatus.RootObject status, CiscoCodecConfiguration.RootObject configuration) + { + CodecStatus = status; + CodecConfiguration = configuration; + } + } } /// @@ -1091,4 +1145,5 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco InitialSyncComplete = false; } } + } \ No newline at end of file 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 430f4008..777ce01b 100644 --- a/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs +++ b/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs @@ -269,9 +269,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec public void TestIncomingVideoCall(string url) { Debug.Console(1, this, "TestIncomingVideoCall from {0}", url); - var call = new CodecActiveCallItem() { Name = url, Id = url, Number = url, Type= eCodecCallType.Video }; + var call = new CodecActiveCallItem() { Name = url, Id = url, Number = url, Type= eCodecCallType.Video, Direction = eCodecCallDirection.Incoming }; ActiveCalls.Add(call); - SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Incoming, call); + SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Ringing, call); _IncomingCall = true; IncomingCallFeedback.FireUpdate(); } @@ -283,9 +283,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec 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 }; + var call = new CodecActiveCallItem() { Name = url, Id = url, Number = url, Type = eCodecCallType.Audio, Direction = eCodecCallDirection.Incoming }; ActiveCalls.Add(call); - SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Incoming, call); + SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Ringing, call); _IncomingCall = true; IncomingCallFeedback.FireUpdate(); } diff --git a/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs b/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs index 83bee63c..9d664fda 100644 --- a/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs +++ b/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs @@ -11,7 +11,7 @@ using PepperDash.Essentials.Devices.Common.Codec; namespace PepperDash.Essentials.Devices.Common.VideoCodec { - public abstract class VideoCodecBase : Device, IRoutingInputsOutputs, IUsageTracking, IHasDialer, IHasSharing, ICodecAudio + public abstract class VideoCodecBase : Device, IRoutingInputsOutputs, IUsageTracking, IHasDialer, IHasSharing, ICodecAudio, iCodecInfo { /// /// Fires when the status of any active, dialing, or incoming call changes or is new @@ -45,7 +45,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec abstract protected Func MuteFeedbackFunc { get; } abstract protected Func SharingSourceFeedbackFunc { get; } - public List ActiveCalls { get; set; } + public List ActiveCalls { get; set; } + + public VideoCodecInfo CodecInfo { get; protected set; } public VideoCodecBase(string key, string name) : base(key, name) @@ -59,7 +61,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec InputPorts = new RoutingPortCollection(); OutputPorts = new RoutingPortCollection(); - ActiveCalls = new List(); + ActiveCalls = new List(); } #region IHasDialer Members @@ -157,7 +159,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec foreach (var c in ActiveCalls) sb.AppendFormat("{0} {1} -- {2} {3}\r", c.Id, c.Number, c.Name, c.Status); Debug.Console(1, "{0}", sb.ToString()); - } + } + } /// diff --git a/Essentials/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs index 8b518391..417ee8a4 100644 --- a/Essentials/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs +++ b/Essentials/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs @@ -160,10 +160,6 @@ namespace PepperDash.Essentials.UIDrivers.VC break; case eCodecCallStatus.Idle: break; - case eCodecCallStatus.Incoming: - // fire up a modal - ShowIncomingModal(call); - break; case eCodecCallStatus.OnHold: break; case eCodecCallStatus.Preserved: @@ -171,7 +167,12 @@ namespace PepperDash.Essentials.UIDrivers.VC case eCodecCallStatus.RemotePreserved: break; case eCodecCallStatus.Ringing: - break; + { + // fire up a modal + if( !Codec.CodecInfo.AutoAnswerEnabled && call.Direction == eCodecCallDirection.Incoming) + ShowIncomingModal(call); + break; + } default: break; }