Play live stream on twilio hold - twilio

I have a need to play LIVE audio to enqueued twilio calls (instead of playing hold music from an mp3 file for instance).
I've tried pointing the hold music to a live mp3 stream (icecast), which didn't work.
The only thing I can think of is to start a conference, put a call into it that is sending the audio I need to be played on hold, and then on-hold calls are placed (muted) into that conference.
Doesn't seem like best way, and I'd like to avoid conference costs though (there are millions of minutes per month of on-hold time).
Is there a more elegant solution for this problem?

Twilio developer evangelist here.
As far as I am aware this is not possible with <Play>. When you give Twilio an mp3 file to play it first downloads and caches the file (if the headers allow for it). When working with mp3 files Twilio expects an existing file and a finite file size.
I think using a conference, or a series of direct one to one calls, to play the stream as you suggested is likely the best solution. If you do have millions of minutes per month then I recommend you get in touch with the Twilio sales team who might be able to make those minutes more affordable.

Related

How do I create single audio file of video calls? Having both participants audio in single file?

We are using twilio video call. We need to create real time transcription for this call. How shall I do that? We tried to use twilio composition api but it's taking too long.
Tried twilio composition api to compose the separate audio files from each participant. This takes forever to create the composition. We need it near real time.

mp4 pseudo-streaming implementation server & iOS side

I'm trying to learn how to do pseudo streaming for MP4 files. I can't think of a good way to do it, but I just found a great example app has similar implementation (except I don't understand how it does it yet)
Here's the scenario:
Alice can send a video to Bob in the app
Bob can open it immediately and see Alice's video, from beginning, while Alice is still recording it
Also, Bob can choose to view the video later after Alice finished recording. But Bob should be able to view the video instantly without waiting too much time, even when the whole size of the video is large.
Thus, my hunch is, it's using some sort of pseudo streaming for mp4.
Here's the screenshots of the requests Alice's phone makes while using the example app:
The screenshot suggests, the example app is making an array of PATCH requests to their server, every 0.x seconds. And finally, the very last request will make a PATCH to update the moov information for this MP4.
Thus my question is, how is this implemented (any educated guess will be welcomed)? Or is there any sort of existing protocol/iOS encoder that I didn't know is doing this already?
Thanks a lot!
Reading the text of your question rather than the title, I think there are a number of likely steps:
Alice is recording video
She is ending the video to a streaming server
Alice notifies Bob that the stream is available and sends the URL on the streaming server that Bob can access to retrieve the stream
Bob's video client requests the stream, using range request to download it chunk by chunk
Have a server in the middle like this is a typical approach for any stream which may have more than one client watching it.
More sophisticated streaming servers may also support delivery the stream in different bit rates and even encoded with different codecs for maximum device reach.
There are commercial (e.g. https://www.wowza.com) and open source streaming servers (e.g. https://gstreamer.freedesktop.org) you can look at to get more info on streaming servers and to see some examples.

Twilio introduces 5-second delay before playing mp3 files

We have built a simple proof of concept app using Twilio. The app plays very short MP3 files upon demand. We are consistently seeing a delay of about 5 seconds before the audio plays. Our audio files have no delay/silence at the beginning. Our files are very small. As a test I have visited the MP3 url in my browser and it responds immediately i.e. there is no apparent delay introduced by our server that serves the files. Can anyone explain why this might be happening? This is a trial account, so I thought that maybe Twilio introduces an intentional delay on trial accounts, but I can't find any reference to that in the docs. Thanks.
I resolved this. I had mistakenly specified finishOnKey instead of numDigits, which screwed things up.

Twilio Recording: Pause and Resume

I believe the answer is no, but does Twilio provide ability to pause/resume a recording? Use case is recording a call, but pausing recording when collecting sensitive information. From the REST documentation, it doesn't appear to be a supported capability. Thought someone might have found some options for this requirement.
This is possible, though it's not wholly obvious how from the documentation.
You can modify call state using the REST API, as per https://www.twilio.com/docs/api/rest/change-call-state , and we basically use it to tell the call to re-dial to the same agent (presumably this is a call centre?) but with no-record, and then again with record re-activated once we're done.
You end up with two separate recordings for the call, which in our case we download, stitch together, and store back to our storage platform.
Edit:
Having discussed this issue with Twilio support, there's another possibility which allows you to just have a single recording.
Instead of dialling the two ends of the call together, you instead put them both into a conference that's recorded when you initially connect the call. When you want to pause it, using the REST API, you add a new "hold" leg into the conference, then move the two real ends of the call onto a new conference that isn't recorded. When you're done, you move them back again and it's "unpaused". You then only have one recording from the original conference.
None of these is ideal, and apparently they are working on a proper support setup for this (fairly obvious!) requirement, but this should solve it for now.
The Recording Pause & Resume feature is now supported in the Twilio API. Here's a link that gets you started:
https://support.twilio.com/hc/en-us/articles/360010199074-Getting-Started-with-Call-Recording-Controls#pause_resume

Sending tones via a manual process with Twilio

Our call center deals with businesses and we use Twilio to make our calls. However, many businesses have a menu to navigate before we get to talk to someone. How can I create a 10-key pad on our end and use it to send menu selections to the call we are connected with?
I know about the senddigits attribute on Dialing numbers with Twilio, but this sends preprogrammed tones. We have no way of knowing what the tones need to be until we are connected and in the menu, so this won't work.
I've been through the API pretty thoroughly and can't seem to find anything relating to this.
If there is nothing, is there another software that anyone can recommend that allows for making calls out, generating recordings of calls and allows me to send keytones manually after the call has been started?
Check out the digits attribute of the 'Play' tag.
https://www.twilio.com/docs/api/twiml/play#attributes-digits
Each 'w' character tells Twilio to wait 0.5 seconds instead of playing a digit.
Assuming I am understanding your problem, could you not us MP3s of DTMF tones (http://jetcityorange.com/dtmf/) and PLAY to send the tones after the call has started?

Resources