I've recently run into an issue with the TwiML <Hangup>
verb. I have a simple setup that works as follows:
I have a Twilio number setup to receive incoming calls, and configured to use a TwiML bin that is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Record timeout="5" transcribe="false" trim="trim-silence" maxLength="10"/>
<Hangup/>
</Response>
The goal was to have the number pickup an incoming call, record at most 10s of audio from it, trim the silence, and then hangup. It does all of this correctly, except hangup.
At this moment, instead of hanging up, after a recording ends by reaching the maxLength
of 10s a new recording is started. This continues until the end of the call, and typically leads to 2-5 recordings per call. Its as if the <Hangup>
verb is entirely ignored. Here is an example of what I mean:
Twilio Call Details Screen
I'd like to know if anyone has encountered this before (and what you did to get around it), or what I can do to have my call hangup properly after recording. My current solution is this:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<!-- This is a hacky solution. I found by accident that passing an invalid action argument causes the call to forcibly hangup (after the recording is completed) - hence the action "breakcall" below. = -->
<Record timeout="5" transcribe="false" trim="trim-silence"
action="breakcall" maxLength="10"/>
</Response>
However this is hacky, and I'd rather figure out the right way to do it.
Thank you!