我希望得到twilio的响应,就像用户在通话过程中按下的按钮一样。
var authToken = ConfigurationManager.AppSettings["twilioAuthToken"] + "";
var authAccSID = ConfigurationManager.AppSettings["twilioAccountSID"] + "";
var options = new CallOptions();
options.To = customer.PhoneNo;
options.From = "+14796898969";
//string Url1 = "http://localhost:62688/abc.xml";
options.Url = "http://twimlets.com/menu?Message=hello%20roopasoft%20sir%20please%20press%201%20to%20hear%20ur%20designation%202%20for%20ur%20name&Options%5B1%5D=http%3A%2F%2Ftwimlets.com%2Fholdmusic%3FBucket%3Dabcd%26Message%3Dhello%2520sir%2520welcome%2520to%2520roopasoft%26&Options%5B2%5D=http%3A%2F%2Ftwimlets.com%2Fmessage%3FMessage%255B0%255D%3Dohh%2520sir%2520get%2520out%2520%26&";
//options.Url = "http://twimlets.com/echo?Twiml=" + Url;
options.Method = "GET";
options.FallbackMethod = "GET";
options.FallbackUrl = "http://localhost:62688/VoiceRegister/Test";
options.SendDigits = "5";
options.StatusCallbackMethod = "GET";
options.Record = true;
var client = new TwilioRestClient(authAccSID, authToken);
var call = client.InitiateOutboundCall(options);
public ActionResult Test(VoiceRequest req)
{
int user_pushed = int.Parse(Request["Digits"]);
return null;
}
答案 0 :(得分:0)
Twilio传道者在这里。
如果我正确理解了您的问题,那么您尝试做的就是在通话过程中获取用户按下的数字。为此,您可以使用< gather>动词,它将收集用户按下的数字,然后点击你的应用程序,检查如何处理每个按下的数字。
.Net中的一个例子如下:
var twiml = new Twilio.TwiML.TwilioResponse();
twiml.BeginGather(new { action = “yourpage.cshtml”, numDigits = “1″ })
.Say(“Please press 1 to repeat this menu. Press 2 for directions. Or press 3 if you are done.”);
twiml.EndGather();
我的同事德文撰写了一篇博文,广泛地解释了这个以及其他一些你可以使用的酷动词here。
希望这有帮助。