Fixed issue with corporate phonebook contact entries missing some properties

This commit is contained in:
Neil Dorin
2017-09-28 16:14:24 -06:00
parent bde56a22d1
commit 3e6f345b8b

View File

@@ -213,43 +213,55 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
{ {
contact.Name = c.Name.Value; contact.Name = c.Name.Value;
contact.ContactId = c.ContactId.Value; contact.ContactId = c.ContactId.Value;
contact.Title = c.Title.Value;
if(c.Title != null)
contact.Title = c.Title.Value;
if (Debug.Level > 0) if (Debug.Level > 0)
Debug.Console(1, "{0}\nContact Methods:", contact.Name); Debug.Console(1, "{0}\nContact Methods:", contact.Name);
foreach (ContactMethod m in c.ContactMethod) foreach (ContactMethod m in c.ContactMethod)
{ {
eContactMethodCallType callType = eContactMethodCallType.Unknown;
var tempContactMethod = new PepperDash.Essentials.Devices.Common.Codec.ContactMethod();
if (m.CallType != null) if (m.CallType != null)
{ {
if (m.CallType.Value.ToLower() == "audio") eContactMethodCallType callType = eContactMethodCallType.Unknown;
callType = eContactMethodCallType.Audio; if (m.CallType != null)
else if (m.CallType.Value.ToLower() == "video") {
callType = eContactMethodCallType.Video; if (m.CallType.Value.ToLower() == "audio")
callType = eContactMethodCallType.Audio;
else if (m.CallType.Value.ToLower() == "video")
callType = eContactMethodCallType.Video;
tempContactMethod.CallType = callType;
}
} }
eContactMethodDevice device = eContactMethodDevice.Unknown; if (m.Device != null)
{
eContactMethodDevice device = eContactMethodDevice.Unknown;
if (m.Device.Value.ToLower() == "mobile") if (m.Device.Value.ToLower() == "mobile")
device = eContactMethodDevice.Mobile; device = eContactMethodDevice.Mobile;
else if (m.Device.Value.ToLower() == "telephone") else if (m.Device.Value.ToLower() == "telephone")
device = eContactMethodDevice.Telephone; device = eContactMethodDevice.Telephone;
else if (m.Device.Value.ToLower() == "video") else if (m.Device.Value.ToLower() == "video")
device = eContactMethodDevice.Video; device = eContactMethodDevice.Video;
else if (m.Device.Value.ToLower() == "other") else if (m.Device.Value.ToLower() == "other")
device = eContactMethodDevice.Other; device = eContactMethodDevice.Other;
tempContactMethod.Device = device;
}
if (Debug.Level > 0) if (Debug.Level > 0)
Debug.Console(1, "Number: {0} CallType: {1} Device: {2}", m.Number.Value, callType, device); Debug.Console(1, "Number: {0}", m.Number.Value);
contact.ContactMethods.Add(new PepperDash.Essentials.Devices.Common.Codec.ContactMethod() tempContactMethod.Number = m.Number.Value;
{ tempContactMethod.ContactMethodId = m.ContactMethodId.Value;
Number = m.Number.Value,
ContactMethodId = m.ContactMethodId.Value, contact.ContactMethods.Add(tempContactMethod);
CallType = callType,
Device = device
});
} }
rootContacts.Add(contact); rootContacts.Add(contact);
} }
@@ -269,8 +281,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// <returns></returns> /// <returns></returns>
public static CodecDirectory ConvertCiscoPhonebookToGeneric(PhonebookSearchResult result) public static CodecDirectory ConvertCiscoPhonebookToGeneric(PhonebookSearchResult result)
{ {
#warning Modify this to return a flat list of mixed folders/contacts
var directory = new Codec.CodecDirectory(); var directory = new Codec.CodecDirectory();
var folders = new List<Codec.DirectoryItem>(); var folders = new List<Codec.DirectoryItem>();