try { using (var httpClient = new HttpClient()) { var json = iCall.RequestText; if (json != "") { httpClient.BaseAddress = new Uri(url); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes(server.Login + ":" + server.Password))); httpClient.DefaultRequestHeaders.Add("client-id", "5d5da1684f3b65f11cbe0456"); var content = new StringContent(json); ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage response = await httpClient.PostAsync(url, content); var line = ""; //ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true; using (var stream = await response.Content.ReadAsStreamAsync()) { var xline=""; while ((xline = new StreamReader(stream).ReadLine()) != null) { line += xline; } } if (line != "") { lock (iCall) // блокировка на момент доступа { iCall.iVoiceRequestID = line; } SetRequestIDEvent?.Invoke(iCall); } } } } catch (Exception ex) { Logger.Error($"iVoiceExchange.Call => {ex.ToString()}"); }