0

我想从 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;
        }
4

1 回答 1

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();

我的同事 Devin 写了一篇博文,详细解释了这一点以及您可以在此处使用的其他一些很酷的动词。

希望这可以帮助。

于 2015-04-08T13:55:13.750 回答