How does Twilio Speech Recognition work for outbound calls? For incoming calls, I'd assume creating Twilio functions under developers tools, handle with VoiceResponse and set the A CALL COMES IN option to the create function
Assume calling into an IVR system, listening to the IVR prompts, use Speech Recognition and then have twilio perform an action.
Is it possible?
Twilio developer evangelist here.
When you make an outbound call, you need to set a URL within the API request that Twilio will make an HTTP request to to find out what to do once the call connects. From then it's basically the same as the inbound call.
You would return the <Gather> TwiML with input set to speech with an action defined for the URL to call once the speech recognition has a full result. You can use that URL to respond to further prompts from the IVR that you're calling, or do other things like <Dial> onto another number once you've, say, connected with an agent via the IVR.
Let me know if that helps at all.
Related
I want to do the following in Twilio Studio:
I want an incoming call to be recorded and I want the person answering the call to hear a voice whisper - not the person calling. How do I set this up in Studio?
I'm not a coder and don't have a technical background. That's why I want to keep to the drag and drop features.
Twilio Studio doesn’t currently support the capability to handle whisper (playing a text to speech message or mp3 to the dialed party before connecting the calls together. You should be able
to do this with the Studio TwiML Redirect Widget and a TwiML Bin or Twilio Function providing the necessary TwiML.
The TwiML Number noun has a URL attribute which provides this whisper functionality.
I am trying to use my laptop (running Twilio) to dial a land line using python 3 and have have a voice conversation. This is the simplest use case.
Here is the python code I am running on my laptop.
def test_voice_command_inline(self):
'''calls landline from laptop via twilio'''
twilio_client = twilio.rest.Client(self.twilio_account_sid,
self.twilio_auth_token)
vps_url = self.get_vps_url()
twilio_voice_call = twilio_client.calls.create(
from_=self.twilio_phone_number,
to=self.land_line_number,
url=vps_url
)
When I run this code, my land line rings, and I answer it. The call is connected. Next I get prompted by Twilio to press a key to "execute my code" (aka the webhook)
Since I already have a connected call, I don't need a webhook. I just want to start talking. However, the Twilio rest api requires me to put in a webhook url that returns TwiML to direct the call flow. And when the TwiML is finished processing, the call is hung up. I don't need a webhook, yet I am required to have one.
I tried various things in the webhook code in an attempt to let the already connected call continue. I tried returning blank TwiML from my webhook, which causes an immediate hangup. I also tried dialing the land line number from inside the webhook. Since the rest api already connected the call, trying to re-dial the number from the webhook caused a busy status (Twilio console). Looking at all the TwiML verbs I can use in the webhook, none look appropriate for my needs.
I must be missing something simple. Why can't I use the code above to make a voice call between my laptop and my land line (or any other phone)?
Twilio developer evangelist here.
When you make an outbound call using the REST API, Twilio is setting up a call between our server and the to number. The from number that you supply is just the callerId for the call.
In order to connect the call you make with the REST API to another phone, you need to return TwiML from your twiml_url that dials another number. Currently your TwiML is just an empty <Response> but it should be something like this:
<Response>
<Dial><Number>OTHER_NUMBER</Number></Dial>
</Response>
This can be written out by Python code too, if you want it to be dynamic. That's where you use the VoiceResponse that you mention. The important thing is that the second leg of the call that you are making should be controlled by TwiML returned from your URL.
Let me know if that helps at all.
For incoming calls:
1) I am new to twilio, but I always want a "All calls are being monitored or recorded" to play for all incoming calls. What is the best way to do this?
2) I would like to create two messages after the "monitoring" message is played. one message during open hours and a second message during closed hours.
What is the best way to do this? Any good documentation?
Twilio developer evangelist here.
Welcome to using Twilio! I'll give you a quick overview of how incoming calls to Twilio work then point you to some useful parts of our documentation that will help you achieve what you are working towards.
When a Twilio phone number receives an incoming call, Twilio will send an HTTP request to your web application, asking for instructions on how to handle the call. Your web application will respond with an XML document containing TwiML. That TwiML contains the instruction that Twilio will follow to say some arbitrary text, play an MP3 file, make a recording and much more.
In your case you want to read messages to the caller, you could either do that by returning TwiML that uses <Say> to read out the messages using our text to speech engine. Or you could record yourself reading the message and play that to the caller using the <Play> TwiML.
To learn more:
Follow the Programmable Voice Quickstart
If you need more specific instruction on a particular Twilio feature, check out the Twilio Guides
If you need to see Twilio features as part of a complete application, check out the Twilio Tutorials which cover more specific use cases
Let me know if that helps at all.
We use microsoft botframework for our chatbots. We would want to enable Voice channel to our bot. Is there a way to solution this? Does Twilio have anything that can add speech capabilities to our bot. Our bots are exposed via webchat components, skype, facebook messenger etc.
Twilio developer evangelist here.
There's no way within Botframework to add voice capabilities from Twilio, however receiving calls works in a similar way. When someone calls your Twilio number you receive a webhook which you can respond to with TwiML to tell Twilio what to do with the call.
To then perform things by voice action you can <Record> the caller's response and set the transcribe parameter to true. You also need to set a transcribeCallback URL as the transcription is done asynchronously. Once you receive that callback, the text of the transcription will be available as a parameter in the request. You could also perform the transcription yourself with a third party service by just taking the recording and sending it off.
Once you receive the transcription you can then make your decision as the the next step of the conversation and redirect the live call to the next step of your process using the REST API.
This is just a high level overview of how you might accomplish this. Let me know if it is of any help.
Voximal offers as Twillo a similar product but based on VoiceXML. The difference is that Voximal integrates natively most of STT engines (Microsoft, Google, Watson, iSpeech) in the solution (you only need to set the key or the user/password to configure them). You use a builtin grammar "text" to translate. Then the processing is very similar to the Twilio. You need to push the content to a chatbot engine (HTTP/XML/JSON), and you have a way to play the result with a TTS engine.
Have a look to the Parrot example (a script that repeats all you said using the STT and TTS) :
https://github.com/voximal/voicexml-examples/blob/master/parrot/parrot.vxml
This is more of a general quest ok but when using Twilio dial in a twiML to connect the caller to another number, can you disconnect Twilio after they are connected or will it just keep connected and increase the call time?
Twilio developer evangelist here.
It sounds like you are asking whether, when you direct a phone call to a TwiML app with something like this:
<Response>
<Dial><Number>OTHER_PHONE_NUMBER</Dial>
</Response>
that you want to disconnect from Twilio once the call is connected to the number?
If that's the case, then the answer is no, I'm afraid. Once a call comes into Twilio, it is being controlled and routed by the Twilio system and you will incur costs by the minute. Whilst this call continues to live you will still be able to affect it via the REST API using its call SID.
Let me know if this helps or if you have any other questions.