0

I have a Java application which uses the Twilio API to connect to Twilio and pass it a number in my org. to call. Twilio calls the number, I play it a message from my phone system and then I want my Java program to read Twilio's transcription of that message.

The problem I have is that Twilio doesn't know when to hang-up! I can't tell it to hang-up after the <record> verb as it does a submit at that point, so I want to do a Thread.sleep(20 * 1000) in my Java and then end the call from the Java? Possible? I can't see how to do it via the API. I've tried:

Call.updater(phoneHome.getSid()).setStatus(UpdateStatus.COMPLETED);

and:

Call.deleter(phoneHome.getSid()).delete();

but to no avail!

Also open to other ways of achieving same end in the TwiML, etc. Had a look at the <gather> and <redirect> but not sure I could make that work if the recording is playing, that only seems to work if nothing is played, i.e. silence from the called-party (my org.)

1 Answer 1

0

Ok, so what I didn't want to have to do is send the GET request from the <record> verb anywhere as that would entail opening up a firewall gap into my organization, not an easy process.

So, I sent a get request to another TwiML document on Twilio which has a <Hangup/> verb in it. The sent recording never leaves Twilio, but that's Ok. I just wanted the call to end and the maxLength="20" on the <record> verb dictates when it ends. HTH.

1
  • 1
    Hey, I'm a developer evangelist from Twilio, this sounds like you have solved your issue for now. But do let me know if there's anything else I can help with.
    – philnash
    Commented Dec 4, 2017 at 23:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.