我有来自Twilio.com的代码来拨打电话。但是我如何发布一些可以用参数击中[HttpPost]函数的参数。
// Twilio请求
var call = CallResource.Create(
method: Twilio.Http.HttpMethod.Post,
url: new System.Uri(URL),
to: new Twilio.Types.PhoneNumber(To),
from: new Twilio.Types.PhoneNumber("XXXXXXXXXX")
);
//我的方法返回TWiml
[Route("~/Index/{message?}/{Voice?}/{Language?}")]
[HttpPost]
public ActionResult Index(string Message, string Voice, string Language)
{
//initializing Voice Response For creating XML
var response = new VoiceResponse();
if ((Voice != string.Empty && Voice != "0") && (Voice == "0"))
{
//Combining dynamic Message and selecting voice for reading message
response.Say(Message, voice: Voice);
var XML = new TwiMLResult(response.ToString());
return XML;
}
if ((Voice != string.Empty && Voice != "0") && (Voice != string.Empty && Voice != "0"))
{
//Combining dynamic Message and selecting voice for reading message
response.Say(Message, voice: Voice, language: Language);
var XML = new TwiMLResult(response.ToString());
return XML;
}
if ((Voice == string.Empty || Voice == "0") && (Voice == string.Empty || Voice == "0"))
{
//Combining dynamic Message and selecting voice for reading message
response.Say(Message);
var XML = new TwiMLResult(response.ToString());
return XML;
}
return null;
//}
//else
//{
// response.Say("Some Technical problem, please contact administrator");
// var XML = new TwiMLResult(response.ToString());
// return XML;
//}
}