Specify Twilio Region for Rest API - twilio

We are using the Twilio Programmable Voice Service globaly. In the US and EU the performance is acceptable. In Australia there is a long delay after the user answers the phone and before the user hears anything. I attempted to set the region using the C# SDK using the regions specified here. That essentially sets the root API url to https://api.au1.twilio.com which does not exists/respond (502 error). Has anyone had any success specifying the region for REST API calls using Twilio?
** I have tried using us1 and ie1 with the same results.

I received this from Twilio Support. It looks like server side API calls are US only.
Thanks for writing and sorry for the trouble. I think where we're
getting stuck is the difference between the server-side helper library
concept of the HTTP client for making and responding to REST API
requests, and the voice over IP product Client and its associated
SDKs.
The region can absolutely be set on the VoIP Client applications, and
we have this in place specifically to address the types of audio
latency you're describing below; the important distinction being that
the region designation happens at the local application, not in the
serve-side code. You can see how to set the region in the JavaScript
library, the Android SDK, and the iOS SDK.
The reason this works for VoIP Client calls is that we have media
endpoint in those regions; however, we do not have regionalized API
endpoints--api.twilio.com is only located in the US, so trying to
create a TwilioRestClient for HTTP requests will not work.
Hope that helps. Please let me know if you have any questions

Related

Making a call from a Twilio client to another Twilio client directly

what I am trying to achieve is to make a VoIP call from an iPhone to an iPhone using Twilio.
To do that I'm using the iOS SDK, the Twilio Voice to be more specific as the iOS SDK is superseded.
I have a server that generates an access token and when I create a call the Twilio API would make a request to my server and I would return a <Dial /> keyword with the client name and the connection would be established.
The problem is, this counts as two calls(iOS app to Twilio is the first one and when I return a TwML <Dial /> response is the second one) so the price is practically doubled.
Is there a way to make it as a single iOS app to an iOS app call? All my server does is to generate the TWiML using the parameters that are sent from the client anyway.
Oh and also in the documentation there are some talks about capability tokens but all the current documentation is using Access Tokens.
Are capability tokens relics of the past for the older API?
Thanks
Twilio developer evangelist here.
Twilio calls are always priced per leg, so in a call between two people you do always pay for the outgoing leg and the incoming leg. They may also have different lengths, if the outgoing call goes through some other TwiML before making the <Dial> for example.
However, if all you want to do is make calls between applications and you don't need to be able to make calls to the phone network then can I recommend you take a look at the Twilio Video project. While it is called "Video" you can use the SDK to make audio calls between apps too. And if you choose to create peer-to-peer rooms, then the audio stream is sent directly between the two devices and not charged as a call leg at all. The only extra thing you need to do is to generate the call notifications yourself.
As for capability tokens, they are indeed a left over bit of documentation. Capability tokens have mostly been renamed as access tokens so you can use them interchangeably. If you investigate the Video SDK, then everything will be Access Tokens too.

Speech to Text using Twilio

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

How can I get Alexa working on my iOS app?

I have been checking out the Alexa Skills kit the past few days. I have also been poring through the documentations for both the Skills kit and the Voice Service. I am just having a little hiccup trying to understand the flow. I have implemented one of amazon's sample skills (favourite colour sample) in the developer console and also wrote a sample lambda function to handle the type of response that will be delivered. Its working on the test simulator and what left is basically getting lambda running through my ios app. However I have the impression that I don't have to use the voice service. Am I wrong? I am quite confused, it would be awesome if anybody who has some more clarity could shed some light on the matter. If I get lambda working also, I think it will accept requests that are in a particular format. Where do I have to send the encoded audio to get a json response to send to the skills kit? To the Alexa Voice Service?
Also I am authenticating my app using cognito and dynamo db. If I were to use Alexa Voice Service, then it is mentioned that the user will have to also login to amazon. So do I still have to work with the login with amazon sdk? Or is there a workaround?
Based on Amazon documentation there are two ways to interact with Alexa:
Sounds like you want to implement the app thru the Companion method.
As far as the JSON goes, i am currently resolving that issue now, (will post answer once I have it resolved).
Basically you have to use AVFoundation to capture audio from iPhone and send 2 https messages to Alexa (One message with JSON Body & the second message with audio captured as body.) Bases on Documentation
Companion App
(You have a device (such as a smart speaker) that you want to add Alexa to. So, you build in support for AVS. Great! Now you need a way to authorize it and associate it with the user's account. This is the "companion app" approach. The companion app connects to your smart product and allows the user to login and authorize the speaker to use Alexa and connect to their Amazon account.)
Mobile OR Website
AVS App
(You don't have a device you need to authorize - instead you want to speak to Alexa from within your Android/Iphone application.)
Android or Iphone
You can find a swift example on github on how to implement a iOS AVS client
https://github.com/chintan1891/iOS-Alexa

StatusCallBack for iOS SDK

I'm using the iOS client SDK for VoIP, and need to know when a caller has accepted, rejected or ignored an incoming call. Everything I've read suggests using StatusCallBack, but this seems to be available only in the REST API, not the iOS client API. How can I do this in iOS?
Michael, Megan from Twilio here.
Unfortunately, at this time it's not possible to do this directly with the iOS SDK. There is a feature request in place.
In the meantime, to set up call progress, you'll need to bypass the iOS TCDevice connect method, and instead have your iOS code make a request to your server to set up both legs of the call through the Twilio REST API, so that it can enable the call progress events. Your server needs to then communicate the events back to your iOS code.
Hope this helps.

Asterisk registration programmatically

I am trying to implement Asterisk server for VOIP in an iPhone application.
I am able to register the user through manually, but I wanted to do the same thing programmatically. I am not sure but there might be some idea like sending through an HTTP request.
If you have any idea or pointer please share with me.
Thanks
I think the thing that you are looking for is called SIP client. You install the client on the iPhone and it will register to your SIP server (let it be Asterix or anything else). Then you can make VoIP calls between the clients registered contemporary, send instant messages, exchange files or even implement some custom protocol over SIP to exchange other type of data.
There are a lot of SIP client applications for iPhone, and even a couple of SIP stacks that is a framework that allows you to build your own SIP client application through its API calls, so you will have full control on everything. One of the most mature of these with iPhone support is pjsip. Check out their web site to see whether this is what you are looking for.
it is hard because is necessary modify the dial plan in order to add a sip account. but you can program a web service that read a text file with the extensions from your mobile.
it is nto fully clear from your desription what exactly you want, but probably this one will help
http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out

Resources