0

I am using the Twilio.Twiml library for C# / .NET

I'd like to dial two numbers at the same time, e.g.,

   <Response>
      <Dial action="/callended" method="POST">
        <Number>+12125551212</Number>
        <Number>+12125553333</Number>    
      </Dial>
    </Response>

How do I do that using the the library?

I see examples such as:

var response = new VoiceResponse();
response.Dial("+1-212-555-1212")

But I can't figure out the syntax for dialing more than one number with the same action.

user3079993
  • 153
  • 1
  • 9

1 Answers1

1
//using System.Xml.Linq;

        var number1 = new XElement("Number", "+12125553333");
        var number2 = new XElement("Number", "+12125551212");
        var dial = new Dial(timeout: 10, callerId: request.From, record: "true", action: "/voice/initialcallend", method: "POST");
        dial.Element.Add(number1);
        dial.Element.Add(number2);                
        response.Dial(dial);

yields

<Response>
    <Dial timeout="10" action="/voice/initialcallend" method="POST" record="true">
        <Number>+12125553333</Number>
        <Number>+12125551212</Number>
    </Dial>
</Response>
user3079993
  • 153
  • 1
  • 9