mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-11 19:44:52 +00:00
Added CodecInfo object to VideoCodecBase
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements a common set of data about a codec
|
||||
/// </summary>
|
||||
public interface iCodecInfo
|
||||
{
|
||||
VideoCodecInfo CodecInfo { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores general information about a codec
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,7 @@
|
||||
<Compile Include="Codec\eCodecCallType.cs" />
|
||||
<Compile Include="Codec\eCodecCallStatus.cs" />
|
||||
<Compile Include="Codec\iCodecAudio.cs" />
|
||||
<Compile Include="Codec\iCodecInfo.cs" />
|
||||
<Compile Include="Codec\iHasCallFavorites.cs" />
|
||||
<Compile Include="Codec\iHasCallHistory.cs" />
|
||||
<Compile Include="Codec\iHasDialer.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<bool> IncomingCallFeedbackFunc { get { return () => false; } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the properties based on a complete status message return
|
||||
/// </summary>
|
||||
/// <param name="status"></param>
|
||||
private void SetStatusProperties(CiscoCodecStatus.RootObject status)
|
||||
{
|
||||
if (status.Status.SystemUnit.Software.OptionKeys.MultiSite.Value == "true")
|
||||
MultiSiteOptionIsEnabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the first CallId or returns null
|
||||
/// </summary>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1091,4 +1145,5 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
InitialSyncComplete = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 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<bool> MuteFeedbackFunc { get; }
|
||||
abstract protected Func<string> SharingSourceFeedbackFunc { get; }
|
||||
|
||||
public List<CodecActiveCallItem> ActiveCalls { get; set; }
|
||||
public List<CodecActiveCallItem> 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<RoutingInputPort>();
|
||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||
|
||||
ActiveCalls = new List<CodecActiveCallItem>();
|
||||
ActiveCalls = new List<CodecActiveCallItem>();
|
||||
}
|
||||
|
||||
#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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user