mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
codec phonebook logic working and printing to console. Fixed bug wtih call status and tested with UI
This commit is contained in:
@@ -11,6 +11,8 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
|||||||
{
|
{
|
||||||
public interface iHasDirectory
|
public interface iHasDirectory
|
||||||
{
|
{
|
||||||
|
event EventHandler<DirectoryEventArgs> DirectoryResultReturned;
|
||||||
|
|
||||||
CodecDirectory DirectoryRoot { get; }
|
CodecDirectory DirectoryRoot { get; }
|
||||||
|
|
||||||
void SearchDirectory(string searchString);
|
void SearchDirectory(string searchString);
|
||||||
@@ -18,6 +20,11 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
|||||||
void GetDirectoryFolderContents(string folderId);
|
void GetDirectoryFolderContents(string folderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class DirectoryEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public CodecDirectory Directory { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class CodecDirectory
|
public class CodecDirectory
|
||||||
{
|
{
|
||||||
public List<DirectoryItem> DirectoryResults { get; private set; }
|
public List<DirectoryItem> DirectoryResults { get; private set; }
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
{
|
{
|
||||||
public event EventHandler<EventArgs> UpcomingMeetingWarning;
|
public event EventHandler<EventArgs> UpcomingMeetingWarning;
|
||||||
|
|
||||||
|
public event EventHandler<DirectoryEventArgs> DirectoryResultReturned;
|
||||||
|
|
||||||
public IBasicCommunication Communication { get; private set; }
|
public IBasicCommunication Communication { get; private set; }
|
||||||
public CommunicationGather PortGather { get; private set; }
|
public CommunicationGather PortGather { get; private set; }
|
||||||
public CommunicationGather JsonGather { get; private set; }
|
public CommunicationGather JsonGather { get; private set; }
|
||||||
@@ -154,6 +156,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
|
|
||||||
public bool CommDebuggingIsOn;
|
public bool CommDebuggingIsOn;
|
||||||
|
|
||||||
|
public bool MultiSiteOptionIsEnabled;
|
||||||
|
|
||||||
string Delimiter = "\r\n";
|
string Delimiter = "\r\n";
|
||||||
|
|
||||||
int PresentationSource;
|
int PresentationSource;
|
||||||
@@ -234,7 +238,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
CrestronConsole.AddNewConsoleCommand(SetCommDebug, "SetCiscoCommDebug", "0 for Off, 1 for on", ConsoleAccessLevelEnum.AccessOperator);
|
CrestronConsole.AddNewConsoleCommand(SetCommDebug, "SetCiscoCommDebug", "0 for Off, 1 for on", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
CrestronConsole.AddNewConsoleCommand(GetPhonebook, "GetCodecPhonebook", "Triggers a refresh of the codec phonebook", ConsoleAccessLevelEnum.AccessOperator);
|
CrestronConsole.AddNewConsoleCommand(GetPhonebook, "GetCodecPhonebook", "Triggers a refresh of the codec phonebook", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
CommDebuggingIsOn = true;
|
//CommDebuggingIsOn = true;
|
||||||
Communication.Connect();
|
Communication.Connect();
|
||||||
var socket = Communication as ISocketStatus;
|
var socket = Communication as ISocketStatus;
|
||||||
if (socket != null)
|
if (socket != null)
|
||||||
@@ -271,7 +275,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
void SyncState_InitialSyncCompleted(object sender, EventArgs e)
|
void SyncState_InitialSyncCompleted(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CommDebuggingIsOn = false;
|
//CommDebuggingIsOn = false;
|
||||||
|
|
||||||
GetCallHistory();
|
GetCallHistory();
|
||||||
|
|
||||||
@@ -370,7 +374,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
{
|
{
|
||||||
case "*r login successful":
|
case "*r login successful":
|
||||||
{
|
{
|
||||||
//LoginMessageReceived.Stop();
|
LoginMessageReceived.Stop();
|
||||||
SendText("xPreferences outputmode json");
|
SendText("xPreferences outputmode json");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -427,19 +431,23 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
|
|
||||||
if (tempActiveCall != null)
|
if (tempActiveCall != null)
|
||||||
{
|
{
|
||||||
// Store previous status to pass to event handler
|
|
||||||
var previousStatus = tempActiveCall.Status;
|
|
||||||
|
|
||||||
bool changeDetected = false;
|
bool changeDetected = false;
|
||||||
|
|
||||||
// Update properties of ActiveCallItem
|
// Update properties of ActiveCallItem
|
||||||
if(call.Status != null)
|
if(call.Status != null)
|
||||||
if (!string.IsNullOrEmpty(call.Status.Value))
|
if (!string.IsNullOrEmpty(call.Status.Value))
|
||||||
{
|
{
|
||||||
#warning Something here is evaluating as Unknown when the Display Name changes....
|
eCodecCallStatus newStatus = eCodecCallStatus.Unknown;
|
||||||
tempActiveCall.Status = CodecCallStatus.ConvertToStatusEnum(call.Status.Value);
|
|
||||||
changeDetected = true;
|
newStatus = CodecCallStatus.ConvertToStatusEnum(call.Status.Value);
|
||||||
if(tempActiveCall.Status == eCodecCallStatus.Connected)
|
|
||||||
|
if (newStatus != eCodecCallStatus.Unknown)
|
||||||
|
{
|
||||||
|
changeDetected = true;
|
||||||
|
SetNewCallStatusAndFireCallStatusChange(newStatus, tempActiveCall);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newStatus == eCodecCallStatus.Connected)
|
||||||
GetCallHistory();
|
GetCallHistory();
|
||||||
}
|
}
|
||||||
if (call.CallType != null)
|
if (call.CallType != null)
|
||||||
@@ -458,7 +466,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
if (changeDetected)
|
if (changeDetected)
|
||||||
{
|
{
|
||||||
ListCalls();
|
ListCalls();
|
||||||
SetNewCallStatusAndFireCallStatusChange(previousStatus, tempActiveCall);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( call.ghost == null ) // if the ghost value is present the call has ended already
|
else if( call.ghost == null ) // if the ghost value is present the call has ended already
|
||||||
@@ -478,7 +485,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
|
|
||||||
ListCalls();
|
ListCalls();
|
||||||
|
|
||||||
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Unknown, newCallItem);
|
SetNewCallStatusAndFireCallStatusChange(newCallItem.Status, newCallItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -490,6 +497,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
if (!SyncState.InitialStatusMessageWasReceived)
|
if (!SyncState.InitialStatusMessageWasReceived)
|
||||||
{
|
{
|
||||||
SyncState.InitialStatusMessageReceived();
|
SyncState.InitialStatusMessageReceived();
|
||||||
|
|
||||||
|
SetStatusProperties(CodecStatus);
|
||||||
|
|
||||||
if (!SyncState.InitialConfigurationMessageWasReceived)
|
if (!SyncState.InitialConfigurationMessageWasReceived)
|
||||||
SendText("xConfiguration");
|
SendText("xConfiguration");
|
||||||
}
|
}
|
||||||
@@ -576,6 +586,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
|
|
||||||
PrintPhonebook(directoryResults);
|
PrintPhonebook(directoryResults);
|
||||||
|
|
||||||
|
// This will return the latest results to all UIs. Multiple indendent UI Directory browsing will require a different methodology
|
||||||
|
var handler = DirectoryResultReturned;
|
||||||
|
if (handler != null)
|
||||||
|
handler(this, new DirectoryEventArgs() { Directory = directoryResults });
|
||||||
|
|
||||||
// Fire some sort of callback delegate to the UI that requested the directory search results
|
// Fire some sort of callback delegate to the UI that requested the directory search results
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -629,6 +644,17 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
|
|
||||||
protected override Func<bool> IncomingCallFeedbackFunc { get { return () => false; } }
|
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>
|
/// <summary>
|
||||||
/// Gets the first CallId or returns null
|
/// Gets the first CallId or returns null
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -637,8 +663,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
{
|
{
|
||||||
string callId = null;
|
string callId = null;
|
||||||
|
|
||||||
if (CodecStatus.Status.Call.Count > 0)
|
if (ActiveCalls.Count > 1)
|
||||||
callId = CodecStatus.Status.Call[0].id;
|
{
|
||||||
|
foreach (CodecActiveCallItem call in ActiveCalls) ;
|
||||||
|
}
|
||||||
|
else if (ActiveCalls.Count == 1)
|
||||||
|
callId = ActiveCalls[0].Id;
|
||||||
|
|
||||||
return callId;
|
return callId;
|
||||||
|
|
||||||
@@ -657,6 +687,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
{
|
{
|
||||||
PhonebookSyncState.CodecDisconnected();
|
PhonebookSyncState.CodecDisconnected();
|
||||||
|
|
||||||
|
DirectoryRoot = new CodecDirectory();
|
||||||
|
|
||||||
GetPhonebookFolders();
|
GetPhonebookFolders();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -745,7 +777,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
|
|
||||||
public override void SendDtmf(string s)
|
public override void SendDtmf(string s)
|
||||||
{
|
{
|
||||||
SendText(string.Format("xCommand Call DTMFSend CallId: {0} DTMFString: \"{1}\"", GetCallId(), s));
|
if (CallFavorites != null)
|
||||||
|
{
|
||||||
|
SendText(string.Format("xCommand Call DTMFSend CallId: {0} DTMFString: \"{1}\"", GetCallId(), s));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectPresentationSource(int source)
|
public void SelectPresentationSource(int source)
|
||||||
|
|||||||
@@ -310,10 +310,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
|||||||
contact.ContactId = c.ContactId.Value;
|
contact.ContactId = c.ContactId.Value;
|
||||||
contact.Title = c.Title.Value;
|
contact.Title = c.Title.Value;
|
||||||
|
|
||||||
// Go find the folder to which this contact belongs and store it
|
if(c.FolderId != null)
|
||||||
if(!string.IsNullOrEmpty(c.FolderId.Value))
|
|
||||||
{
|
{
|
||||||
//contact.Folder = directory.Folders.FirstOrDefault(f => f.FolderId.Equals(c.FolderId.Value));
|
contact.FolderId = c.FolderId.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ContactMethod m in c.ContactMethod)
|
foreach (ContactMethod m in c.ContactMethod)
|
||||||
|
|||||||
@@ -1271,6 +1271,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
public Encryption Encryption { get; set; }
|
public Encryption Encryption { get; set; }
|
||||||
public MultiSite MultiSite { get; set; }
|
public MultiSite MultiSite { get; set; }
|
||||||
public RemoteMonitoring RemoteMonitoring { get; set; }
|
public RemoteMonitoring RemoteMonitoring { get; set; }
|
||||||
|
|
||||||
|
public OptionKeys()
|
||||||
|
{
|
||||||
|
MultiSite = new MultiSite();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ReleaseDate
|
public class ReleaseDate
|
||||||
@@ -1290,6 +1295,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
public OptionKeys OptionKeys { get; set; }
|
public OptionKeys OptionKeys { get; set; }
|
||||||
public ReleaseDate ReleaseDate { get; set; }
|
public ReleaseDate ReleaseDate { get; set; }
|
||||||
public Version2 Version { get; set; }
|
public Version2 Version { get; set; }
|
||||||
|
|
||||||
|
public Software2()
|
||||||
|
{
|
||||||
|
OptionKeys = new OptionKeys();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NumberOfActiveCalls
|
public class NumberOfActiveCalls
|
||||||
@@ -1328,6 +1338,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
public Software2 Software { get; set; }
|
public Software2 Software { get; set; }
|
||||||
public State2 State { get; set; }
|
public State2 State { get; set; }
|
||||||
public Uptime Uptime { get; set; }
|
public Uptime Uptime { get; set; }
|
||||||
|
|
||||||
|
public SystemUnit()
|
||||||
|
{
|
||||||
|
Software = new Software2();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SystemTime
|
public class SystemTime
|
||||||
@@ -1735,6 +1750,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
Cameras = new Cameras();
|
Cameras = new Cameras();
|
||||||
RoomAnalytics = new RoomAnalytics();
|
RoomAnalytics = new RoomAnalytics();
|
||||||
Conference = new Conference2();
|
Conference = new Conference2();
|
||||||
|
SystemUnit = new SystemUnit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user