Compare commits

..

21 Commits

Author SHA1 Message Date
Jonathan Arndt
d88a454499 fix(essentials): various bug fixes for hold FB, individual call end, incoming name-number fb, ipv4 address fb 2022-02-11 16:39:47 -08:00
Neil Dorin
b0e3fddec7 fix(essentials): fixes issue with local var scope when assigning actions for ending individual calls
Fixes Incoming call name/number feedback in bridge
2022-02-11 15:50:09 -07:00
Neil Dorin
cb3c80ff8f fix(essentials): fixes to on hold feedback and call status xsig 2022-02-09 17:44:53 -07:00
Neil Dorin
0bb4b6edd4 fix(essentials): doh! fixes issue where IsOnHold would get set to false if response contains no PlacedOhHold object 2022-02-09 17:30:26 -07:00
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
5 changed files with 383 additions and 98 deletions

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
});
@@ -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
@@ -926,7 +940,7 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
new JoinMetadata
{
Description = "Pulse to remove the selected recent call item specified by the SelectRecentCallItem analog join",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
@@ -940,7 +954,7 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
new JoinMetadata
{
Description = "Pulse to dial the selected recent call item specified by the SelectRecentCallItem analog join",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
@@ -1014,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
@@ -1023,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
});
@@ -1232,6 +1260,20 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
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
@@ -1330,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;
@@ -646,10 +649,44 @@ 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)
{
Debug.Console(0, this,
@"Camera id: {0}
Name: {1}
ConnectorID: {2}"
, camera.id
, camera.Manufacturer.Value
, camera.Model.Value);
var id = Convert.ToUInt16(camera.id);
var info = new CameraInfo() { CameraNumber = id, Name = string.Format("{0} {1}", camera.Manufacturer.Value, camera.Model.Value), 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();
@@ -659,6 +696,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)
@@ -827,17 +867,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();
@@ -863,7 +917,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
if (!string.IsNullOrEmpty(call.Status.Value))
{
tempActiveCall.Status = CodecCallStatus.ConvertToStatusEnum(call.Status.Value);
tempActiveCall.IsOnHold = tempActiveCall.Status == eCodecCallStatus.OnHold;
if (newStatus == eCodecCallStatus.Connected)
GetCallHistory();
@@ -1136,6 +1191,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();
}
}
}
@@ -1516,7 +1581,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>
@@ -1937,7 +2002,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
}
Cameras.Add(internalCamera);
DeviceManager.AddDevice(internalCamera);
//DeviceManager.AddDevice(internalCamera);
}
else
{
@@ -1965,8 +2030,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
camera.SetCapabilites(cam.Capabilities.Options.Value);
}
Cameras.Add(camera);
DeviceManager.AddDevice(camera);
Cameras.Add(camera);
}
}
@@ -1974,11 +2038,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);
@@ -1992,6 +2054,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
@@ -2077,12 +2140,19 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
get
{
if (CodecConfiguration.Configuration.Network != null)
var address = string.Empty;
if (CodecConfiguration.Configuration.Network.Count > 0)
{
if (CodecConfiguration.Configuration.Network.Count > 0)
return CodecConfiguration.Configuration.Network[0].IPv4.Address.Value;
if(!string.IsNullOrEmpty(CodecConfiguration.Configuration.Network[0].IPv4.Address.Value))
address = CodecConfiguration.Configuration.Network[0].IPv4.Address.Value;
}
return string.Empty;
if (string.IsNullOrEmpty(address) && CodecStatus.Status.Network.Count > 0)
{
if(!string.IsNullOrEmpty(CodecStatus.Status.Network[0].IPv4.Address.Value))
address = CodecStatus.Status.Network[0].IPv4.Address.Value;
}
return address;
}
}
public override string E164Alias

View File

@@ -738,6 +738,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public Assignment Assignment { get; set; }
public Gateway Gateway { get; set; }
public SubnetMask SubnetMask { get; set; }
public IPv4()
{
Address = new Address4();
}
}
public class Address5
@@ -889,6 +894,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public RemoteAccess RemoteAccess { get; set; }
public Speed Speed { get; set; }
public VLAN VLAN { get; set; }
public Network()
{
IPv4 = new IPv4();
}
}
public class Mode19
@@ -1850,6 +1860,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
Audio = new Audio();
Conference = new Conference();
Network = new List<Network>();
}
}

View File

