hoxfon / react-native-twilio-programmable-voice

React Native wrapper for Twilio Programmable Voice SDK
MIT License
181 stars 152 forks source link

Distinguish between ringing and answered? #209

Closed stefanhenrico closed 2 years ago

stefanhenrico commented 2 years ago

Hi,

I have a requirement where I need to be able to distinguish between the call ringing and someone answering it.

Right now the callStateRinging event listener fires but then immediately afterwards the connectionDidConnect event listener fires as well but not again when someone picks up. I guess that connected in this case means that Twilio has connected the call, but is there a way to check whether or not the user has answered?

stefanhenrico commented 2 years ago

Found a resolution: tl;dr: set answerOnBridge to true in the Dail verb in your TwiML response.

The caller callback behavior is affected by the answerOnBridge flag provided in the Dial verb of your TwiML application associated with this client. If the answerOnBridge flag is false, which is the default, the [TVOCallDelegate callDidConnect:] callback will be emitted immediately after [TVOCallDelegate callDidStartRinging:]. If the answerOnBridge flag is true this will cause the call to emit the [TVOCallDelegate callDidConnect:] callback only until the call is answered. See Answer on Bridge documentation for more details on how to use it with the Dial TwiML verb.