Various bug fixes

This commit is contained in:
Neil Dorin
2017-10-18 22:25:02 -06:00
parent 91cc452e03
commit b423d1cb58
10 changed files with 396 additions and 280 deletions

View File

@@ -15,6 +15,8 @@ namespace PepperDash.Essentials.Devices.Common.Codec
{
// Add requirements for Dialer functionality
event EventHandler<CodecCallStatusItemChangeEventArgs> CallStatusChange;
void Dial(string number);
void EndCall(CodecActiveCallItem activeCall);
void EndAllCalls();
@@ -22,6 +24,27 @@ namespace PepperDash.Essentials.Devices.Common.Codec
void RejectCall(CodecActiveCallItem item);
void SendDtmf(string digit);
BoolFeedback IncomingCallFeedback { get; }
//BoolFeedback IncomingCallFeedback { get; }
}
/// <summary>
///
/// </summary>
public class CodecCallStatusItemChangeEventArgs : EventArgs
{
public CodecActiveCallItem CallItem { get; private set; }
//public eCodecCallStatus PreviousStatus { get; private set; }
//public eCodecCallStatus NewStatus { get; private set; }
public CodecCallStatusItemChangeEventArgs(/*eCodecCallStatus previousStatus,
eCodecCallStatus newStatus,*/ CodecActiveCallItem item)
{
//PreviousStatus = previousStatus;
//NewStatus = newStatus;
CallItem = item;
}
}
}

View File

@@ -189,9 +189,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
}
}
#warning Figure out where this func is or disappeared to
protected override Func<bool> IncomingCallFeedbackFunc { get { return () => false; } }
private string CliFeedbackRegistrationExpression;
@@ -205,6 +202,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public bool CommDebuggingIsOn;
string Delimiter = "\r\n";
int PresentationSource;
@@ -242,8 +240,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
Communication = comm;
LoginMessageReceived = new CTimer(DisconnectClientAndReconnect, 5000);
if (props.CommunicationMonitorProperties != null)
{
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, props.CommunicationMonitorProperties);
@@ -253,6 +249,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 30000, 120000, 300000, "xStatus SystemUnit Software Version\r");
}
if (props.Sharing != null)
AutoShareContentWhileInCall = props.Sharing.AutoShareContentWhileInCall;
ShowSelfViewByDefault = props.ShowSelfViewByDefault;
DeviceManager.AddDevice(CommunicationMonitor);
PhonebookMode = props.PhonebookMode;
@@ -337,13 +338,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
/// <returns></returns>
public override bool CustomActivate()
{
//CrestronConsole.AddNewConsoleCommand(SendText, "send" + Key, "", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(SetCommDebug, "SetCodecCommDebug", "0 for Off, 1 for on", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(GetPhonebook, "GetCodecPhonebook", "Triggers a refresh of the codec phonebook", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(GetBookings, "GetCodecBookings", "Triggers a refresh of the booking data for today", ConsoleAccessLevelEnum.AccessOperator);
//CommDebuggingIsOn = true;
Communication.Connect();
LoginMessageReceived = new CTimer(DisconnectClientAndReconnect, 5000);
var socket = Communication as ISocketStatus;
if (socket != null)
{
@@ -550,22 +551,18 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
bool changeDetected = false;
eCodecCallStatus newStatus = eCodecCallStatus.Unknown;
// Update properties of ActiveCallItem
if(call.Status != null)
if (!string.IsNullOrEmpty(call.Status.Value))
{
eCodecCallStatus newStatus = eCodecCallStatus.Unknown;
newStatus = CodecCallStatus.ConvertToStatusEnum(call.Status.Value);
if (newStatus != eCodecCallStatus.Unknown)
{
changeDetected = true;
SetNewCallStatusAndFireCallStatusChange(newStatus, tempActiveCall);
}
tempActiveCall.Status = CodecCallStatus.ConvertToStatusEnum(call.Status.Value);
if (newStatus == eCodecCallStatus.Connected)
GetCallHistory();
changeDetected = true;
}
if (call.CallType != null)
if (!string.IsNullOrEmpty(call.CallType.Value))
@@ -590,6 +587,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
if (changeDetected)
{
SetSelfViewMode();
OnCallStatusChange(tempActiveCall);
ListCalls();
}
}
@@ -611,7 +610,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
ListCalls();
SetNewCallStatusAndFireCallStatusChange(newCallItem.Status, newCallItem);
SetSelfViewMode();
OnCallStatusChange(newCallItem);
}
}
@@ -756,6 +756,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
ListCalls();
SetSelfViewMode();
// Notify of the call disconnection
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, tempActiveCall);
@@ -1100,6 +1101,24 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
SendText("xCommand SystemUnit Boot Action: Restart");
}
/// <summary>
/// Sets SelfView Mode based on config
/// </summary>
void SetSelfViewMode()
{
if (!IsInCall)
{
SelfviewModeOff();
}
else
{
if (ShowSelfViewByDefault)
SelfviewModeOn();
else
SelfviewModeOff();
}
}
/// <summary>
/// Turns on Selfview Mode
/// </summary>

View File

@@ -13,8 +13,6 @@ namespace PepperDash.Essentials.Devices.Common.Codec
{
public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; }
//public ControlPropertiesConfig Control { get; set; }
public List<CodecActiveCallItem> Favorites { get; set; }
/// <summary>
@@ -22,5 +20,14 @@ namespace PepperDash.Essentials.Devices.Common.Codec
/// </summary>
public string PhonebookMode { get; set; }
public bool ShowSelfViewByDefault { get; set; }
public SharingProperties Sharing { get; set; }
}
public class SharingProperties
{
public bool AutoShareContentWhileInCall { get; set; }
}
}

