Compare commits

...

25 Commits

Author SHA1 Message Date
Neil Dorin
e4a4564bbc fix(essentials): Attempts to set OnHold an alternative way 2022-02-09 17:21:19 -07:00
Neil Dorin
b0288951eb fix(essentials): removes logic to disconnect and reinitialize on malformed json response 2022-02-09 17:15:58 -07:00
Neil Dorin
bfdc882eb6 fix(essentials): Adds logic to recover from malformed json response on initial communication.
Adds better formatting for active calls list print to console
2022-02-09 17:07:18 -07:00
Neil Dorin
7a2e99f145 feat(essentials): Adds HoldAllCalls join and action 2022-02-09 16:50:06 -07:00
Neil Dorin
db67f97a1f fix(essentials): add local scope variable for indexer in hold/resume call loop 2022-02-09 16:46:19 -07:00
Neil Dorin
102ae3ad4f fix(essentials): second attempt to get on hold fb working 2022-02-09 16:41:37 -07:00
Neil Dorin
7dd6b3a9b6 fix(essentials): fixes index off by 1 error and updates call status to check for "OnHold" as status value 2022-02-09 16:31:31 -07:00
Neil Dorin
e24965eb54 fix(essentials): fixes ValueChagnedAction to run both feedback updates instead of one 2022-02-09 15:37:55 -07:00
Neil Dorin
9d80954214 fix(essentials): Adds check for SendingMode property value before attempting to set fb 2022-02-09 15:10:39 -07:00
Jonathan Arndt
70c5df9040 Removed add camera to device manager 2022-02-09 14:09:07 -08:00
Neil Dorin
89a7f2aa80 fix(essentials): Add a condition to check for an empty configuration.presentation object response and return to avoid null ref ex 2022-02-09 14:54:19 -07:00
Neil Dorin
90023621dc fix(essentials): Adds some better console log comments and calls SetUpCameras() after reading data from codec. 2022-02-09 14:48:45 -07:00
Neil Dorin
adbce916ba feat(essentials): Adds ability to read camera info from codec rather than just from config 2022-02-09 14:34:25 -07:00
Neil Dorin
b97783603b feat(essentials): Adds analog fb join for recent calls count to VideoCodecControllerJoinMap and bridge 2022-02-09 14:14:44 -07:00
Neil Dorin
db526cdd40 fix(essentials): fixes exception when parsing presentation local instance ghosted response 2022-02-09 14:09:54 -07:00
Neil Dorin
db982f4490 feat(essentials): Adds ability to select and dial contact methods for directory contacts via SIMPL bridge 2022-02-09 14:00:49 -07:00
Jonathan Arndt
c84525ddef Update recent call history and call method to protect for zero value from SIMPL 2022-02-09 11:39:35 -08:00
Jonathan Arndt
faabdde3f7 Update VideoCodecBase class UpdateDirectoryXSig method removing the check if the FolderId is null or empty as that check would be device specific 2022-02-08 16:31:45 -08:00
Jonathan Arndt
402754b69e Update VideoCodecBase class UpdateDirectoryXSig method removing the check if the FolderId is null or empty as that check would be device specific 2022-02-08 16:31:26 -08:00
Jonathan Arndt
84b39a959e Update VideoCodecBase class UpdateDirectoryXSig method removing the check if the FolderId is null or empty as that check would be device specific 2022-02-08 16:31:18 -08:00
Jonathan Arndt
93bfcc7baa Add logic to subscribe to PhoneBookSyncState during the CustomActivate method within CiscoSparkCodec class 2022-02-08 16:24:54 -08:00
Jonathan Arndt
64352811c5 Update VideoCodecBase.LinkVideoCodecCameraToApi FOR loop checking camera names to first check camera count 2022-02-08 13:31:13 -08:00
Jonathan Arndt
b5589364ff Instantiate xConfiguration members of Configuration, AutoAnswer, and Conference classes 2022-02-08 12:15:29 -08:00
Neil Dorin
611f0bec2e fix(essentials): #865 Adds DialselectedRecentCallItem join 2021-12-07 19:40:03 -07:00
Neil Dorin
90e22e9136 fix(essentials): #865 Adds SelectedContactMethodCount join to report the number of methods for the selected contact 2021-12-07 16:45:14 -07:00
7 changed files with 381 additions and 74 deletions

