mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 04:34:56 +00:00
Merge remote-tracking branch 'origin/feature/ecs-407' into feature/cisco-spark-2
Conflicts: Essentials Devices Common/Essentials Devices Common/Codec/CodecActiveCallItem.cs
This commit is contained in:
@@ -19,7 +19,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
enum eCommandType { SessionStart, SessionEnd, Command, GetStatus, GetConfiguration };
|
||||
|
||||
public class CiscoCodec : VideoCodecBase
|
||||
public class CiscoCodec : VideoCodecBase, IHasCallHistory
|
||||
{
|
||||
public IBasicCommunication Communication { get; private set; }
|
||||
public CommunicationGather PortGather { get; private set; }
|
||||
@@ -31,7 +31,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback PeopleCountFeedback { get; private set; }
|
||||
public IntFeedback PeopleCountFeedback { get; private set; }
|
||||
|
||||
public BoolFeedback SpeakerTrackIsOnFeedback { get; private set; }
|
||||
|
||||
@@ -41,7 +41,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
private CiscoCodecConfiguration.RootObject CodecConfiguration;
|
||||
|
||||
private CiscoCodecStatus.RootObject CodecStatus;
|
||||
private CiscoCodecStatus.RootObject CodecStatus;
|
||||
|
||||
private CiscoCallHistory.RootObject CodecCallHistory;
|
||||
|
||||
public List<CallHistory.CallHistoryEntry> RecentCalls { get; private set; }
|
||||
|
||||
//private CiscoCodecEvents.RootObject CodecEvent;
|
||||
|
||||
@@ -72,11 +76,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of the currently shared source, or returns null
|
||||
/// </summary>
|
||||
protected override Func<string> SharingSourceFeedbackFunc
|
||||
{
|
||||
#warning figure out how to return the key of the shared source somehow
|
||||
get
|
||||
{
|
||||
return () => "Todo";
|
||||
{
|
||||
return () => "todo";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +118,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
return () => CodecStatus.Status.Cameras.SpeakerTrack.Status.BoolValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override Func<int> ActiveCallCountFeedbackFunc
|
||||
{
|
||||
get { return () => ActiveCalls.Count; }
|
||||
}
|
||||
|
||||
//private HttpsClient Client;
|
||||
|
||||
@@ -142,36 +155,61 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
public CiscoCodec(string key, string name, IBasicCommunication comm, int serverPort)
|
||||
: base(key, name)
|
||||
{
|
||||
StandbyIsOnFeedback = new BoolFeedback(StandbyStateFeedbackFunc);
|
||||
StandbyIsOnFeedback = new BoolFeedback(StandbyStateFeedbackFunc);
|
||||
RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);
|
||||
PeopleCountFeedback = new IntFeedback(PeopleCountFeedbackFunc);
|
||||
SpeakerTrackIsOnFeedback = new BoolFeedback(SpeakerTrackIsOnFeedbackFunc);
|
||||
|
||||
|
||||
Communication = comm;
|
||||
|
||||
SyncState = new CodecSyncState(key + "--sync");
|
||||
SyncState = new CodecSyncState(key + "--sync");
|
||||
|
||||
SyncState.InitialSyncCompleted += new EventHandler<EventArgs>(SyncState_InitialSyncCompleted);
|
||||
|
||||
PortGather = new CommunicationGather(Communication, Delimiter);
|
||||
PortGather.IncludeDelimiter = true;
|
||||
PortGather.LineReceived += this.Port_LineReceived;
|
||||
|
||||
//ServerPort = serverPort;
|
||||
|
||||
CodecObtp = new CiscoOneButtonToPush();
|
||||
|
||||
PhoneBook = new Corporate_Phone_Book();
|
||||
|
||||
CodecConfiguration = new CiscoCodecConfiguration.RootObject();
|
||||
|
||||
CodecStatus = new CiscoCodecStatus.RootObject();
|
||||
|
||||
//CodecEvent = new CiscoCodecEvents.RootObject();
|
||||
|
||||
CodecStatus.Status.Audio.Volume.ValueChangedAction = VolumeLevelFeedback.FireUpdate;
|
||||
CodecStatus.Status.Audio.VolumeMute.ValueChangedAction = MuteFeedback.FireUpdate;
|
||||
CodecStatus.Status.Audio.Microphones.Mute.ValueChangedAction = PrivacyModeIsOnFeedback.FireUpdate;
|
||||
CodecStatus.Status.Standby.State.ValueChangedAction = StandbyIsOnFeedback.FireUpdate;
|
||||
CodecStatus = new CiscoCodecStatus.RootObject();
|
||||
|
||||
CodecCallHistory = new CiscoCallHistory.RootObject();
|
||||
|
||||
CodecStatus.Status.Audio.Volume.ValueChangedAction = VolumeLevelFeedback.FireUpdate;
|
||||
CodecStatus.Status.Audio.VolumeMute.ValueChangedAction = MuteFeedback.FireUpdate;
|
||||
CodecStatus.Status.Audio.Microphones.Mute.ValueChangedAction = PrivacyModeIsOnFeedback.FireUpdate;
|
||||
CodecStatus.Status.Standby.State.ValueChangedAction = StandbyIsOnFeedback.FireUpdate;
|
||||
CodecStatus.Status.RoomAnalytics.PeoplePresence.ValueChangedAction = RoomIsOccupiedFeedback.FireUpdate;
|
||||
CodecStatus.Status.RoomAnalytics.PeopleCount.Current.ValueChangedAction = PeopleCountFeedback.FireUpdate;
|
||||
CodecStatus.Status.Cameras.SpeakerTrack.Status.ValueChangedAction = SpeakerTrackIsOnFeedback.FireUpdate;
|
||||
|
||||
//ServerPort = serverPort;
|
||||
|
||||
//Client = new HttpsClient();
|
||||
|
||||
//Server = new HttpApiServer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fires when initial codec sync is completed. Used to then send commands to get call history, phonebook, bookings, etc.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void SyncState_InitialSyncCompleted(object sender, EventArgs e)
|
||||
{
|
||||
SendText("xCommand CallHistory Recents Limit: 20 Order: OccurrenceTime");
|
||||
|
||||
// Get bookings for the day
|
||||
//SendText("xCommand Bookings List Days: 1 DayOffset: 0");
|
||||
|
||||
// Get Phonebook (determine local/corporate from config, and set results limit)
|
||||
//SendText("xCommand Phonebook Search PhonebookType: {0} ContactType: Folder Limit: {0}", PhonebookType, PhonebookResultsLimit);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -230,6 +268,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
prefix + "/Configuration" + Delimiter +
|
||||
prefix + "/Status/Audio" + Delimiter +
|
||||
prefix + "/Status/Call" + Delimiter +
|
||||
prefix + "/Status/Conference/Presentation" + Delimiter +
|
||||
prefix + "/Status/Cameras/SpeakerTrack" + Delimiter +
|
||||
prefix + "/Status/RoomAnalytics" + Delimiter +
|
||||
prefix + "/Status/Standby" + Delimiter +
|
||||
@@ -312,30 +351,31 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
//Debug.Console(1, this, "Building JSON:\n{0}", JsonMessage.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SyncState.InitialSyncComplete)
|
||||
{
|
||||
switch (args.Text.Trim().ToLower()) // remove the whitespace
|
||||
{
|
||||
case "*r login successful":
|
||||
{
|
||||
SendText("xPreferences outputmode json");
|
||||
break;
|
||||
}
|
||||
case "xpreferences outputmode json":
|
||||
{
|
||||
if (!SyncState.InitialStatusMessageWasReceived)
|
||||
SendText("xStatus");
|
||||
break;
|
||||
}
|
||||
case "xfeedback register /event/calldisconnect":
|
||||
{
|
||||
SyncState.FeedbackRegistered();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!SyncState.InitialSyncComplete)
|
||||
{
|
||||
switch (args.Text.Trim().ToLower()) // remove the whitespace
|
||||
{
|
||||
case "*r login successful":
|
||||
{
|
||||
SendText("xPreferences outputmode json");
|
||||
break;
|
||||
}
|
||||
case "xpreferences outputmode json":
|
||||
{
|
||||
if(!SyncState.InitialStatusMessageWasReceived)
|
||||
SendText("xStatus");
|
||||
break;
|
||||
}
|
||||
case "xfeedback register":
|
||||
{
|
||||
SyncState.FeedbackRegistered();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void SendText(string command)
|
||||
@@ -519,6 +559,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
if (response.IndexOf("\"Status\":{") > -1)
|
||||
{
|
||||
// Status Message
|
||||
|
||||
// Check to see if this is a call status message received after the initial status message
|
||||
if(SyncState.InitialStatusMessageWasReceived && response.IndexOf("\"Call\":{") > -1)
|
||||
{
|
||||
@@ -536,15 +578,38 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
// 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);
|
||||
JsonConvert.PopulateObject(JsonConvert.SerializeObject(call), existingCall);
|
||||
|
||||
var tempActiveCall = ActiveCalls.FirstOrDefault(c => c.Id.Equals(call.id));
|
||||
|
||||
// store previous status to pass to event handler
|
||||
var previousStatus = tempActiveCall.Status;
|
||||
|
||||
// Update properties of ActiveCallItem
|
||||
tempActiveCall.Status = CodecCallStatus.ConvertToStatusEnum(call.Status.Value);
|
||||
tempActiveCall.Type = CodecCallType.ConvertToTypeEnum(call.CallType.Value);
|
||||
tempActiveCall.Name = call.DisplayName.Value;
|
||||
|
||||
SetNewCallStatusAndFireCallStatusChange(previousStatus, tempActiveCall);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add the call
|
||||
callStatus.Status.Call.Add(call);
|
||||
callStatus.Status.Call.Add(call);
|
||||
|
||||
var newCallItem = new CodecActiveCallItem()
|
||||
{
|
||||
Id = call.id,
|
||||
Status = CodecCallStatus.ConvertToStatusEnum(call.Status.Value),
|
||||
Name = call.DisplayName.Value,
|
||||
Number = call.RemoteNumber.Value,
|
||||
Type = CodecCallType.ConvertToTypeEnum(call.CallType.Value)
|
||||
};
|
||||
|
||||
// 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()
|
||||
ActiveCalls.Add(newCallItem);
|
||||
|
||||
SetNewCallStatusAndFireCallStatusChange(newCallItem.Status, newCallItem);
|
||||
}
|
||||
|
||||
// Handle call.status to determine if we need to fire an event notifying of an incoming call or a call disconnect
|
||||
@@ -562,6 +627,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
}
|
||||
else if (response.IndexOf("\"Configuration\":{") > -1)
|
||||
{
|
||||
// Configuration Message
|
||||
|
||||
JsonConvert.PopulateObject(response, CodecConfiguration);
|
||||
|
||||
if (!SyncState.InitialConfigurationMessageWasReceived)
|
||||
@@ -576,11 +643,36 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
}
|
||||
else if (response.IndexOf("\"Event\":{") > -1)
|
||||
{
|
||||
// Event Message
|
||||
|
||||
CiscoCodecEvents.RootObject eventReceived = new CiscoCodecEvents.RootObject();
|
||||
|
||||
JsonConvert.PopulateObject(response, eventReceived);
|
||||
|
||||
EvalutateEvent(eventReceived);
|
||||
}
|
||||
else if (response.IndexOf("\"CommandResponse\":{") > -1)
|
||||
{
|
||||
// CommandResponse Message
|
||||
|
||||
if (response.IndexOf("\"CallHistoryRecentsResult\":{") > -1)
|
||||
{
|
||||
JsonConvert.PopulateObject(response, CodecCallHistory);
|
||||
|
||||
RecentCalls = CallHistory.ConvertCiscoCallHistoryToGeneric(CodecCallHistory.CommandResponse.CallHistoryRecentsResult.Entry);
|
||||
|
||||
if (Debug.Level == 1)
|
||||
{
|
||||
|
||||
Debug.Console(1, this, "RecentCalls:\n");
|
||||
|
||||
foreach (CallHistory.CallHistoryEntry entry in RecentCalls)
|
||||
{
|
||||
Debug.Console(1, this, "\nName: {0}\nNumber{1}\nStartTime{2}\nType{3}\n", entry.DisplayName, entry.CallBackNumber, entry.StartTime.ToString(), entry.OccurenceType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -588,7 +680,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
Debug.Console(1, this, "Error Deserializing feedback from codec: {0}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates an event received from the codec
|
||||
@@ -598,12 +691,21 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
if (eventReceived.Event.CallDisconnect != null)
|
||||
{
|
||||
var tempCall = CodecStatus.Status.Call.FirstOrDefault(c => c.id.Equals(eventReceived.Event.CallDisconnect.CallId));
|
||||
var tempCall = CodecStatus.Status.Call.FirstOrDefault(c => c.id.Equals(eventReceived.Event.CallDisconnect.CallId.Value));
|
||||
|
||||
if(tempCall != null)
|
||||
{
|
||||
CodecStatus.Status.Call.Remove(tempCall);
|
||||
|
||||
// Remove the call from the xStatus object
|
||||
CodecStatus.Status.Call.Remove(tempCall);
|
||||
|
||||
var tempActiveCall = ActiveCalls.FirstOrDefault(c => c.Id.Equals(eventReceived.Event.CallDisconnect.CallId.Value));
|
||||
|
||||
// Remove the call from the Active calls list
|
||||
if (tempActiveCall != null)
|
||||
ActiveCalls.Remove(tempActiveCall);
|
||||
|
||||
// Notify of the call disconnection
|
||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Disconnected, tempActiveCall);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -798,22 +900,44 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
public void Reboot()
|
||||
{
|
||||
SendText("xCommand SystemUnit Boot Action: Restart");
|
||||
}
|
||||
|
||||
public void RemoveEntry(CallHistory.CallHistoryEntry entry)
|
||||
{
|
||||
if (RecentCalls != null)
|
||||
{
|
||||
RecentCalls.Remove(entry);
|
||||
}
|
||||
}
|
||||
|
||||
protected override Func<int> ActiveCallCountFeedbackFunc
|
||||
{
|
||||
get { return () => 0; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tracks the initial sycnronization state of the codec when making a connection
|
||||
/// </summary>
|
||||
public class CodecSyncState : IKeyed
|
||||
{
|
||||
{
|
||||
bool _InitialSyncComplete;
|
||||
|
||||
public event EventHandler<EventArgs> InitialSyncCompleted;
|
||||
|
||||
public string Key { get; private set; }
|
||||
|
||||
public bool InitialSyncComplete { get; private set; }
|
||||
public bool InitialSyncComplete
|
||||
{
|
||||
get { return _InitialSyncComplete; }
|
||||
private set
|
||||
{
|
||||
if (value == true)
|
||||
{
|
||||
var handler = InitialSyncCompleted;
|
||||
if (handler != null)
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
_InitialSyncComplete = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool InitialStatusMessageWasReceived { get; private set; }
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
/// <summary>
|
||||
/// Gets and returns the scaled volume of the codec
|
||||
@@ -67,12 +78,42 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
|
||||
protected override Func<string> SharingSourceFeedbackFunc
|
||||
{
|
||||
get { return () => "Fix me fuckers"; }
|
||||
get
|
||||
{
|
||||
return () => "Todo";
|
||||
}
|
||||
}
|
||||
|
||||
protected override Func<bool> MuteFeedbackFunc
|
||||
{
|
||||
get { return () => false; }
|
||||
get
|
||||
{
|
||||
return () => CodecStatus.Status.Audio.VolumeMute.BoolValue;
|
||||
}
|
||||
}
|
||||
|
||||
protected Func<bool> RoomIsOccupiedFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () => CodecStatus.Status.RoomAnalytics.PeoplePresence.BoolValue;
|
||||
}
|
||||
}
|
||||
|
||||
protected Func<int> PeopleCountFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
return () => CodecStatus.Status.RoomAnalytics.PeopleCount.Current.IntValue;
|
||||
}
|
||||
}
|
||||
|
||||
protected Func<bool> 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
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates an event received from the codec
|
||||
/// </summary>
|
||||
/// <param name="eventReceived"></param>
|
||||
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");
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user