Search code examples
androidtwiliotwilio-apitwilio-php

Twilio - how is the switch made?


I am implementing Twilio SDK in the app and I've managed to make web to web calls and also web to phone calls.

I can't seem to manage to figure out how the switch from web to phone should be made.

I initially call the Voice.call() with an identity user_39 but if the user has no internet connection, and does not receive the push notification sent by me, how should the switch from web to phone be made? Is it somehow done automatically by the Twilio SDK or should I listen for the error response to Voice.call() and based on some status decide to remake the call with the actual phone number of the user?

I haven't been able to find a clear documentation regarding this.


Solution

  • Twilio developer evangelist here.

    If the user you are trying to call is not online then the call to them will fail. You will need to listen for this using a Call.Listener and the onConnectFailure event. If you detect that the call failed to the app then you can handle the failure and restart the call to the user's phone number.

    Let me know if that helps at all.