View File

@@ -22,7 +22,7 @@ env:
RELEASE_BRANCH: main
jobs:
Build_Project:
runs-on: windows-latest
runs-on: windows-2019
steps:
# First we checkout the source repo
- name: Checkout repo
@@ -98,7 +98,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Push_Nuget_Package:
needs: Build_Project
runs-on: windows-latest
runs-on: windows-2019
steps:
- name: Download Build Version Info
uses: actions/download-artifact@v1

View File

@@ -19,7 +19,7 @@ env:
RELEASE_BRANCH: main
jobs:
Build_Project:
runs-on: windows-latest
runs-on: windows-2019
steps:
# First we checkout the source repo
- name: Checkout repo
@@ -82,7 +82,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Push_Nuget_Package:
needs: Build_Project
runs-on: windows-latest
runs-on: windows-2019
steps:
- name: Download Build Version Info
uses: actions/download-artifact@v1

View File

@@ -240,7 +240,7 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
new JoinMetadata
{
Description = "Speed Dial",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
@@ -464,7 +464,7 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
new JoinMetadata
{
Description = "Go to Directory Root",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
@@ -510,6 +510,20 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
JoinType = eJoinType.Digital
});
[JoinName("DirectoryDialSelectedContactMethod")]
public JoinDataComplete DirectoryDialSelectedContactMethod = new JoinDataComplete(
new JoinData
{
JoinNumber = 108,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Pulse to dial the selected contact method",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("CameraTiltUp")]
public JoinDataComplete CameraTiltUp = new JoinDataComplete(
new JoinData
@@ -925,8 +939,22 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
},
new JoinMetadata
{
Description = "Removes the selected recent call item specified by the SelectRecentCallItem analog join",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
Description = "Pulse to remove the selected recent call item specified by the SelectRecentCallItem analog join",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("DialSelectedRecentCallItem")]
public JoinDataComplete DialSelectedRecentCallItem = new JoinDataComplete(
new JoinData
{
JoinNumber = 182,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Pulse to dial the selected recent call item specified by the SelectRecentCallItem analog join",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
@@ -1000,6 +1028,20 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
JoinType = eJoinType.Digital
});
[JoinName("HoldAllCalls")]
public JoinDataComplete HoldAllCalls = new JoinDataComplete(
new JoinData
{
JoinNumber = 220,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Holds all calls",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("HoldCallsStart")]
public JoinDataComplete HoldCallsStart = new JoinDataComplete(
new JoinData
@@ -1009,8 +1051,8 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
},
new JoinMetadata
{
Description = "Holds Call at specified index",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
Description = "Holds Call at specified index. FB reported on Call Status XSIG",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
@@ -1204,6 +1246,34 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
JoinType = eJoinType.Analog
});
[JoinName("SelectedContactMethodCount")]
public JoinDataComplete SelectedContactMethodCount = new JoinDataComplete(
new JoinData
{
JoinNumber = 102,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Reports the number of contact methods for the selected contact",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Analog
});
[JoinName("SelectContactMethod")]
public JoinDataComplete SelectContactMethod = new JoinDataComplete(
new JoinData
{
JoinNumber = 103,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Selects a contact method by index",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Analog
});
[JoinName("CameraPresetSelect")]
public JoinDataComplete CameraPresetSelect = new JoinDataComplete(
new JoinData
@@ -1302,6 +1372,20 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
JoinType = eJoinType.Analog
});
[JoinName("RecentCallCount")]
public JoinDataComplete RecentCallCount = new JoinDataComplete(
new JoinData
{
JoinNumber = 191,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Recent Call Count",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Analog
});
#endregion

View File

@@ -456,8 +456,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
CodecStatus.Status.Video.Selfview.Mode.ValueChangedAction = SelfviewIsOnFeedback.FireUpdate;
CodecStatus.Status.Video.Selfview.PIPPosition.ValueChangedAction = ComputeSelfviewPipStatus;
CodecStatus.Status.Video.Layout.LayoutFamily.Local.ValueChangedAction = ComputeLocalLayout;
CodecStatus.Status.Conference.Presentation.Mode.ValueChangedAction = SharingContentIsOnFeedback.FireUpdate;
CodecStatus.Status.Conference.Presentation.Mode.ValueChangedAction = FarEndIsSharingContentFeedback.FireUpdate;
CodecStatus.Status.Conference.Presentation.Mode.ValueChangedAction = () =>
{
SharingContentIsOnFeedback.FireUpdate();
FarEndIsSharingContentFeedback.FireUpdate();
};
CodecStatus.Status.Conference.DoNotDisturb.ValueChangedAction = DoNotDisturbModeIsOnFeedback.FireUpdate;
CodecConfiguration.Configuration.Audio.SoundsAndAlerts.RingVolume.ValueChangedAction = RingtoneVolumeFeedback.FireUpdate;
@@ -590,9 +593,16 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
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);
PhonebookSyncState.InitialSyncCompleted += new EventHandler<EventArgs>(PhonebookSyncState_InitialSyncCompleted);
return base.CustomActivate();
}
void PhonebookSyncState_InitialSyncCompleted(object sender, EventArgs e)
{
OnDirectoryResultReturned(DirectoryRoot);
}
#region Overrides of Device
public override void Initialize()
@@ -639,10 +649,36 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
/// <param name="e"></param>
void SyncState_InitialSyncCompleted(object sender, EventArgs e)
{
SetUpCameras(_config.CameraInfo);
// Check for camera config info first
if (_config.CameraInfo.Count > 0)
{
Debug.Console(0, this, "Reading codec cameraInfo from config properties.");
SetUpCameras(_config.CameraInfo);
}
else
{
Debug.Console(0, this, "No cameraInfo defined in video codec config. Attempting to get camera info from codec status data");
try
{
var cameraInfo = new List<CameraInfo>();
foreach (var camera in CodecStatus.Status.Cameras.Camera)
{
var id = Convert.ToUInt16(camera.id);
var info = new CameraInfo() { CameraNumber = id, Name = string.Format("{0} {1}", camera.Manufacturer, camera.Model), SourceId = camera.DetectedConnector.ConnectorId };
cameraInfo.Add(info);
}
Debug.Console(0, this, "Successfully got cameraInfo for {0} cameras from codec.", cameraInfo.Count);
SetUpCameras(cameraInfo);
}
catch (Exception ex)
{
Debug.Console(2, this, "Error generating camera info from codec status data: {0}", ex);
}
}
// Fire the ready event
SetIsReady();
//CommDebuggingIsOn = false;
GetCallHistory();
@@ -652,6 +688,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
BookingsRefreshTimer = new CTimer(GetBookings, 900000, 900000); // 15 minute timer to check for new booking info
GetBookings(null);
// Fire the ready event
SetIsReady();
}
public void SetCommDebug(string s)
@@ -820,17 +859,31 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
// Check to see if the message contains /Status/Conference/Presentation/LocalInstance and extract source value
var conference = tempCodecStatus.Status.Conference;
if (conference.Presentation != null && conference.Presentation.LocalInstance == null)
{
// Handles an empty presentation object response
return;
}
if (conference.Presentation.LocalInstance.Count > 0)
{
if (!string.IsNullOrEmpty(conference.Presentation.LocalInstance[0].ghost))
{
_presentationSource = 0;
_presentationLocalOnly = false;
_presentationLocalRemote = false;
}
else if (conference.Presentation.LocalInstance[0].Source != null)
{
_presentationSource = conference.Presentation.LocalInstance[0].Source.IntValue;
}
_presentationLocalOnly = conference.Presentation.LocalInstance.Any((i) => i.SendingMode.LocalOnly);
_presentationLocalRemote = conference.Presentation.LocalInstance.Any((i) => i.SendingMode.LocalRemote);
// Check for any values in the SendingMode property
if (conference.Presentation.LocalInstance.Any((i) => !string.IsNullOrEmpty(i.SendingMode.Value)))
{
_presentationLocalOnly = conference.Presentation.LocalInstance.Any((i) => i.SendingMode.LocalOnly);
_presentationLocalRemote = conference.Presentation.LocalInstance.Any((i) => i.SendingMode.LocalRemote);
}
}
PresentationSourceFeedback.FireUpdate();
PresentationSendingLocalOnlyFeedback.FireUpdate();
@@ -856,6 +909,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
if (!string.IsNullOrEmpty(call.Status.Value))
{
tempActiveCall.Status = CodecCallStatus.ConvertToStatusEnum(call.Status.Value);
if (tempActiveCall.Status == eCodecCallStatus.OnHold)
{
tempActiveCall.IsOnHold = true;
}
if (newStatus == eCodecCallStatus.Connected)
GetCallHistory();
@@ -1129,6 +1186,16 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
catch (Exception ex)
{
Debug.Console(1, this, "Error Deserializing feedback from codec: {0}", ex);
if (ex is Newtonsoft.Json.JsonReaderException)
{
Debug.Console(1, this, "Received malformed response from codec.");
//Communication.Disconnect();
//Initialize();
}
}
}
@@ -1144,6 +1211,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
var handler = DirectoryResultReturned;
if (handler != null)
{
Debug.Console(2, this, "Directory result returned");
handler(this, new DirectoryEventArgs()
{
Directory = result,
@@ -1508,7 +1576,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
return;
}
SendText(string.Format("xConfiguration Audio SoundsAndAlerts RingVolume: [0]", volume));
SendText(string.Format("xConfiguration Audio SoundsAndAlerts RingVolume: {0}", volume));
}
/// <summary>
@@ -1957,8 +2025,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
camera.SetCapabilites(cam.Capabilities.Options.Value);
}
Cameras.Add(camera);
DeviceManager.AddDevice(camera);
Cameras.Add(camera);
}
}
@@ -1966,11 +2033,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
var farEndCamera = new CiscoFarEndCamera(Key + "-cameraFar", "Far End", this);
Cameras.Add(farEndCamera);
SelectedCameraFeedback = new StringFeedback(() => SelectedCamera.Key);
SelectedCameraFeedback = new StringFeedback(() => SelectedCamera.Key);
ControllingFarEndCameraFeedback = new BoolFeedback(() => SelectedCamera is IAmFarEndCamera);
DeviceManager.AddDevice(farEndCamera);
ControllingFarEndCameraFeedback = new BoolFeedback(() => SelectedCamera is IAmFarEndCamera);
NearEndPresets = new List<CodecRoomPreset>(15);
@@ -1984,6 +2049,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
}
SelectedCamera = Cameras[0]; ; // call the method to select the camera and ensure the feedbacks get updated.
}
#region IHasCodecCameras Members
@@ -2154,10 +2220,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
get
{
if (CodecConfiguration.Configuration.Conference.AutoAnswer.Mode.Value.ToLower() == "on")
return true;
else
return false;
if (CodecConfiguration.Configuration.Conference.AutoAnswer.Mode.Value == null) return false;
return CodecConfiguration.Configuration.Conference.AutoAnswer.Mode.Value.ToLower() == "on";
}
}

