2

I want to make an outbound call to an known IVR system from my application; IVR: If you would like to do this, press 1 Application: should be able to input 1, choose to option (after 15 secs wait)

I have tried and and to wait for IVR to finish giving menu options to choose from. And ultimately to finally record the status of my call


        String from = "+14048000746";
        String to = "+1479268XXXX";

        Call call = Call
                .creator(new PhoneNumber(to), new PhoneNumber(from), new URI("https://xxxxxxx.com/TwilioVoice/TwilioCall.xml"))
                .create();

        System.out.println(call.getAnsweredBy());
        System.out.println(call.getStatus());
        System.out.println(call.getSid());

<!-- TWIML -->
<Response>
  <Record transcribe="true" />
  <Pause length="10" />
  <!-- Refill Option -->
  <Dial>1</Dial>
</Response>

Also tried

<Response>
    <Record transcribe="true" />
    <!-- Refill Option -->
    <Dial>
        <Number sendDigits="wwwwwwwwwwwwwwwwwwwwwwwwwwwww1" />
    </Dial>
</Response>

I expect the Twilio outbound call with any way to be able to input digit in response or prescription number during the call later to order my refill and ultimately get the status if the order has been placed successfully or not and when to pick up etc.

Rizwan Zia
  • 31
  • 3

1 Answers1

0

When creating outbound call you can pass SendDigits param as part of initial request

Example from https://www.twilio.com/docs/voice/make-calls#manage-your-outbound-call:

// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.http.HttpMethod;
import com.twilio.rest.api.v2010.account.Call;
import com.twilio.type.PhoneNumber;

import java.net.URI;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        Call call = Call.creator(
                new com.twilio.type.PhoneNumber("+14155551212"),
                new com.twilio.type.PhoneNumber("+18668675310"),
                URI.create("http://demo.twilio.com/docs/voice.xml"))
            .setMethod(HttpMethod.GET).setSendDigits("1234#").create();

        System.out.println(call.getSid());
    }
}
Ostap Maliuvanchuk
  • 1,125
  • 2
  • 12
  • 32