Twilio 복음 전도자.
여기에서 프록시를 사용하려는 경우 Rest API를 사용하면 도움이 될 것입니다. HttpClient를 개체에 프록시 서버를 연결하려면 아래 코드를 사용해보십시오 :
public static HttpClient GetProxy()
{
// First create a proxy object
var proxyUri = $"{proxyServerSettings.Address}:{proxyServerSettings.Port}";
var proxyCreds = new NetworkCredential("proxyuser", "proxypassword");
var proxy = new WebProxy(proxyUri, false)
{
UseDefaultCredentials = false,
Credentials = proxyCreds,
};
// Now create a client handler which uses that proxy
var httpClientHandler = new HttpClientHandler()
{
Proxy = proxy,
PreAuthenticate = true,
UseDefaultCredentials = false,
};
return new HttpClient(httpClientHandler);
}
프록시와 전화 통화를하려면 여기 샘플 코드를 사용할 수 있습니다
const string accountSid = "*****************";
const string authToken = "*****************";
string to = "+1xxxxxxxxxx";
string from = "+1xxxxxxxxxx";
string callUrl = $"https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls";
var httpClient = GetProxy();
var authorizationValue = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{accountSid}:{authToken}"));
httpClient.DefaultRequestHeaders.Clear();
httpClient.DefaultRequestHeaders.Add("Authorization", $"Basic {authorizationValue}");
var result= httpClient.PostAsync(callUrl, new FormUrlEncodedContent(new Dictionary<string,string>
{
{"To", to},
{"From", from},
{"Url", "http://demo.twilio.com/docs/voice.xml"}
}));
나를 알고하자 이것은 도움이되거나 추가 문제가 발생하는 경우에 유용합니다. 여기서 도와 드리겠습니다.
twill을 전달하고 싶습니다. beacause를 사용하여 twilio의 텍스트 음성 기능을 사용하고 있습니다. var call = CallResource.Create (to, from, url : new Uri (tempURL)); 여기 tempURL은 우리가 지나가고있는 twilio twil입니다. 그래서 이것을 코드에 어떻게 포함시킬 수 있습니까? – Ajith
UriTemp = String.Format ("http://twimlets.com/echo?Twiml=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22 % 3F % 3E % 0A % 3CResponse % 3E % 0A % 20 % 20 % 20 % 20 % 3CSay % 20 % 3D % 22 % % 22 % 20 % % 3D % 22en-gb % 22 % 3EHi % 20i % 20 % % 20calling % 20from % 20Service % 20Desk % 20A % 20M % 20S % 20Alert. % 20A % 20High % 20Priority % 20Inside % 20P % 20 {1} % 20has % 20been % 20raised % 20in % 20your % 20service % 20Service % 20name % 20is % 20 { 0}. % 20 % 3C % 2FSay % 3E % 0A % 3C % 2FResponse % 3E & ", servicename, Priority); – Ajith
지연에 대해 사과드립니다. 그냥 따라 잡는거야. 이 코드 샘플에서와 같이 "URL"매개 변수와 해당 값을 추가하여 url을 보낼 수 있습니다 :'var result = httpClient.PostAsync (callUrl, new FormUrlEncodedContent (new Dictionary { { ("URL", "LINK_TO_TWIML_URL"})); 다음은 [문서 링크]입니다/api/voice/making-calls # post-parameters)를 사용하여 게시 할 수있는 다른 매개 변수를 나열합니다. –