mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
Updated getters for SIP URI and phone number to use correct status properties. Updates to xConfiguration and xStatus classes to address differences between Spark and Spark Plus
This commit is contained in:
@@ -42,14 +42,16 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
|||||||
|
|
||||||
public void AddFoldersToDirectory(List<DirectoryItem> folders)
|
public void AddFoldersToDirectory(List<DirectoryItem> folders)
|
||||||
{
|
{
|
||||||
DirectoryResults.AddRange(folders);
|
if(folders != null)
|
||||||
|
DirectoryResults.AddRange(folders);
|
||||||
|
|
||||||
SortDirectory();
|
SortDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddContactsToDirectory(List<DirectoryItem> contacts)
|
public void AddContactsToDirectory(List<DirectoryItem> contacts)
|
||||||
{
|
{
|
||||||
DirectoryResults.AddRange(contacts);
|
if(contacts != null)
|
||||||
|
DirectoryResults.AddRange(contacts);
|
||||||
|
|
||||||
SortDirectory();
|
SortDirectory();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.Net.Https;
|
using Crestron.SimplSharp.Net.Https;
|
||||||
using Crestron.SimplSharp.CrestronXml;
|
using Crestron.SimplSharp.CrestronXml;
|
||||||
@@ -368,8 +369,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
prefix + "/Status/Video/Selfview" + Delimiter +
|
prefix + "/Status/Video/Selfview" + Delimiter +
|
||||||
prefix + "/Status/Video/Layout" + Delimiter +
|
prefix + "/Status/Video/Layout" + Delimiter +
|
||||||
prefix + "/Bookings" + Delimiter +
|
prefix + "/Bookings" + Delimiter +
|
||||||
prefix + "/Event/CallDisconnect" + Delimiter;// +
|
prefix + "/Event/CallDisconnect" + Delimiter +
|
||||||
//prefix + "/Event/Bookings" + Delimiter;
|
prefix + "/Event/Bookings" + Delimiter;
|
||||||
|
|
||||||
return base.CustomActivate();
|
return base.CustomActivate();
|
||||||
}
|
}
|
||||||
@@ -662,13 +663,14 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
}
|
}
|
||||||
else if (response.IndexOf("\"Event\":{") > -1)
|
else if (response.IndexOf("\"Event\":{") > -1)
|
||||||
{
|
{
|
||||||
// Event Message
|
if (response.IndexOf("\"CallDisconnect\":{") > -1)
|
||||||
|
{
|
||||||
|
CiscoCodecEvents.RootObject eventReceived = new CiscoCodecEvents.RootObject();
|
||||||
|
|
||||||
CiscoCodecEvents.RootObject eventReceived = new CiscoCodecEvents.RootObject();
|
JsonConvert.PopulateObject(response, eventReceived);
|
||||||
|
|
||||||
JsonConvert.PopulateObject(response, eventReceived);
|
EvalutateDisconnectEvent(eventReceived);
|
||||||
|
}
|
||||||
EvalutateEvent(eventReceived);
|
|
||||||
}
|
}
|
||||||
else if (response.IndexOf("\"CommandResponse\":{") > -1)
|
else if (response.IndexOf("\"CommandResponse\":{") > -1)
|
||||||
{
|
{
|
||||||
@@ -760,7 +762,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
/// Evaluates an event received from the codec
|
/// Evaluates an event received from the codec
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="eventReceived"></param>
|
/// <param name="eventReceived"></param>
|
||||||
void EvalutateEvent(CiscoCodecEvents.RootObject eventReceived)
|
void EvalutateDisconnectEvent(CiscoCodecEvents.RootObject eventReceived)
|
||||||
{
|
{
|
||||||
if (eventReceived.Event.CallDisconnect != null)
|
if (eventReceived.Event.CallDisconnect != null)
|
||||||
{
|
{
|
||||||
@@ -1286,18 +1288,30 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (CodecConfiguration.Configuration.H323.H323Alias.E164 != null)
|
if (CodecStatus.Status.SIP.Registration.Count > 0)
|
||||||
return CodecConfiguration.Configuration.H323.H323Alias.E164.Value;
|
{
|
||||||
|
var match = Regex.Match(CodecStatus.Status.SIP.Registration[0].URI.Value, "\\d+"); // extract numbers only
|
||||||
|
if (match.Success)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Unable to extract phone number from string: '{0}'", CodecStatus.Status.SIP.Registration[0].URI.Value);
|
||||||
|
return match.Groups[1].Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Unable to extract phone number. No SIP Registration items found");
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override string SipUri
|
public override string SipUri
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (CodecConfiguration.Configuration.H323.H323Alias.ID != null)
|
if (CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value != null)
|
||||||
return CodecConfiguration.Configuration.H323.H323Alias.ID.Value;
|
return CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value;
|
||||||
else
|
else
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
|
|
||||||
public class Cameras
|
public class Cameras
|
||||||
{
|
{
|
||||||
public List<Camera> Camera { get; set; }
|
//public List<Camera> Camera { get; set; }
|
||||||
public SpeakerTrack SpeakerTrack { get; set; }
|
public SpeakerTrack SpeakerTrack { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -313,12 +313,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
|
|
||||||
public class Cameras
|
public class Cameras
|
||||||
{
|
{
|
||||||
public List<Camera> Camera { get; set; }
|
//public List<Camera> Camera { get; set; }
|
||||||
public SpeakerTrack SpeakerTrack { get; set; }
|
public SpeakerTrack SpeakerTrack { get; set; }
|
||||||
|
|
||||||
public Cameras()
|
public Cameras()
|
||||||
{
|
{
|
||||||
Camera = new List<Camera>();
|
//Camera = new List<Camera>();
|
||||||
SpeakerTrack = new SpeakerTrack();
|
SpeakerTrack = new SpeakerTrack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1109,6 +1109,26 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Primary
|
||||||
|
{
|
||||||
|
public URI URI { get; set; }
|
||||||
|
|
||||||
|
public Primary()
|
||||||
|
{
|
||||||
|
URI = new URI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AlternateURI
|
||||||
|
{
|
||||||
|
public Primary Primary { get; set; }
|
||||||
|
|
||||||
|
public AlternateURI()
|
||||||
|
{
|
||||||
|
Primary = new Primary();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class Authentication
|
public class Authentication
|
||||||
{
|
{
|
||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
@@ -1190,6 +1210,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
public Reason3 Reason { get; set; }
|
public Reason3 Reason { get; set; }
|
||||||
public Status10 Status { get; set; }
|
public Status10 Status { get; set; }
|
||||||
public URI3 URI { get; set; }
|
public URI3 URI { get; set; }
|
||||||
|
|
||||||
|
public Registration()
|
||||||
|
{
|
||||||
|
URI = new URI3();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Secure
|
public class Secure
|
||||||
@@ -1204,6 +1229,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
|
|
||||||
public class SIP
|
public class SIP
|
||||||
{
|
{
|
||||||
|
public AlternateURI AlternateURI { get; set; }
|
||||||
public Authentication Authentication { get; set; }
|
public Authentication Authentication { get; set; }
|
||||||
public CallForward CallForward { get; set; }
|
public CallForward CallForward { get; set; }
|
||||||
public Mailbox Mailbox { get; set; }
|
public Mailbox Mailbox { get; set; }
|
||||||
@@ -1211,6 +1237,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
|||||||
public List<Registration> Registration { get; set; }
|
public List<Registration> Registration { get; set; }
|
||||||
public Secure Secure { get; set; }
|
public Secure Secure { get; set; }
|
||||||
public Verified Verified { get; set; }
|
public Verified Verified { get; set; }
|
||||||
|
|
||||||
|
public SIP()
|
||||||
|
{
|
||||||
|
AlternateURI = new AlternateURI();
|
||||||
|
Registration = new List<Registration>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Mode7
|
public class Mode7
|
||||||
|
|||||||
Reference in New Issue
Block a user