diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs b/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs
index 6aa2ec9a..86041f19 100644
--- a/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs
+++ b/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs
@@ -21,14 +21,4 @@ namespace PepperDash.Essentials.Devices.Common.Codec
public object CallMetaData { get; set; }
}
-
- public enum eCodecCallType
- {
- Unknown = 0, Audio, Video
- }
-
- public enum eCodecCallStatus
- {
- Unknown = 0, Dialing, Connected, Incoming, OnHold, Disconnected
- }
}
\ No newline at end of file
diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs.orig b/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs.orig
new file mode 100644
index 00000000..46746037
--- /dev/null
+++ b/Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs.orig
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+
+namespace PepperDash.Essentials.Devices.Common.Codec
+
+{
+ public class CodecActiveCallItem
+ {
+ public string Name { get; set; }
+
+ public string Number { get; set; }
+
+<<<<<<< HEAD:Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs
+ public eCodecCallType Type { get; set; }
+
+ public eCodecCallStatus Status { get; set; }
+
+ public string Id { get; set; }
+=======
+ public eCodecCallType Type { get; set; }
+
+ public eCodecCallStatus Status { get; set; }
+
+ public string Id { get; set; }
+
+ public object CallMetaData { get; set; }
+>>>>>>> origin/feature/cisco-spark-2:Essentials Devices Common/Essentials Devices Common/VideoCodec/CodecActiveCallItem.cs
+ }
+
+ public enum eCodecCallType
+ {
+ Unknown = 0, Audio, Video
+<<<<<<< HEAD:Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs
+ }
+
+ public enum eCodecCallStatus
+ {
+ Unknown = 0, Dialing, Connected, Incoming, OnHold, Disconnected
+=======
+ }
+
+ public enum eCodecCallStatus
+ {
+ Unknown = 0, Dialing, Connected, Incoming, OnHold, Disconnected
+>>>>>>> origin/feature/cisco-spark-2:Essentials Devices Common/Essentials Devices Common/VideoCodec/CodecActiveCallItem.cs
+ }
+}
\ No newline at end of file
diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs b/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs
new file mode 100644
index 00000000..900a2aed
--- /dev/null
+++ b/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallStatus.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+
+namespace PepperDash.Essentials.Devices.Common.Codec
+
+{
+ public enum eCodecCallStatus
+ {
+ Unknown = 0, Dialing, Connected, Connecting, Incoming, OnHold, Disconnected
+ }
+}
\ No newline at end of file
diff --git a/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallType.cs b/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallType.cs
new file mode 100644
index 00000000..5fbc68e6
--- /dev/null
+++ b/Essentials Devices Common/Essentials Devices Common/Codec/eCodecCallType.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+
+namespace PepperDash.Essentials.Devices.Common.Codec
+
+{
+ public enum eCodecCallType
+ {
+ Unknown = 0, Audio, Video
+ }
+}
\ 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 35459fa8..d7db0b4e 100644
--- a/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj
+++ b/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj
@@ -103,6 +103,8 @@
+
+
diff --git a/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs.orig b/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs.orig
index b29dad03..197e2315 100644
--- a/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs.orig
+++ b/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodec.cs.orig
@@ -13,6 +13,7 @@ using Cisco_SX80_Corporate_Phone_Book;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Routing;
+using PepperDash.Essentials.Devices.Common.Codec;
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
@@ -28,6 +29,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public BoolFeedback StandbyIsOnFeedback { get; private set; }
+ public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
+
+ public BoolFeedback PeopleCountFeedback { get; private set; }
+
+ public BoolFeedback SpeakerTrackIsOnFeedback { get; private set; }
+
private CiscoOneButtonToPush CodecObtp;
private Corporate_Phone_Book PhoneBook;
@@ -36,7 +43,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
private CiscoCodecStatus.RootObject CodecStatus;
+<<<<<<< HEAD
private CiscoCodecEvents.RootObject CodecEvent;
+=======
+ //private CiscoCodecEvents.RootObject CodecEvent;
+>>>>>>> origin/feature/cisco-spark-2
///
/// Gets and returns the scaled volume of the codec
@@ -67,12 +78,42 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
protected override Func SharingSourceFeedbackFunc
{
- get { return () => "Fix me fuckers"; }
+ get
+ {
+ return () => "Todo";
+ }
}
protected override Func MuteFeedbackFunc
{
- get { return () => false; }
+ get
+ {
+ return () => CodecStatus.Status.Audio.VolumeMute.BoolValue;
+ }
+ }
+
+ protected Func RoomIsOccupiedFeedbackFunc
+ {
+ get
+ {
+ return () => CodecStatus.Status.RoomAnalytics.PeoplePresence.BoolValue;
+ }
+ }
+
+ protected Func PeopleCountFeedbackFunc
+ {
+ get
+ {
+ return () => CodecStatus.Status.RoomAnalytics.PeopleCount.Current.IntValue;
+ }
+ }
+
+ protected Func SpeakerTrackIsOnFeedbackFunc
+ {
+ get
+ {
+ return () => CodecStatus.Status.Cameras.SpeakerTrack.Status.BoolValue;
+ }
}
//private HttpsClient Client;
@@ -125,7 +166,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
CodecStatus = new CiscoCodecStatus.RootObject();
- CodecEvent = new CiscoCodecEvents.RootObject();
+ //CodecEvent = new CiscoCodecEvents.RootObject();
CodecStatus.Status.Audio.Volume.ValueChangedAction = VolumeLevelFeedback.FireUpdate;
CodecStatus.Status.Audio.VolumeMute.ValueChangedAction = MuteFeedback.FireUpdate;
@@ -482,6 +523,38 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
if (response.IndexOf("\"Status\":{") > -1)
{
+ // Check to see if this is a call status message received after the initial status message
+ if(SyncState.InitialStatusMessageWasReceived && response.IndexOf("\"Call\":{") > -1)
+ {
+ CiscoCodecStatus.RootObject callStatus = new CiscoCodecStatus.RootObject();
+
+ JsonConvert.PopulateObject(response, callStatus);
+
+ // Iterate through the call objects in the response
+ foreach (CiscoCodecStatus.Call call in callStatus.Status.Call)
+ {
+ // Look for a matching call id in the existing status structure
+ var existingCall = CodecStatus.Status.Call.FirstOrDefault(c => c.id.Equals(call.id));
+
+ if (existingCall != null)
+ {
+ // If an existing call object is found with a matching ID, populate the existing call with the new data.
+ // (must reserialize the object so that we can use PopulateObject() to overlay the new or updated properties on the existing object)
+ JsonConvert.PopulateObject(JsonConvert.SerializeObject(call), existingCall);
+ }
+ else
+ {
+ // Add the call
+ callStatus.Status.Call.Add(call);
+
+ // Add a call to the ActiveCalls List
+ //ActiveCalls.Add(new CodecActiveCallItem() { Id = call.id, Status = call.Status.Value, Name = call.DisplayName.Value, Number = call.RemoteNumber.Value, Type = call.Status.Value.ToString()
+ }
+
+ // Handle call.status to determine if we need to fire an event notifying of an incoming call or a call disconnect
+ }
+ }
+
JsonConvert.PopulateObject(response, CodecStatus);
if (!SyncState.InitialStatusMessageWasReceived)
@@ -507,7 +580,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
}
else if (response.IndexOf("\"Event\":{") > -1)
{
- JsonConvert.PopulateObject(response, CodecEvent);
+ CiscoCodecEvents.RootObject eventReceived = new CiscoCodecEvents.RootObject();
+
+ JsonConvert.PopulateObject(response, eventReceived);
+
+ EvalutateEvent(eventReceived);
}
}
@@ -517,6 +594,24 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
}
}
+ ///
+ /// Evaluates an event received from the codec
+ ///
+ ///
+ void EvalutateEvent(CiscoCodecEvents.RootObject eventReceived)
+ {
+ if (eventReceived.Event.CallDisconnect != null)
+ {
+ var tempCall = CodecStatus.Status.Call.FirstOrDefault(c => c.id.Equals(eventReceived.Event.CallDisconnect.CallId));
+
+ if(tempCall != null)
+ {
+ CodecStatus.Status.Call.Remove(tempCall);
+
+ }
+ }
+ }
+
public override void ExecuteSwitch(object selector)
{
(selector as Action)();
@@ -551,11 +646,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
SendText(string.Format("xCommand Dial BookingId: {0}", s));
}
-<<<<<<< HEAD
- public override void EndCall(string s)
- {
- SendText(string.Format("xCommand Call Disconnect CallId: {0}", GetCallId()));
-=======
public override void EndCall(CodecActiveCallItem activeCall)
{
SendText(string.Format("xCommand Call Disconnect CallId: {0}", activeCall.Id));
@@ -567,15 +657,14 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
SendText(string.Format("xCommand Call Disconnect CallId: {0}", activeCall.Id));
}
->>>>>>> origin/feature/cisco-spark-2
}
- public override void AcceptCall()
+ public override void AcceptCall(CodecActiveCallItem item)
{
SendText("xCommand Call Accept");
}
- public override void RejectCall()
+ public override void RejectCall(CodecActiveCallItem item)
{
SendText("xCommand Call Reject");
}
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 8de1f2a3..53e5e2f1 100644
--- a/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs
+++ b/Essentials Devices Common/Essentials Devices Common/VideoCodec/MockVC/MockVC.cs
@@ -66,30 +66,28 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
public override void Dial(string s)
{
Debug.Console(1, this, "Dial: {0}", s);
- var item = new CodecActiveCallItem() { Name = s, Number = s, Id = s, Status = eCodecCallStatus.Dialing };
- ActiveCalls.Add(item);
- OnCallStatusChange(eCodecCallStatus.Unknown, item.Status, item);
+ var call = new CodecActiveCallItem() { Name = s, Number = s, Id = s, Status = eCodecCallStatus.Dialing };
+ ActiveCalls.Add(call);
+ OnCallStatusChange(eCodecCallStatus.Unknown, call.Status, call);
ActiveCallCountFeedback.FireUpdate();
- // Simulate 2-second ring
+ // Simulate 2-second ring, then connecting, then connected
new CTimer(o =>
{
- var prevStatus = item.Status;
- item.Status = eCodecCallStatus.Connected;
- item.Type = eCodecCallType.Video;
- OnCallStatusChange(prevStatus, item.Status, item);
+ call.Type = eCodecCallType.Video;
+ SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Connecting, call);
+ new CTimer(oo => SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Connected, call), 1000);
}, 2000);
}
///
///
///
- public override void EndCall(CodecActiveCallItem activeCall)
+ public override void EndCall(CodecActiveCallItem call)
{
Debug.Console(1, this, "EndCall");
- ActiveCalls.Remove(activeCall);
- var prevStatus = activeCall.Status;
- activeCall.Status = eCodecCallStatus.Disconnected;
- OnCallStatusChange(prevStatus, activeCall.Status, activeCall);
+ ActiveCalls.Remove(call);
+
+ SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call);
ActiveCallCountFeedback.FireUpdate();
}
@@ -99,23 +97,29 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
public override void EndAllCalls()
{
Debug.Console(1, this, "EndAllCalls");
- ActiveCalls.Clear();
+ foreach (var call in ActiveCalls)
+ {
+ ActiveCalls.Remove(call);
+ SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, call);
+ }
ActiveCallCountFeedback.FireUpdate();
}
///
/// For a call from the test methods below
///
- public override void AcceptCall(CodecActiveCallItem item)
+ public override void AcceptCall(CodecActiveCallItem call)
{
Debug.Console(1, this, "AcceptCall");
-
+ SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Connecting, call);
+ new CTimer(o => SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Connected, call), 1000);
+ // should already be in active list
}
///
/// For a call from the test methods below
///
- public override void RejectCall(CodecActiveCallItem item)
+ public override void RejectCall(CodecActiveCallItem call)
{
Debug.Console(1, this, "RejectCall");
}
@@ -247,16 +251,32 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
///
///
///
- public void TestIncomingCall(string url)
+ public void TestIncomingVideoCall(string url)
{
- Debug.Console(1, this, "TestIncomingCall from {0}", url);
- var item = new CodecActiveCallItem() { Name = url, Id = url, Number = url, Status = eCodecCallStatus.Incoming, Type= eCodecCallType.Unknown };
- ActiveCalls.Add(item);
+ Debug.Console(1, this, "TestIncomingVideoCall from {0}", url);
+ var call = new CodecActiveCallItem() { Name = url, Id = url, Number = url, Type= eCodecCallType.Video };
+ ActiveCalls.Add(call);
+ SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Incoming, call);
_IncomingCall = true;
IncomingCallFeedback.FireUpdate();
-
+ ActiveCallCountFeedback.FireUpdate();
}
+ ///
+ ///
+ ///
+ ///
+ 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 };
+ ActiveCalls.Add(call);
+ SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Incoming, call);
+ _IncomingCall = true;
+ IncomingCallFeedback.FireUpdate();
+ ActiveCallCountFeedback.FireUpdate();
+ }
+
///
///
///
@@ -266,6 +286,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
}
+ ///
+ ///
+ ///
public void ListCalls()
{
var sb = new StringBuilder();
@@ -278,7 +301,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
public RoutingPortCollection OutputPorts
{
- get { throw new NotImplementedException(); }
+ get { return new RoutingPortCollection(); }
}
#endregion
diff --git a/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs b/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs
index 7032dbe5..c10c5b88 100644
--- a/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs
+++ b/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs
@@ -87,11 +87,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
#region IHasDialer Members
public abstract void Dial(string s);
- public void EndCall(object activeCall)
- {
-
- }
- public abstract void EndCall(CodecActiveCallItem activeCall);
+ public abstract void EndCall(CodecActiveCallItem call);
public abstract void EndAllCalls();
public abstract void AcceptCall(CodecActiveCallItem call);
public abstract void RejectCall(CodecActiveCallItem call);
@@ -114,6 +110,16 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
public abstract void ExecuteSwitch(object selector);
+ ///
+ /// Helper method to fire CallStatusChange event with old and new status
+ ///
+ protected void SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus newStatus, CodecActiveCallItem call)
+ {
+ var prevStatus = call.Status;
+ call.Status = newStatus;
+ OnCallStatusChange(prevStatus, newStatus, call);
+ }
+
///
///
///
diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz
index 5e18ade3..849b24fc 100644
Binary files a/Release Package/PepperDashEssentials.cpz and b/Release Package/PepperDashEssentials.cpz differ
diff --git a/Release Package/PepperDashEssentials.dll b/Release Package/PepperDashEssentials.dll
index f4e7788c..d92b4ced 100644
Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