【问题标题】:Get the response of the clicked number from Twilio从 Twilio 获取点击号码的响应
【发布时间】:2015-04-08 13:43:06
【问题描述】:

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

【问题讨论】:

    标签: c# twilio twilio-click-to-call


    【解决方案1】:

    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 写了一篇博文,详细解释了这一点以及您可以使用的其他一些很酷的动词 here

    希望这会有所帮助。

    【讨论】:

    • 感谢您的指导。你能告诉我我需要把代码放在哪里吗?
    • 当然,只需阅读我指向您的博客文章,它将向您展示如何构建此类应用程序。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多