Exemplo n.º 1
0
 internal static bool PhoneNumberExists(ProxyAddressCollection addresses, ProxyAddressPrefix prefix, string phoneNumber)
 {
     foreach (ProxyAddress proxyAddress in addresses)
     {
         if (proxyAddress.Prefix == prefix)
         {
             string extensionFromProxyAddress = UMMailbox.GetExtensionFromProxyAddress(proxyAddress);
             if (extensionFromProxyAddress.Equals(phoneNumber))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Exemplo n.º 2
0
 internal static string GetPrimaryExtension(ProxyAddressCollection emailAddresses, ProxyAddressPrefix prefix)
 {
     foreach (ProxyAddress proxyAddress in emailAddresses)
     {
         if (proxyAddress.IsPrimaryAddress && proxyAddress.Prefix == prefix)
         {
             string extensionFromProxyAddress = UMMailbox.GetExtensionFromProxyAddress(proxyAddress);
             if (extensionFromProxyAddress != null)
             {
                 return(extensionFromProxyAddress);
             }
         }
     }
     return(null);
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        internal static MultiValuedProperty <string> GetExtensionsFromCollection(ProxyAddressCollection addresses, ProxyAddressPrefix prefix, string phoneContext)
        {
            MultiValuedProperty <string> multiValuedProperty = new MultiValuedProperty <string>();

            foreach (ProxyAddress proxyAddress in addresses)
            {
                if (proxyAddress.Prefix == prefix && (phoneContext == null || proxyAddress.AddressString.EndsWith(phoneContext)))
                {
                    string extensionFromProxyAddress = UMMailbox.GetExtensionFromProxyAddress(proxyAddress);
                    if (extensionFromProxyAddress != null)
                    {
                        multiValuedProperty.Add(extensionFromProxyAddress);
                    }
                }
            }
            return(multiValuedProperty);
        }
Exemplo n.º 5
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);
 }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        private static bool IsProxyAddressLocalExtension(ProxyAddress emailAddress)
        {
            string extensionFromProxyAddress = UMMailbox.GetExtensionFromProxyAddress(emailAddress);

            return(extensionFromProxyAddress != null && !Regex.IsMatch(extensionFromProxyAddress, "[^0-9]"));
        }