0

I want to get the response from twilio like the button that has been pressed by the user during the call.

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;
        }
Vivekh
  • 4,141
  • 11
  • 57
  • 102

1 Answers1

0

Twilio evangelist here.

If I understand your question correctly, what you're trying to do is get the digits pressed by the user during a call. For that you can use the <gather> verb, which will collect the digits pressed by the user and then hit your application to check what to do about each of the digits pressed.

An example of that in .Net would be as follows:

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

My colleague Devin has written a blog post that extensively explain this and some other cool verbs you can use here.

Hope this helps.

Marcos Placona
  • 21,468
  • 11
  • 68
  • 93