0
我正在設置蒙面呼叫。在撥打被屏蔽的號碼後,當我收到以下TwiML響應時,它不會撥打我指定的號碼。它說的say
Twilio c#TwiML不撥號碼。代之以
內容後,只是說數目,而不是這裏是TwiML
<?xml version="1.0" encoding="utf-8"?>
<Response>
<Say>Your call will be charged blah blah.</Say>
<Dial action="http://mywebsite.com/Call/CallComplete" callerId="+441XXXXX">
<Number>+44795XXXXX</Number>
</Dial>
</Response>
這裏是C#
public static string TwiMLDial(string maskedNumber, string to, string actionURL)
{
var response = new Twilio.TwiML.VoiceResponse();
response.Say("Your call will be charged blah blah.");
var dial = new Twilio.TwiML.Dial(action: actionURL, callerId: maskedNumber);
dial.Number(to);
response.Dial(dial);
return response.ToString();
}
我使用C#.NET的核心。並在我的startup.cs中可能有以下相關的:
services.AddMvc(config =>
{
// Add XML Content Negotiation
config.RespectBrowserAcceptHeader = true;
config.InputFormatters.Add(new XmlSerializerInputFormatter());
config.OutputFormatters.Add(new XmlSerializerOutputFormatter());
})
.AddJsonOptions(options =>
{
options.SerializerSettings.ContractResolver = new DefaultContractResolver();
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
});
啊,謝謝!我的確在控制器中返回一個字符串。 – James
將其更改爲使用application/xml返回,現在都很好。再次感謝! – James
真棒,很高興有幫助! – philnash