Search code examples
iosiphonetwiliovoipphone-call

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.


Solution

  • 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.