Search code examples
twiliotwilio-apitwilio-programmable-voice

Twilio action for record


I'm trying to create a Twilio workflow that places a call and records what the user says. For that I'm using Record, but I'm not entirely sure what to place in the action parameter.

Even though I understand Twilio will send information about the call to that URL, I don't necessarily require it. Is there a way to have some sort of a sinkhole for information?

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="woman">Hi! Say your name:</Say>
<Record method="GET" action="URL_here" timeout="2"/>
</Response>

Solution

  • I don't think there is another option but to create a bin or another endpoint and return an empty response like:

    <?xml version="1.0" encoding="UTF-8"?>
    <Response />
    

    If you omit the action attribute you'll end up with a loop which is probably not what you're looking for.

    The 'action' attribute takes a relative or absolute URL as a value. When recording is finished Twilio will make a GET or POST request to this URL including the parameters below. If no 'action' is provided, will default to requesting the current document's URL.

    After making this request, Twilio will continue the current call using the TwiML received in your response. Keep in mind that by default Twilio will re-request the current document's URL, which can lead to unwanted looping behavior if you're not careful. Any TwiML verbs occurring after a are unreachable.

    (https://www.twilio.com/docs/voice/twiml/record?code-sample=code-using-attributes-in-a-record-verb&code-language=output-twiml)