Skip to content Skip to sidebar Skip to footer

How To Play And Record Voice At Same Time In Twilio

I was working with twilio my case is when user make a call IVR will ask for user mood and then start recording for 10 second, take that recording to server find podcast according t

Solution 1:

Twilio developer evangelist here.

I'm afraid that it is currently not possible* to record slices of a call while simultaneously playing an mp3.

Can I suggest that rather than voice you use a key press for this functionality instead? You can then use the following TwiML (as an example)

<?xml version="1.0" encoding="UTF-8" ?><Response><Say>Press any digit to skip this podcast</Say><Gatheraction="/voice/check-digits"numDigits="1"><Play>https://somechannel.com/podcast.mp3</Play></Gather></Response>

Then you will need an endpoint in your application at /voice/check-digits that directs the user onto the next podcast.

*OK, it might be possible if you play the audio into a conference and have another script dial into the conference and record 10 seconds, then hangup as another script dials in to start recording. But even then, you'd be trying to extract the voice of the caller from the audio of the podcast and that is unlikely to be accurate at all. Especially if a voice in the podcast says "skip". So I still recommend using <Gather>!

Post a Comment for "How To Play And Record Voice At Same Time In Twilio"