示例#1
0
        /// <summary>
        /// Checks whether a contact is currently registered with the server
        /// </summary>
        /// <param name="e164number">The contact to check.</param>
        /// <param name="token">The cancellation token</param>
        /// <returns>An optional ContactTokenDetails, present if registered, absent if not.</returns>
        /// <exception cref="IOException"></exception>
        public async Task <ContactTokenDetails?> GetContactAsync(string e164number, CancellationToken?token = null)
        {
            if (token == null)
            {
                token = CancellationToken.None;
            }

            string contactToken = CreateDirectoryServerToken(e164number, true);
            ContactTokenDetails?contactTokenDetails = await pushServiceSocket.GetContactTokenDetailsAsync(contactToken, token);

            if (contactTokenDetails != null)
            {
                contactTokenDetails.Number = e164number;
            }

            return(contactTokenDetails);
        }