View File

@@ -376,6 +376,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public Delay Delay { get; set; }
public Mode9 Mode { get; set; }
public Mute2 Mute { get; set; }
public AutoAnswer()
{
Mode = new Mode9();
Delay = new Delay();
Mute = new Mute2();
}
}
public class Protocol
@@ -476,6 +483,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public MaxTotalTransmitCallRate MaxTotalTransmitCallRate { get; set; }
public MaxTransmitCallRate MaxTransmitCallRate { get; set; }
public MultiStream MultiStream { get; set; }
public Conference()
{
AutoAnswer = new AutoAnswer();
}
}
public class LoginName
@@ -1837,6 +1849,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public Configuration()
{
Audio = new Audio();
Conference = new Conference();
}
}

View File

@@ -262,11 +262,25 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public string Value { get; set; }
}
public class DectectedConnector
{
public string Value { get; set; }
public int ConnectorId
{
get
{
return Convert.ToUInt16(Value);
}
}
}
public class Camera
{
public string id { get; set; }
public Capabilities Capabilities { get; set; }
public Connected Connected { get; set; }
public DectectedConnector DetectedConnector { get; set; }
public Flip Flip { get; set; }
public HardwareID HardwareID { get; set; }
public MacAddress MacAddress { get; set; }
@@ -298,11 +312,34 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
}
}
public class CallStatus : ValueProperty
{
string _Value;
public bool BoolValue { get; private set; }
public string Value
{
get
{
return _Value;
}
set
{
// If the incoming value is "Active" it sets the BoolValue true, otherwise sets it false
_Value = value;
BoolValue = value == "Connected";
OnValueChanged();
}
}
}
public class Status2 : ValueProperty
{
string _Value;
public bool BoolValue { get; private set; }
public string Value
{
get
@@ -582,6 +619,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
get
{
if(string.IsNullOrEmpty(_Value))
return false;
return _Value.ToLower() == "localonly";
}
}
@@ -590,6 +630,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
get
{
if(string.IsNullOrEmpty(_Value))
return false;
return _Value.ToLower() == "localremote";
}
}
@@ -2071,14 +2114,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public Protocol Protocol { get; set; }
public ReceiveCallRate ReceiveCallRate { get; set; }
public RemoteNumber RemoteNumber { get; set; }
public Status2 Status { get; set; }
public CallStatus Status { get; set; }
public TransmitCallRate TransmitCallRate { get; set; }
public Call()
{
CallType = new CallType();
Status = new Status2();
Status = new CallStatus();
Duration = new Duration();
PlacedOnHold = new PlacedOnHold();
}
}

