0

So I have an application in ASP.NET Core 2 that uses the Twilio SDK to return Twiml from many endpoints.

The thing that I haven't found any documentation on is how to nest commands to get a result like this

<Response>
  <Gather action="http://test.net" method="POST" timeout="15" numDigits="1">
     <Say>Option 1</Say>
     <Say>Option 2</Say>
  </Gather>
</Response>

There is an Append and a Nest function that supposedly takes a child element and nest it into the parent element, but it does not result in what I want, maybe I'm not using it correctly

Rene M.
  • 103
  • 1
  • 9

1 Answers1

0

ok so I just found how to nest, it looks kind of messy so if there is a better way of doing it let me know.

        var response = new VoiceResponse();

        Uri Redirect = new Uri("http://google.com");

        var gather = new Twilio.TwiML.Voice.Gather(timeout: 15, numDigits: 1, action: Redirect, method: Twilio.Http.HttpMethod.Post);

        gather.Append(new Twilio.TwiML.Voice.Say("Option 1"));
        gather.Append(new Twilio.TwiML.Voice.Say("Option 2"));

        response.Append(gather);

        return TwiML(response);
Rene M.
  • 103
  • 1
  • 9