Twilio - should not reject incoming call when unregister device - twilio

Use case:
Twilio calling used both in web app and in mobile app.
There is incoming call - it is ringing both on mobile and in web app.
Current result:
when close tab in web browser it automatically rejects incoming call - it stops ringing on mobile.
Expected result:
it should be still ringing on mobile after closing tab with calling web app

Twilio developer evangelist here.
When you reject a call to a client identifier, including by reloading the page, then the call is rejected for all versions of that client identifier across all applications.
To work around this, I would recommend using different identifiers for different devices and making simultaneous outbound calls to them, either with multiple <Client> elements if you are using TwiML or by starting multiple calls with the REST API. If you have to use the REST API, you should keep track of the calls so that once one connects you can end the others.

Related

Blocking spam call with CallKit by sending network request

I'm working on iOS app that blocks incoming spam calls. I'm going to use CallKit. When someone is calling, I'd like to send a request to backend API to check whether the phone number is marked as spam in database. I learned that I have to use CXCallDirectoryProvider. But I heard that iOS doesn't allow sending network requests from CXCallDirectoryProvider implementation. Is it true? Should I have a local database with spam phone numbers in my app?
I didn't test it on device yet, just trying to figure out the most appropriate architecture. Services like TrueCNAM do not allow to pull the whole database. They only provide an API that allows to check one phone number per request.

List of available/registered twilio voice clients

I'm looking through documention but didn't find anything that can help me find registered clients to twilio voice incoming calls.
For example. I have 10 registered clients to javascript sdk, that can handle incoming calls by their identities. But on my backend I need to find out who is registered and who is not busy making another call.
Is there any endpoint or someting that can return list of users(identites, clients, devices) with their status?
Because with TwiML I can redirect incoming call up to 10 clients. But when I don't know who is ready to answer and not busy I can't redirect responsible.
Thanks for any leads.
Twilio developer evangelist here.
I'm afraid that there isn't a way to list your currently registered clients. But you have a couple of options with how to deal with this.
You could keep a list of your registered clients manually. Adding a client to the list as they log in and removing them when they disconnect.
Alternatively, you could consider using TaskRouter to keep track of this and control the passing out of incoming call tasks to available agents. Then the agents would log on and enter an idle status in TaskRouter, when they accept a call they would be busy, once the call is over they go through a wrapping up stage before you return them to idle and ready for another call.
I resolved it with another way. When the user connects a device to twilio, I put him in the presence group with WS. When the device starts calling, I put him in another presence group. On the backend, when recieving calls, I just check who is in the ready group and not in the calling one and connect him with this incoming call.

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.

Is twillo Client Api allow user to Call from Application to Application instead of native call in iOS?

I recently integrated twillo iOS SDK in my iPhone app and it is working fine for native call it means i can make call from app to any verified phone numbers.
But my requirement is app to app call it means there is no native call.
So i would like to know if by using Twillio SDK, is it possible to call from application to application ? Something similar to whatsApp. So there will not be any phone number but both phones must have our apps with Twillio SDK integrated.
Please Help me.
Thanks.
Twilio developer evangelist here.
You absolutely can do app to app calls using the iOS SDK. Let me explain.
Your Twilio Client capability token is created with a TwiML Application, which supplies the URL that Twilio will hit when a call is created to find out what to do with it. Normally, you would pass a phone number as a parameter to your TCDevice's connect which would be handed to your app URL when the call connects. This would then be used to produce TwiML to direct the call onto that number, like this:
<Response>
<Dial>
<Number>{{ to_number }}</Number>
</Dial>
</Response>
To make this work for client to client calls, you can pass another client ID to the URL and on your server, instead of <Dial>ing to a <Number> you would <Dial> to a <Client>. Like so:
<Response>
<Dial>
<Client>{{ client_id }}</Client>
</Dial>
</Response>
You can discover which clients are available by listening for presence events with your TCDevice object. You will also have to handle incoming calls within applications.
I recommend following the Twilio Client iOS Quickstart guide all the way through, which will guide you through most of these points, including passing parameters to your application URL and generating the right TwiML to accomplish this (though it doesn't cover presence events).
Let me know if this helps at all.
Not sure it is possible with Twilio. We have used twilio for the same purpose u mentioned (Call to phone numbers) and was working fine. I think the main purpose of twilio is that. Anyways i'm not sure about it.
May be VoIP will suit for your functionality. PortSIP is a good SDK for voice and video communications between apps.
You can download the iOS SDK from here https://www.portsip.com/downloads-center/
It is payable like Twilio only if you want to use it for business.
For more refer here
Thanks.
Twilio support sip now. you must have some setting with your twilio account.
As I know ,you can follow here to set your twilio sip server and implement sip client on your ios client.

VoIP - GSM calling via iOS

I've spent days now searching for a way to route calls from an iOS application through a voip server to mobile number or fixed landline number (or send an SMS)... Essentially like voIP-GSM
I want to essentially have a similar system set up to Skype but with out the other user having the app, just directly call someone's phone using your data/wifi rather than your limited voice minutes or numbers if SMS.
One company who I know of that has worked out how to do this is: http://callsfreecalls.com/
I don't just want app-app communication like from twilio or rebtel!!
1) Would Asterisk or PJSIP help me in any way?
2) Would there be anyway I could do this all for free?
3) Will I have to create my own VoIP network or SIP server??
4) Will I be able to accomplish all this and put it into an iOS app?
Any ideas or help would be much appreciated. Thank you
Twilio evangelist here.
With Twilio Client you can make a VoIP connection from a mobile app into Twilio, then route that to any other number (mobile or landline). You are not restricted to app-to-app only calls.
When you create a Capability Token for Twilio Client, one of the parameters you can pass it is a TwiML Application SID. That TwiML Application maps to a URL that you can use to return TwiML instructions that Twilio will execute when a user initiates an outbound call from your iOS app. In those instructions, you can use the <Dial> verb to tell Twilio to dial a regular phone number, which we will bridge to the Twilio Client connection.
Hope that helps.

Resources