View File

@@ -257,10 +257,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// </summary>
public virtual void ListCalls()
{
Debug.Console(1, this, "Active Calls:");
var sb = new StringBuilder();
foreach (var c in ActiveCalls)
{
sb.AppendFormat("{0} {1} -- {2} {3}\n", c.Id, c.Number, c.Name, c.Status);
sb.AppendFormat("id: {0} number: {1} -- name: {2} status: {3} onHold: {4}\r\n", c.Id, c.Number, c.Name, c.Status, c.IsOnHold);
}
Debug.Console(1, this, "\n{0}\n", sb.ToString());
}
@@ -937,9 +939,7 @@ ScreenIndexIsPinnedTo: {8} (a{17})
private void LinkVideoCodecDirectoryToApi(IHasDirectory codec, BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
{
codec.CurrentDirectoryResultIsNotDirectoryRoot.LinkComplementInputSig(
trilist.BooleanInput[joinMap.DirectoryIsRoot.JoinNumber]);
trilist.SetSigFalseAction(joinMap.DirectoryRoot.JoinNumber, codec.SetCurrentDirectoryToRoot);
trilist.BooleanInput[joinMap.DirectoryIsRoot.JoinNumber]);
trilist.SetStringSigAction(joinMap.DirectorySearchString.JoinNumber, codec.SearchDirectory);
@@ -951,6 +951,21 @@ ScreenIndexIsPinnedTo: {8} (a{17})
trilist.SetSigFalseAction(joinMap.DirectoryFolderBack.JoinNumber, codec.GetDirectoryParentFolderContents);
if (codec.DirectoryRoot != null)
{
trilist.SetUshort(joinMap.DirectoryRowCount.JoinNumber, (ushort)codec.DirectoryRoot.CurrentDirectoryResults.Count);
var clearBytes = XSigHelpers.ClearOutputs();
trilist.SetString(joinMap.DirectoryEntries.JoinNumber,
Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length));
var directoryXSig = UpdateDirectoryXSig(codec.DirectoryRoot, !codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue);
Debug.Console(2, this, "Directory XSig Length: {0}", directoryXSig.Length);
trilist.SetString(joinMap.DirectoryEntries.JoinNumber, directoryXSig);
}
codec.DirectoryResultReturned += (sender, args) =>
{
trilist.SetUshort(joinMap.DirectoryRowCount.JoinNumber, (ushort)args.Directory.CurrentDirectoryResults.Count);
@@ -961,45 +976,90 @@ ScreenIndexIsPinnedTo: {8} (a{17})
Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length));
var directoryXSig = UpdateDirectoryXSig(args.Directory, !codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue);
Debug.Console(2, this, "Directory XSig Length: {0}", directoryXSig.Length);
trilist.SetString(joinMap.DirectoryEntries.JoinNumber, directoryXSig);
};
}
private void SelectDirectoryEntry(IHasDirectory codec, ushort i, BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
{
var entry = codec.CurrentDirectoryResult.CurrentDirectoryResults[i - 1];
if (i < 1 || i > codec.CurrentDirectoryResult.CurrentDirectoryResults.Count) return;
if (entry is DirectoryFolder)
_selectedDirectoryItem = codec.CurrentDirectoryResult.CurrentDirectoryResults[i - 1];
if (_selectedDirectoryItem is DirectoryFolder)
{
codec.GetDirectoryFolderContents(entry.FolderId);
return;
codec.GetDirectoryFolderContents(_selectedDirectoryItem.FolderId);
trilist.SetUshort(joinMap.SelectedContactMethodCount.JoinNumber, 0);
trilist.SetString(joinMap.DirectorySelectedFolderName.JoinNumber, _selectedDirectoryItem.Name);
trilist.SetString(joinMap.DirectoryEntrySelectedName.JoinNumber, string.Empty);
trilist.ClearUShortSigAction(joinMap.SelectContactMethod.JoinNumber);
trilist.ClearBoolSigAction(joinMap.DirectoryDialSelectedLine.JoinNumber);
trilist.ClearBoolSigAction(joinMap.DirectoryDialSelectedContactMethod.JoinNumber);
return;
}
// Allow auto dial of selected line
// not a folder. Clear this value
trilist.SetString(joinMap.DirectorySelectedFolderName.JoinNumber, string.Empty);
var selectedContact = _selectedDirectoryItem as DirectoryContact;
if (selectedContact != null)
{
trilist.SetString(joinMap.DirectoryEntrySelectedName.JoinNumber, selectedContact.Name);
}
// Allow auto dial of selected line. Always dials first contact method
if (!trilist.GetBool(joinMap.DirectoryDisableAutoDialSelectedLine.JoinNumber))
{
var dialableEntry = entry as IInvitableContact;
var invitableEntry = _selectedDirectoryItem as IInvitableContact;
if (dialableEntry != null)
{
Dial(dialableEntry);
return;
}
if (invitableEntry != null)
{
Dial(invitableEntry);
return;
}
var entryToDial = entry as DirectoryContact;
var entryToDial = _selectedDirectoryItem as DirectoryContact;
if (entryToDial == null) return;
trilist.SetString(joinMap.DirectoryEntrySelectedNumber.JoinNumber, selectedContact.ContactMethods[0].Number);
Dial(entryToDial.ContactMethods[0].Number);
if (entryToDial == null) return;
Dial(entryToDial.ContactMethods[0].Number);
return;
}
else
{
// If auto dial is disabled...
var entryToDial = entry as DirectoryContact;
var entryToDial = _selectedDirectoryItem as DirectoryContact;
if (entryToDial == null) return;
if (entryToDial == null)
{
// Clear out values and actions from last selected item
trilist.SetUshort(joinMap.SelectedContactMethodCount.JoinNumber, 0);
trilist.SetString(joinMap.DirectoryEntrySelectedName.JoinNumber, string.Empty);
trilist.ClearUShortSigAction(joinMap.SelectContactMethod.JoinNumber);
trilist.ClearBoolSigAction(joinMap.DirectoryDialSelectedLine.JoinNumber);
trilist.ClearBoolSigAction(joinMap.DirectoryDialSelectedContactMethod.JoinNumber);
return;
}
trilist.SetUshort(joinMap.SelectedContactMethodCount.JoinNumber, (ushort)entryToDial.ContactMethods.Count);
// Update the action to dial the selected contact method
trilist.SetUShortSigAction(joinMap.SelectContactMethod.JoinNumber, (u) =>
{
if (u < 1 || u > entryToDial.ContactMethods.Count) return;
trilist.SetSigFalseAction(joinMap.DirectoryDialSelectedContactMethod.JoinNumber, () => Dial(entryToDial.ContactMethods[u - 1].Number));
});
// Sets DirectoryDialSelectedLine join action to dial first contact method
trilist.SetSigFalseAction(joinMap.DirectoryDialSelectedLine.JoinNumber, () => Dial(entryToDial.ContactMethods[0].Number));
var clearBytes = XSigHelpers.ClearOutputs();
@@ -1010,7 +1070,6 @@ ScreenIndexIsPinnedTo: {8} (a{17})
trilist.SetString(joinMap.ContactMethods.JoinNumber, contactMethodsXSig);
}
}
/// <summary>
@@ -1025,10 +1084,12 @@ ScreenIndexIsPinnedTo: {8} (a{17})
const int offset = maxStrings;
var stringIndex = 0;
var arrayIndex = 0;
var tokenArray = new XSigToken[contact.ContactMethods.Count];
// Create a new token array and set the size to the number of methods times the total number of signals
var tokenArray = new XSigToken[maxMethods * offset];
Debug.Console(2, this, "Creating XSIG token array with size {0}", maxMethods * offset);
// TODO: Add code to generate XSig data
foreach (var method in contact.ContactMethods)
{
if (arrayIndex >= maxMethods * offset)
@@ -1061,10 +1122,14 @@ ScreenIndexIsPinnedTo: {8} (a{17})
var contactIndex = 1;
var tokenArray = new XSigToken[directory.CurrentDirectoryResults.Count];
Debug.Console(2, this, "Is root {0} Directory Count: {1}", isRoot, directory.CurrentDirectoryResults.Count);
foreach (var entry in directory.CurrentDirectoryResults)
{
var arrayIndex = contactIndex - 1;
Debug.Console(2, this, "Entry Name: {0}, Folder ID: {1}", entry.Name, entry.FolderId);
if (entry is DirectoryFolder && entry.ParentFolderId == "root")
{
tokenArray[arrayIndex] = new XSigSerialToken(contactIndex, String.Format("[+] {0}", entry.Name));
@@ -1074,8 +1139,6 @@ ScreenIndexIsPinnedTo: {8} (a{17})
continue;
}
if (isRoot && String.IsNullOrEmpty(entry.FolderId)) continue;
tokenArray[arrayIndex] = new XSigSerialToken(contactIndex, entry.Name);
contactIndex++;
@@ -1155,11 +1218,23 @@ ScreenIndexIsPinnedTo: {8} (a{17})
var holdCodec = this as IHasCallHold;
if (holdCodec != null)
{
for (int i = 0; i < joinMap.JoinCallStart.JoinSpan; i++)
trilist.SetSigFalseAction(joinMap.HoldAllCalls.JoinNumber, () =>
{
trilist.SetSigFalseAction((uint)(joinMap.HoldCallsStart.JoinNumber + i), () =>
foreach (var call in ActiveCalls)
{
holdCodec.HoldCall(call);
}
});
for (int i = 0; i < joinMap.HoldCallsStart.JoinSpan; i++)
{
var index = i;
trilist.SetSigFalseAction((uint)(joinMap.HoldCallsStart.JoinNumber + index), () =>
{
var call = ActiveCalls[i];
if (index < 0 || index >= ActiveCalls.Count) return;
var call = ActiveCalls[index];
if (call != null)
{
holdCodec.HoldCall(call);
@@ -1170,9 +1245,11 @@ ScreenIndexIsPinnedTo: {8} (a{17})
}
});
trilist.SetSigFalseAction((uint)(joinMap.ResumeCallsStart.JoinNumber + i), () =>
trilist.SetSigFalseAction((uint)(joinMap.ResumeCallsStart.JoinNumber + index), () =>
{
var call = ActiveCalls[i];
if (index < 0 || index >= ActiveCalls.Count) return;
var call = ActiveCalls[index];
if (call != null)
{
holdCodec.ResumeCall(call);
@@ -1184,6 +1261,9 @@ ScreenIndexIsPinnedTo: {8} (a{17})
});
}
}
}
private string UpdateCallStatusXSig()
@@ -1471,7 +1551,8 @@ ScreenIndexIsPinnedTo: {8} (a{17})
// Camera names
for (uint i = 0; i < joinMap.CameraNamesFb.JoinSpan; i++)
{
if (codec.Cameras[(int)i] != null)
//Check the count first
if (i < codec.Cameras.Count && codec.Cameras[(int)i] != null)
{
trilist.SetString(joinMap.CameraNamesFb.JoinNumber + i, codec.Cameras[(int)i].Name);
}
@@ -1570,6 +1651,7 @@ ScreenIndexIsPinnedTo: {8} (a{17})
// Following fields only used for Bridging
private int _selectedRecentCallItemIndex;
private CodecCallHistory.CallHistoryEntry _selectedRecentCallItem;
private DirectoryItem _selectedDirectoryItem;
private void LinkVideoCodecCallHistoryToApi(IHasCallHistory codec, BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
{
@@ -1581,22 +1663,30 @@ ScreenIndexIsPinnedTo: {8} (a{17})
// Selected item action and feedback
trilist.SetUShortSigAction(joinMap.SelectRecentCallItem.JoinNumber, (u) =>
{
if (u == 0 || u > codec.CallHistory.RecentCalls.Count)
{
Debug.Console(2, this, "Recent Call History index out of range");
return;
}
_selectedRecentCallItemIndex = (int)(u - 1);
trilist.SetUshort(joinMap.SelectRecentCallItem.JoinNumber, u);
trilist.SetUshort(joinMap.SelectRecentCallItem.JoinNumber, u);
var _selectedRecentCallItem = codec.CallHistory.RecentCalls[_selectedRecentCallItemIndex];
if (_selectedRecentCallItem != null)
{
trilist.SetString(joinMap.SelectedRecentCallName.JoinNumber, _selectedRecentCallItem.Name);
trilist.SetString(joinMap.SelectedRecentCallNumber.JoinNumber, _selectedRecentCallItem.Number);
trilist.SetSigFalseAction(joinMap.RemoveSelectedRecentCallItem.JoinNumber, () => codec.RemoveCallHistoryEntry(_selectedRecentCallItem));
trilist.SetSigFalseAction(joinMap.DialSelectedRecentCallItem.JoinNumber, () => this.Dial(_selectedRecentCallItem.Number));
}
else
{
trilist.SetString(joinMap.SelectedRecentCallName.JoinNumber, string.Empty);
trilist.SetString(joinMap.SelectedRecentCallNumber.JoinNumber, string.Empty);
trilist.ClearBoolSigAction(joinMap.RemoveSelectedRecentCallItem.JoinNumber);
trilist.ClearBoolSigAction(joinMap.DialSelectedRecentCallItem.JoinNumber);
}
});
}
@@ -1614,24 +1704,36 @@ ScreenIndexIsPinnedTo: {8} (a{17})
trilist.ClearBoolSigAction(joinMap.RemoveSelectedRecentCallItem.JoinNumber);
//
trilist.SetUshort(joinMap.RecentCallCount.JoinNumber, (ushort)codec.CallHistory.RecentCalls.Count);
// Update the call history joins
var maxItems = joinMap.RecentCallNamesStart.JoinSpan;
uint i = 0;
foreach(var item in codec.CallHistory.RecentCalls)
// Create history
uint index = 0;
for (uint i = 0; i < maxItems && i < codec.CallHistory.RecentCalls.Count; i++)
{
trilist.SetString(joinMap.RecentCallNamesStart.JoinNumber + i, item.Name);
trilist.SetString(joinMap.RecentCallTimesStart.JoinNumber + i, item.StartTime.ToShortTimeString());
trilist.SetUshort(joinMap.RecentCallOccurrenceType.JoinNumber + i, (ushort)item.OccurrenceType);
i++;
trilist.SetString(joinMap.RecentCallNamesStart.JoinNumber + i, codec.CallHistory.RecentCalls[(int)i].Name);
trilist.SetString(joinMap.RecentCallTimesStart.JoinNumber + i, codec.CallHistory.RecentCalls[(int)i].StartTime.ToShortTimeString());
trilist.SetUshort(joinMap.RecentCallOccurrenceType.JoinNumber + i, (ushort)codec.CallHistory.RecentCalls[(int)i].OccurrenceType);
//i++;
index = i;
}
//foreach(var item in codec.CallHistory.RecentCalls)
//{
// trilist.SetString(joinMap.RecentCallNamesStart.JoinNumber + i, item.Name);
// trilist.SetString(joinMap.RecentCallTimesStart.JoinNumber + i, item.StartTime.ToShortTimeString());
// trilist.SetUshort(joinMap.RecentCallOccurrenceType.JoinNumber + i, (ushort)item.OccurrenceType);
// i++;
//}
for (uint index = i; i < maxItems; index++)
// Clears existing items
for (uint j = index; j < maxItems; j++)
{
trilist.SetString(joinMap.RecentCallNamesStart.JoinNumber + index, string.Empty);
trilist.SetString(joinMap.RecentCallTimesStart.JoinNumber + index, string.Empty);
trilist.SetUshort(joinMap.RecentCallOccurrenceType.JoinNumber + index, 0);
trilist.SetString(joinMap.RecentCallNamesStart.JoinNumber + j, string.Empty);
trilist.SetString(joinMap.RecentCallTimesStart.JoinNumber + j, string.Empty);
trilist.SetUshort(joinMap.RecentCallOccurrenceType.JoinNumber + j, 0);
}
}