Beispiel #1
0
        internal string GetEUMPhoneNumber(UMDialPlan dialPlan)
        {
            Hashtable airSyncSafeTable = UMMailbox.GetAirSyncSafeTable(this.UMAddresses, ProxyAddressPrefix.ASUM, dialPlan);

            foreach (ProxyAddress proxyAddress in this.EmailAddresses)
            {
                if (proxyAddress.Prefix == ProxyAddressPrefix.UM)
                {
                    string phoneContextFromProxyAddress = UMMailbox.GetPhoneContextFromProxyAddress(proxyAddress);
                    if (phoneContextFromProxyAddress == dialPlan.PhoneContext && UMMailbox.IsProxyAddressLocalExtension(proxyAddress) && !airSyncSafeTable.ContainsKey(proxyAddress.AddressString))
                    {
                        return(UMMailbox.GetExtensionFromProxyAddress(proxyAddress));
                    }
                }
            }
            return(null);
        }
Beispiel #2
0
        internal static bool ContainsMoreThanOneDialplan(ProxyAddressCollection emailAddresses)
        {
            string text = null;

            foreach (ProxyAddress proxyAddress in emailAddresses)
            {
                if (proxyAddress.Prefix == ProxyAddressPrefix.UM)
                {
                    string phoneContextFromProxyAddress = UMMailbox.GetPhoneContextFromProxyAddress(proxyAddress);
                    if (text == null)
                    {
                        text = phoneContextFromProxyAddress;
                    }
                    else if (string.Compare(phoneContextFromProxyAddress, text, StringComparison.OrdinalIgnoreCase) != 0)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Beispiel #3
0
        internal static List <string> GetDialPlanPhoneContexts(ProxyAddressCollection proxyAddresses, bool excludePrimaryContext)
        {
            if (proxyAddresses == null)
            {
                throw new ArgumentNullException("proxyAddresses");
            }
            List <string> list = new List <string>();

            foreach (ProxyAddress proxyAddress in proxyAddresses)
            {
                if (proxyAddress.Prefix == ProxyAddressPrefix.UM && (!proxyAddress.IsPrimaryAddress || !excludePrimaryContext))
                {
                    string phoneContextFromProxyAddress = UMMailbox.GetPhoneContextFromProxyAddress(proxyAddress);
                    if (phoneContextFromProxyAddress != null)
                    {
                        list.Add(phoneContextFromProxyAddress);
                    }
                }
            }
            return(list);
        }
Beispiel #4
0
 internal static bool ExtractExtensionInformation(ProxyAddress address, out string extension, out string phoneContext, out string dialplanDisplayName)
 {
     if (address == null)
     {
         throw new ArgumentException("address");
     }
     extension           = null;
     phoneContext        = null;
     dialplanDisplayName = null;
     if (address.Prefix == ProxyAddressPrefix.UM)
     {
         extension           = UMMailbox.GetExtensionFromProxyAddress(address);
         phoneContext        = UMMailbox.GetPhoneContextFromProxyAddress(address);
         dialplanDisplayName = null;
         if (phoneContext != null)
         {
             dialplanDisplayName = phoneContext.Split(new char[]
             {
                 '.'
             })[0];
         }
     }
     return(extension != null && phoneContext != null && dialplanDisplayName != null);
 }
Beispiel #5
0
        internal static MultiValuedProperty <string> GetExtensionsFromEmailAddresses(ProxyAddressCollection emailAddresses)
        {
            List <string> list = new List <string>();
            bool          flag = UMMailbox.ContainsMoreThanOneDialplan(emailAddresses);

            foreach (ProxyAddress proxyAddress in emailAddresses)
            {
                if (proxyAddress.Prefix == ProxyAddressPrefix.UM)
                {
                    int num = proxyAddress.AddressString.IndexOf(";");
                    if (num != -1)
                    {
                        if (flag)
                        {
                            string        phoneContextFromProxyAddress = UMMailbox.GetPhoneContextFromProxyAddress(proxyAddress);
                            string        extensionFromProxyAddress    = UMMailbox.GetExtensionFromProxyAddress(proxyAddress);
                            StringBuilder stringBuilder = new StringBuilder();
                            stringBuilder.AppendFormat("{0} ({1})", extensionFromProxyAddress, phoneContextFromProxyAddress);
                            list.Add(stringBuilder.ToString());
                        }
                        else
                        {
                            list.Add(UMMailbox.GetExtensionFromProxyAddress(proxyAddress));
                        }
                    }
                }
            }
            MultiValuedProperty <string> multiValuedProperty = new MultiValuedProperty <string>();

            multiValuedProperty.CopyChangesOnly = true;
            foreach (string item in list)
            {
                multiValuedProperty.Add(item);
            }
            return(multiValuedProperty);
        }