Tuning up InCall statuses, removed ActiveCallCountFB

This commit is contained in:
Heath Volmer
2017-09-20 16:57:49 -06:00
parent 82465e8789
commit ca3f6d4d14
10 changed files with 153 additions and 60 deletions

View File

@@ -20,5 +20,20 @@ namespace PepperDash.Essentials.Devices.Common.Codec
public string Id { get; set; }
public object CallMetaData { get; set; }
/// <summary>
/// Returns true when this call is NOT status Unkown,
/// Disconnected, Disconnecting
/// </summary>
public bool IsActiveCall
{
get
{
return
!(Status == eCodecCallStatus.Disconnected
|| Status == eCodecCallStatus.Disconnecting
|| Status ==eCodecCallStatus.Unknown);
}
}
}
}

View File

@@ -5,10 +5,21 @@ using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Devices.Common.Codec
{
public enum eCodecCallStatus
{
Unknown = 0, Dialing, Connected, Connecting, Incoming, OnHold, Disconnected
Connected,
Connecting,
Dialing,
Disconnected,
Disconnecting,
EarlyMedia,
Idle,
Incoming,
OnHold,
Ringing,
Preserved,
RemotePreserved,
Unknown = 0
}
}

View File

@@ -22,7 +22,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec
void RejectCall(CodecActiveCallItem item);
void SendDtmf(string digit);
IntFeedback ActiveCallCountFeedback { get; }
//IntFeedback ActiveCallCountFeedback { get; }
BoolFeedback IncomingCallFeedback { get; }
}
}

View File

@@ -799,11 +799,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
SendText("xCommand SystemUnit Boot Action: Restart");
}
protected override Func<int> ActiveCallCountFeedbackFunc
{
get { return () => 0; }
}
}
/// <summary>

View File

@@ -17,7 +17,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
: base(key, name)
{
// Debug helpers
ActiveCallCountFeedback.OutputChange += (o, a) => Debug.Console(1, this, "InCall={0}", ActiveCallCountFeedback.IntValue);
//ActiveCallCountFeedback.OutputChange += (o, a) => Debug.Console(1, this, "InCall={0}", ActiveCallCountFeedback.IntValue);
IncomingCallFeedback.OutputChange += (o, a) => Debug.Console(1, this, "IncomingCall={0}", _IncomingCall);
MuteFeedback.OutputChange += (o, a) => Debug.Console(1, this, "Mute={0}", _IsMuted);
PrivacyModeIsOnFeedback.OutputChange += (o, a) => Debug.Console(1, this, "Privacy={0}", _PrivacyModeIsOn);
@@ -25,11 +25,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
VolumeLevelFeedback.OutputChange += (o, a) => Debug.Console(1, this, "Volume={0}", _VolumeLevel);
}
protected override Func<int> ActiveCallCountFeedbackFunc
{
get { return () => ActiveCalls.Count; }
}
protected override Func<bool> IncomingCallFeedbackFunc
{
get { return () => _IncomingCall; }
@@ -69,7 +64,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
var call = new CodecActiveCallItem() { Name = s, Number = s, Id = s, Status = eCodecCallStatus.Dialing };
ActiveCalls.Add(call);
OnCallStatusChange(eCodecCallStatus.Unknown, call.Status, call);
ActiveCallCountFeedback.FireUpdate();
//ActiveCallCountFeedback.FireUpdate();
// Simulate 2-second ring, then connecting, then connected
new CTimer(o =>
{
@@ -86,9 +81,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
Debug.Console(1, this, "EndCall");
ActiveCalls.Remove(call);
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call);
ActiveCallCountFeedback.FireUpdate();
//ActiveCallCountFeedback.FireUpdate();
}
/// <summary>
@@ -102,7 +96,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
ActiveCalls.Remove(call);
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call);
}
ActiveCallCountFeedback.FireUpdate();
//ActiveCallCountFeedback.FireUpdate();
}
/// <summary>
@@ -122,6 +116,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
public override void RejectCall(CodecActiveCallItem call)
{
Debug.Console(1, this, "RejectCall");
ActiveCalls.Remove(call);
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call);
//ActiveCallCountFeedback.FireUpdate();
}
/// <summary>
@@ -259,7 +256,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Incoming, call);
_IncomingCall = true;
IncomingCallFeedback.FireUpdate();
ActiveCallCountFeedback.FireUpdate();
//ActiveCallCountFeedback.FireUpdate();
}
/// <summary>
@@ -274,7 +271,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Incoming, call);
_IncomingCall = true;
IncomingCallFeedback.FireUpdate();
ActiveCallCountFeedback.FireUpdate();
//ActiveCallCountFeedback.FireUpdate();
}
/// <summary>

View File

@@ -35,15 +35,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
#endregion
/// <summary>
/// Returns true when ActiveCallCountFeedback is > 0
/// Returns true when any call is not in state Unknown, Disconnecting, Disconnected
/// </summary>
public bool IsInCall { get { return ActiveCallCountFeedback.IntValue > 0; } }
public bool IsInCall { get { return ActiveCalls.Any(c => c.IsActiveCall); } }
public BoolFeedback IncomingCallFeedback { get; private set; }
public IntFeedback ActiveCallCountFeedback { get; private set; }
//public IntFeedback ActiveCallCountFeedback { get; private set; }
abstract protected Func<int> ActiveCallCountFeedbackFunc { get; }
//abstract protected Func<int> ActiveCallCountFeedbackFunc { get; }
abstract protected Func<bool> IncomingCallFeedbackFunc { get; }
abstract protected Func<bool> PrivacyModeIsOnFeedbackFunc { get; }
abstract protected Func<int> VolumeLevelFeedbackFunc { get; }
@@ -55,7 +55,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
public VideoCodecBase(string key, string name)
: base(key, name)
{
ActiveCallCountFeedback = new IntFeedback(ActiveCallCountFeedbackFunc);
//ActiveCallCountFeedback = new IntFeedback(ActiveCallCountFeedbackFunc);
IncomingCallFeedback = new BoolFeedback(IncomingCallFeedbackFunc);
PrivacyModeIsOnFeedback = new BoolFeedback(PrivacyModeIsOnFeedbackFunc);
VolumeLevelFeedback = new IntFeedback(VolumeLevelFeedbackFunc);
@@ -64,7 +64,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
InputPorts = new RoutingPortCollection<RoutingInputPort>();
ActiveCallCountFeedback.OutputChange += new EventHandler<EventArgs>(ActiveCallCountFeedback_OutputChange);
//ActiveCallCountFeedback.OutputChange += new EventHandler<EventArgs>(ActiveCallCountFeedback_OutputChange);
ActiveCalls = new List<CodecActiveCallItem>();
}
@@ -74,16 +74,16 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void ActiveCallCountFeedback_OutputChange(object sender, EventArgs e)
{
if (UsageTracker != null)
{
if (IsInCall)
UsageTracker.StartDeviceUsage();
else
UsageTracker.EndDeviceUsage();
}
}
//void ActiveCallCountFeedback_OutputChange(object sender, EventArgs e)
//{
// if (UsageTracker != null)
// {
// if (IsInCall)
// UsageTracker.StartDeviceUsage();
// else
// UsageTracker.EndDeviceUsage();
// }
//}
#region IHasDialer Members
public abstract void Dial(string s);