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.)