View File

@@ -15,6 +15,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
BoolFeedback SelfviewIsOnFeedback { get; }
bool ShowSelfViewByDefault { get; }
void SelfviewModeOn();
void SelfviewModeOff();

View File

@@ -36,7 +36,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
}
// Debug helpers
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);
SharingSourceFeedback.OutputChange += (o, a) => Debug.Console(1, this, "SharingSource={0}", _SharingSource);
@@ -64,12 +63,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
SetIsReady();
}
protected override Func<bool> IncomingCallFeedbackFunc
{
get { return () => _IncomingCall; }
}
bool _IncomingCall;
protected override Func<bool> MuteFeedbackFunc
{
get { return () => _IsMuted; }
@@ -102,7 +95,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
Debug.Console(1, this, "Dial: {0}", number);
var call = new CodecActiveCallItem() { Name = number, Number = number, Id = number, Status = eCodecCallStatus.Dialing };
ActiveCalls.Add(call);
OnCallStatusChange(eCodecCallStatus.Unknown, call.Status, call);
OnCallStatusChange(call);
//ActiveCallCountFeedback.FireUpdate();
// Simulate 2-second ring, then connecting, then connected
new CTimer(o =>
@@ -299,8 +292,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
var call = new CodecActiveCallItem() { Name = url, Id = url, Number = url, Type= eCodecCallType.Video, Direction = eCodecCallDirection.Incoming };
ActiveCalls.Add(call);
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Ringing, call);
_IncomingCall = true;
IncomingCallFeedback.FireUpdate();
//OnCallStatusChange(eCodecCallStatus.Unknown, eCodecCallStatus.Ringing, call);
}
/// <summary>
@@ -313,8 +307,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
var call = new CodecActiveCallItem() { Name = url, Id = url, Number = url, Type = eCodecCallType.Audio, Direction = eCodecCallDirection.Incoming };
ActiveCalls.Add(call);
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Ringing, call);
_IncomingCall = true;
IncomingCallFeedback.FireUpdate();
//OnCallStatusChange(eCodecCallStatus.Unknown, eCodecCallStatus.Ringing, call);
}
/// <summary>

View File

@@ -40,9 +40,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// </summary>
public bool IsInCall { get { return ActiveCalls.Any(c => c.IsActiveCall); } }
public BoolFeedback IncomingCallFeedback { get; private set; }
abstract protected Func<bool> IncomingCallFeedbackFunc { get; }
abstract protected Func<bool> PrivacyModeIsOnFeedbackFunc { get; }
abstract protected Func<int> VolumeLevelFeedbackFunc { get; }
abstract protected Func<bool> MuteFeedbackFunc { get; }
@@ -52,12 +49,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
public VideoCodecInfo CodecInfo { get; protected set; }
public bool ShowSelfViewByDefault { get; protected set; }
public bool AutoShareContentWhileInCall { get; protected set; }
public bool IsReady { get; protected set; }
public VideoCodecBase(string key, string name)
: base(key, name)
{
IncomingCallFeedback = new BoolFeedback(IncomingCallFeedbackFunc);
PrivacyModeIsOnFeedback = new BoolFeedback(PrivacyModeIsOnFeedbackFunc);
VolumeLevelFeedback = new IntFeedback(VolumeLevelFeedbackFunc);
MuteFeedback = new BoolFeedback(MuteFeedbackFunc);
@@ -87,7 +87,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
return new List<Feedback>
{
IncomingCallFeedback,
PrivacyModeIsOnFeedback,
SharingSourceFeedback
};
@@ -101,9 +100,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// </summary>
protected void SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus newStatus, CodecActiveCallItem call)
{
var prevStatus = call.Status;
call.Status = newStatus;
OnCallStatusChange(prevStatus, newStatus, call);
OnCallStatusChange(call);
if (AutoShareContentWhileInCall)
StartSharing();
}
/// <summary>
@@ -112,11 +114,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// <param name="previousStatus"></param>
/// <param name="newStatus"></param>
/// <param name="item"></param>
protected void OnCallStatusChange(eCodecCallStatus previousStatus, eCodecCallStatus newStatus, CodecActiveCallItem item)
protected void OnCallStatusChange(CodecActiveCallItem item)
{
var handler = CallStatusChange;
if (handler != null)
handler(this, new CodecCallStatusItemChangeEventArgs(previousStatus, newStatus, item));
handler(this, new CodecCallStatusItemChangeEventArgs(item));
}
/// <summary>
@@ -174,31 +176,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
var sb = new StringBuilder();
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());
sb.AppendFormat("{0} {1} -- {2} {3}\n", c.Id, c.Number, c.Name, c.Status);
Debug.Console(1, this, "\n{0}\n", sb.ToString());
}
}
/// <summary>
///
/// </summary>
public class CodecCallStatusItemChangeEventArgs : EventArgs
{
public CodecActiveCallItem CallItem { get; private set; }
public eCodecCallStatus PreviousStatus { get; private set; }
public eCodecCallStatus NewStatus { get; private set; }
public CodecCallStatusItemChangeEventArgs(eCodecCallStatus previousStatus,
eCodecCallStatus newStatus, CodecActiveCallItem item)
{
PreviousStatus = previousStatus;
NewStatus = newStatus;
CallItem = item;
}
}
/// <summary>
/// Used to track the status of syncronizing the phonebook values when connecting to a codec or refreshing the phonebook info