@@ -262,11 +262,30 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public string Value { get; set; }
}
public class DectectedConnector
{
public string Value { get; set; }
public int ConnectorId
{
get
{
if(!string.IsNullOrEmpty(Value))
{
return Convert.ToUInt16(Value);
}
else
return -1;
}
}
}
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; }
@@ -275,6 +294,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public Position Position { get; set; }
public SerialNumber SerialNumber { get; set; }
public SoftwareID SoftwareID { get; set; }
public Camera()
{
Manufacturer = new Manufacturer();
Model = new Model();
DetectedConnector = new DectectedConnector();
}
}
public class Availability : ValueProperty
@@ -298,11 +324,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 +631,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
get
{
if(string.IsNullOrEmpty(_Value))
return false;
return _Value.ToLower() == "localonly";
}
}
@@ -590,6 +642,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
get
{
if(string.IsNullOrEmpty(_Value))
return false;
return _Value.ToLower() == "localremote";
}
}
@@ -914,6 +969,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public Address4 Address { get; set; }
public Gateway Gateway { get; set; }
public SubnetMask SubnetMask { get; set; }
public IPv4()
{
Address = new Address4();
}
}
public class Address5
@@ -956,6 +1016,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public IPv4 IPv4 { get; set; }
public IPv6 IPv6 { get; set; }
public VLAN VLAN { get; set; }
public Network()
{
IPv4 = new IPv4();
}
}
public class CurrentAddress
@@ -2071,13 +2136,13 @@ 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();
}
}
@@ -2179,6 +2244,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
SystemUnit = new SystemUnit();
Video = new Video();
Conference = new Conference2();
Network = new List<Network>();
}
}

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());
}
@@ -678,37 +680,37 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
if (meetingIndex >= maxParticipants * offset) break;
Debug.Console(2, this,
@"Updating Participant on xsig:
Name: {0} (s{9})
AudioMute: {1} (d{10})
VideoMute: {2} (d{11})
CanMuteVideo: {3} (d{12})
CanUMuteVideo: {4} (d{13})
IsHost: {5} (d{14})
HandIsRaised: {6} (d{15})
IsPinned: {7} (d{16})
ScreenIndexIsPinnedTo: {8} (a{17})
",
participant.Name,
participant.AudioMuteFb,
participant.VideoMuteFb,
participant.CanMuteVideo,
participant.CanUnmuteVideo,
participant.IsHost,
participant.HandIsRaisedFb,
participant.IsPinnedFb,
participant.ScreenIndexIsPinnedToFb,
stringIndex + 1,
digitalIndex + 1,
digitalIndex + 2,
digitalIndex + 3,
digitalIndex + 4,
digitalIndex + 5,
digitalIndex + 6,
digitalIndex + 7,
analogIndex + 1
);
// Debug.Console(2, this,
//@"Updating Participant on xsig:
//Name: {0} (s{9})
//AudioMute: {1} (d{10})
//VideoMute: {2} (d{11})
//CanMuteVideo: {3} (d{12})
//CanUMuteVideo: {4} (d{13})
//IsHost: {5} (d{14})
//HandIsRaised: {6} (d{15})
//IsPinned: {7} (d{16})
//ScreenIndexIsPinnedTo: {8} (a{17})
//",
// participant.Name,
// participant.AudioMuteFb,
// participant.VideoMuteFb,
// participant.CanMuteVideo,
// participant.CanUnmuteVideo,
// participant.IsHost,
// participant.HandIsRaisedFb,
// participant.IsPinnedFb,
// participant.ScreenIndexIsPinnedToFb,
// stringIndex + 1,
// digitalIndex + 1,
// digitalIndex + 2,
// digitalIndex + 3,
// digitalIndex + 4,
// digitalIndex + 5,
// digitalIndex + 6,
// digitalIndex + 7,
// analogIndex + 1
// );
//digitals
@@ -980,50 +982,86 @@ ScreenIndexIsPinnedTo: {8} (a{17})
};
}
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);
codec.GetDirectoryFolderContents(_selectedDirectoryItem.FolderId);
trilist.SetUshort(joinMap.SelectedContactMethodCount.JoinNumber, 0);
return;
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)
{
// 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.SetSigFalseAction(joinMap.DirectoryDialSelectedLine.JoinNumber, () => Dial(entryToDial.ContactMethods[0].Number));
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();
trilist.SetString(joinMap.ContactMethods.JoinNumber,
@@ -1032,7 +1070,6 @@ ScreenIndexIsPinnedTo: {8} (a{17})
trilist.SetString(joinMap.ContactMethods.JoinNumber, contactMethodsXSig);
}
}
/// <summary>
@@ -1047,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)
@@ -1119,9 +1158,18 @@ ScreenIndexIsPinnedTo: {8} (a{17})
//End a specific call, specified by index. Maximum 8 calls supported
for (int i = 0; i < joinMap.EndCallStart.JoinSpan; i++)
{
var callIndex = i;
trilist.SetSigFalseAction((uint)(joinMap.EndCallStart.JoinNumber + i), () =>
{
var call = ActiveCalls[i];
if (callIndex < 0 || callIndex >= ActiveCalls.Count)
{
Debug.Console(2, this, "Cannot end call. No call found at index: {0}", callIndex);
return;
}
var call = ActiveCalls[callIndex];
if (call != null)
{
EndCall(call);
@@ -1143,11 +1191,19 @@ ScreenIndexIsPinnedTo: {8} (a{17})
Debug.Console(1, this, "Call is incoming: {0}", args.CallItem.Direction == eCodecCallDirection.Incoming);
trilist.SetBool(joinMap.IncomingCall.JoinNumber, args.CallItem.Direction == eCodecCallDirection.Incoming && args.CallItem.Status == eCodecCallStatus.Ringing);
if (args.CallItem.Direction == eCodecCallDirection.Incoming)
{
trilist.SetSigFalseAction(joinMap.IncomingAnswer.JoinNumber, () => AcceptCall(args.CallItem));
trilist.SetSigFalseAction(joinMap.IncomingReject.JoinNumber, () => RejectCall(args.CallItem));
}
if (args.CallItem.Direction == eCodecCallDirection.Incoming)
{
trilist.SetSigFalseAction(joinMap.IncomingAnswer.JoinNumber, () => AcceptCall(args.CallItem));
trilist.SetSigFalseAction(joinMap.IncomingReject.JoinNumber, () => RejectCall(args.CallItem));
trilist.SetString(joinMap.IncomingCallName.JoinNumber, args.CallItem.Name);
trilist.SetString(joinMap.IncomingCallNumber.JoinNumber, args.CallItem.Number);
}
else
{
trilist.SetString(joinMap.IncomingCallName.JoinNumber, string.Empty);
trilist.SetString(joinMap.IncomingCallNumber.JoinNumber, string.Empty);
}
trilist.SetString(joinMap.CurrentCallData.JoinNumber, UpdateCallStatusXSig());
@@ -1179,11 +1235,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);
@@ -1194,9 +1262,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);
@@ -1208,13 +1278,17 @@ ScreenIndexIsPinnedTo: {8} (a{17})
});
}
}
}
private string UpdateCallStatusXSig()
{
const int maxCalls = 8;
const int maxStrings = 6;
const int offset = 6;
const int maxDigitals = 2;
const int offset = maxStrings + maxDigitals;
var stringIndex = 0;
var digitalIndex = maxStrings * maxCalls;
var arrayIndex = 0;
@@ -1226,8 +1300,8 @@ ScreenIndexIsPinnedTo: {8} (a{17})
if (arrayIndex >= maxCalls * offset)
break;
//digitals
tokenArray[arrayIndex] = new XSigDigitalToken(digitalIndex + 1, call.IsActiveCall);
tokenArray[arrayIndex + 1] = new XSigDigitalToken(digitalIndex + 2, call.IsOnHold);
tokenArray[digitalIndex] = new XSigDigitalToken(digitalIndex + 1, call.IsActiveCall);
tokenArray[digitalIndex + 1] = new XSigDigitalToken(digitalIndex + 2, call.IsOnHold);
//serials
tokenArray[arrayIndex + 1] = new XSigSerialToken(stringIndex + 1, call.Name ?? String.Empty);
@@ -1249,8 +1323,8 @@ ScreenIndexIsPinnedTo: {8} (a{17})
while (digitalIndex < maxCalls)
{
//digitals
tokenArray[arrayIndex] = new XSigDigitalToken(digitalIndex + 1, false);
tokenArray[arrayIndex + 1] = new XSigDigitalToken(digitalIndex + 2, false);
tokenArray[digitalIndex] = new XSigDigitalToken(digitalIndex + 1, false);
tokenArray[digitalIndex + 1] = new XSigDigitalToken(digitalIndex + 2, false);
//serials
@@ -1595,6 +1669,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)
{
@@ -1606,11 +1681,17 @@ 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);
@@ -1641,6 +1722,7 @@ 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;