2

I use Twilio in order to make a programable call. As you can know Twilio uses TwiML files for a call configurations. I would like to build the TwiML file in runtime.

I use Twilio dependency to work with API, so call looks like:

Call.creator(new PhoneNumber("to"), new PhoneNumber("from"), new URI("http://demo.twilio.com/docs/voice.xml")).create();

I've found that I can build my own TwiML using the implementation of TwiML class from the dependency.

new Say.Builder("Hello!")
            .language(Say.Language.EN_AU)
            .voice(Say.Voice.MAN)
            .build()
            .toXml();

How can I pass a created TwiML to make a call?

boden
  • 1,621
  • 1
  • 21
  • 42

1 Answers1

0

You can for example pass your endpoint to Call configuration instead of file - http://your/server/url/calls and resnpond with generated TwiML from there.

wprzechodzen
  • 619
  • 4
  • 13