Search code examples
c#asp.nettwilio

How to send digits while making outgoing phone call with TWILIO


I am using Twilio to make outgoing call to a number that is running an IVR system and I have to supply various digits as per the required IVR menu options. Right now, I have tried almost all the sample codes and Quick Start tutorials but it didn't work for me.

I am using ASP .Net web application to make a call using Twilio official C# helper library. I am using following code to make a call.

Following is the TwiML instruction provided to Twilio after the call gets connected

        StringBuilder sb = new StringBuilder();
        sb.Append("<?xml version='1.0' encoding='UTF-8'?>");
        sb.Append("   <Response>");
        sb.Append("         <Dial callerId='+1852xxxxxxx' record='true' >");
        sb.Append("               +1475xxxxxxx ");
        sb.Append("         </Dial>");
        sb.Append("   </Response>");
        Response.Write(sb.ToString());

Please note that the 'Dial' verb doesn't support the sendDigits parameter.

Your immediate response will be highly appreciated, as I am stuck and need to fix this as earliest as possible.


Solution

  • After thoroughly review the documentation, I found a <Number> noun for the <Dial> verb that allows to provide sendDigits parameter. So my problem has been solved. Thanks to all of you for your support.

    Regards,

    Tahir Ahmed