I am using twilio for automated outbound call. I am trying to play an audio file and simultaneously gather input from user. And when user gives input stop that audio file and gather action must be called.
What I have done is :
gather = Gather(input='speech dtmf',speechTimeout=2,numDigits=1, action="gatherResponse/{}".format(call_id), method='POST')
response.play("https://any_audio_url.mp3")
response.append(gather)
This code just plays the audio file, gather action is not called.
Twilio developer evangelist here.
I would nest the <Play> within the <Gather> to achieve what you describe. Try your code this way around (note, I'm using gather.play):
gather = Gather(input='speech dtmf',speechTimeout=2,numDigits=1, action="gatherResponse/{}".format(call_id), method='POST')
gather.play("https://any_audio_url.mp3")
response.append(gather)
Check the examples in the documentation for more detail.
Related
By enabling the RecordVideoParticpants to true,I am able to record the VideoRoom in my Twilio Account but it is getting saved as separate Media files with different Video and Audio entities.
Is there a way to combine and encode it into on single Video-with -audio.
Thank you.
https://www.twilio.com/docs/video/api/recordings-resource
I am following the above mentioned docs.
Yes, that is the reason for the Compositions API.
The Twilio Recording Composition API lets you transcode and combine
the individual Track Recordings stored by the Twilio Video Recordings
API.
I am trying to build an API which can Onhold both inbound and outbound calls, what I basically do is, update the CallResource and forward it to a Play command when I want to hold on and connect to the agent if I want to resume the call.
This works good, I am able to hold on/ resume call successfully.
I have seen some questions and answers regarding this, Twilio support suggests to use Conference option for that, isn't there may be a new solution (or other solution) for this.
What I want is actually merge child call recordings, isn't there an option for this?
Thanks.
Twilio developer evangelist here.
There is no way to concatenate call recordings within Twilio, what I would recommend is to download the files and concatenate them with something like ffmpeg. You should be able to script this too.
I made a simple chatbot using the studio template and it works fine. However, it then loops after the last response. So let's say I give the user 2 choices, Y and N. After they say Y they get a response but if they message the bot again they get the initial message once again to loop the process. How do I stop this? In the docs I only found info on how to stop all incoming messages but this isn't what I want. I just want to end the convo for good as in my application it has a one time use intention. Thanks.
Twilio developer evangelist here.
There's not really a way to stop incoming texts. What you want to do in this case is stop responding to an incoming text after the initial flow through.
The way to do this would be to use Twilio Functions and function widgets to store the numbers that have successfully completed the questions (you could use any database for this, if you want to keep it within Twilio then Twilio Sync can help here). Then you can insert a function widget at the start of the flow that retrieves whether the number messaging has completed the questions and combine with a split widget to decide whether to send the first message or just complete the flow.
Let me know if that helps at all.
According to "Example Playlist Files for use with HTTP Live Streaming: Basic Variant Playlist", it describes snippet text below :
Note: A variant playlist is not re-read. Once the client has read the variant playlist, it assumes the set of variations isn't changing. As soon as the client sees the endlist tag on one of the individual variant, that ends the stream.
but I could not find related APIs to get event for "endlist tag" occur.
Does any one has suggestion to get this event by delegate or function?
Thank you !
Web
Safari will just fire the ended event on the HTML5 video element when playback finished.
If you are using third-party players like hls.js or Bitmovin Player you may want to check their API; Most of them provide cross-browser convenience functions for this.
Apps
For native apps on iOS the AVPlayerItemDidPlayToEndTimeNotification event might be what you want to look at.
I could not find a way to get last_access_date for a recording. The following API call returns dateCreated/dateUpdated
https://www.twilio.com/docs/api/rest/recording
Is there a way to get lastAccessDate for a recording?
Twilio evangelist here.
Last accessed date is not something we currently include in the Recording resource details. If you are sending the Twilio recording URL direct to your customers then there is isn't a way to tell when they last accessed the file. You could put an arbitrary lifetime on the file (eg we delete it after X days), but that may not be the best use case.
A better approach might be to, instead of giving them the direct URL, give them a URL that goes through your own web application and them redirects them to the recording URL. This would allow you to track when the customer has last accessed the file (because they would have to go through your URL).
Of course with using a redirect, it would not be hard to find out the URL you have redirected them to and go around your app if they wanted to. In that case you might have to consider downloading the recording into your system and having your customers download it directly from you.
Hope that helps.