Twilio Flex stream audio over websocket - twilio

I am trying to stream audio when an agent picks up call on a flex dashboard. Although one can start streaming when working with twilio APIs. But I didn't find any docs related to this usecase.

Twilio developer evangelist here.
You can insert the fork stream widget into the Studio flow that leads to a Flex agent?
[edit]
As requested, the media stream should join when the call is accepted by an agent. I don't think you can do this in Studio, so you would have to implement this as a Flex plugin. When the plugin detects that a call has been accepted by an agent it could make a request using the call SID to modify the call and inject the <Start><Stream> TwiML.
I don't have more detail on that right now, as I've not built that sort of thing myself. Let me know if this helps.

Related

How to use Twilio API to create a Twilio Function (or any other Twilio built-in service) that forwards incoming calls?

In my app, the users see a list of Twilio numbers.
I simply want to give the user the ability to specify a "forward number" for each of these numbers, and my app would call the Twilio API to set this up properly.
I understand that I can give each Twilio number a webhook, which returns TwiML that can facilitate the forward.
But because call forwarding is such a basic feature (the app has no needs to configure anything other than this), I was thinking, Twilio must have something built-in for me so that I don't have to host such a webhook just for call forwarding?
So I looked into the docs and found:
TwiML bins: snippets of TwiML directly hosted in Twilio – but can be created by console only and not API, useless for my scenario.
Twilio Studio: basically their IVR builder. Does seem to have API access. But I only need basic forward and have zero use for call flows etc, so this seems completely overkill?
Twilio function: this appears to be what I want. Twilio hosted functions that do not require self-hosted webhooks. It even has built-in templates for call forwarding in the console. But how do I create and update these programmatically via API so that I can pass in the numbers to forward to? From what I can see in the runtime API, functions can be created/updated with only the basic name/sid properties, so they're essentially empty functions? I do see this FunctionVersionContent API but it seems to be read only?
I'm lost at this point. Is there an API in Twilio I can call to set up basic call forwarding on a Twilio number that's all taken care of on Twilio's side, a feature that is provided to customers of basically any phone service?
Twilio developer evangelist here.
There are multiple ways to forward calls with Twilio APIs! And the great thing about APIs is that you can customize the solution to how you wish. I'd recommend looking at setting up call forwarding that references Studio, TwiML Bins, Webhooks, and Functions, this docs page on call forwarding with Studio, this blog post on call forwarding with Studio.
You can update Twilio Functions via the Twilio Serverless Toolkit as well! Let me know if this helps at all!
Figured it out from Twilio support. This can be done via query parameters with TwiML bins or Twilio Functions.
Even though TwilML bins cannot be created/edited with API, each bin has a URL that can be used as a webhook. So defining one bin like this:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>{{forwardTo}}</Dial>
</Response>
Then update the VoiceUrl to use https://url.to.bin?forwardTo=e164number
This only works if numbers are provisioned in the same account as the TwiML bin. If the numbers are provisioned in subaccounts, we can use public Twilio functions instead.

How to add TwiML to TwiML Bin via Twilio Api only?

I am automating many Twilio procedures and want to create a TwiML file and add to a subaccount's twiML bin. Is there any way to work with the the twiML bin via Twilio's api? I have looked at their extensive docs and cannot see anything that would help me. I do not want to use the Twilio console for this task.
There is no API for creating, reading, updating or deleting Twiml Bins. As Levi stated, you will want to use Twilio serverless Functions instead, Functions & Assets (API-only), and/or host the application logic on your side and programmatically update the respective webhooks.
Locally Develop and Debug Twilio Functions in Node.js

Is it like If I am using Twilio Flex, then I only have to customize the UI and build the API from scratch?

If I am using Twilio flex then do I need to build the API from scratch and can customize the UI according to me.
Means can I build API of my own? And I don't need to build my own UI, just customize that which is provided by flex.
Twilio developer evangelist here.
When you are building with Flex you can absolutely add your own endpoints so you can call other services from the UI. I've done this before using Twilio Functions, but as long as the URL can respond to HTTP requests you can host it anywhere.
This is a good way to customise Flex to extend it outside of the Twilio API.

Twilio how to connect Autopilot to a Studio flow

I have set up a demo Twilio studio flow which can process a loan via text or voice. I would now like to put an autopilot in front of it to chat to the user to identify they want a loan and then pass them to my studio flow.
Ideally this would be seemless but I suppose it could pass details from the autopilot to the studio and perform a call back. Is either approach possible?
As of May 23, 2019 Studio has added Autopilot widget support.
Here is a blog that has the details of how to use it.
Twilio developer evangelist here.
I've had a look around and it doesn't look like there is a dedicated Autopilot Studio widget yet.
I've not spent much time with Autopilot myself yet, but a look over the docs suggests that you can maybe use the Autopilot Query endpoint from an HTTP request Studio widget. The Query endpoint returns JSON which can be parsed and read by other widgets in Studio.
Let me know if that helps at all.

How to get the info about the incoming call when the calling party starts

We need to get the info about the incoming call when the calling party starts to hear the welcome message from IVR. Could you please advise how can we achieve that.
Since you tagged that question with [jtapi] I assume you would like to use it.
You didn't mention where you would like to receive or how to use that information so I can give you only a brief overview.
If you need it in the IVR and it is a Avaya Experience Portal then you just add the CTI integration to your project and use the CTI Call Info node to have access to call data.
Or you can develop custom application in Java with JTAPI. You start monitoring IVR incoming extensions and when a new call is answered you store call data and the IVR script can get this data via web service calls for example.

Resources