twilio / twilio-voice-ios

Programmable Voice SDK by Twilio
https://www.twilio.com/voice
38 stars 14 forks source link

answerOnBridge=true for outgoing calls result in no ringtone for caller #85

Closed abhinavsingh closed 3 years ago

abhinavsingh commented 3 years ago

Description

We have reached out earlier to Twilio support but we haven't heard back. Apologies for cross posting here but we really want to resolve this. Customers are't comfortable with default answerOnBridge=false for outgoing calls.

When answerOnBridge=false for outgoing, caller immediately sees "connected" When answerOnBridge=true for outgoing, caller seems "ringing" (as expected) but no ringing tone

Because of no ringing tone when answerOnBridge=true, we are forced to use answerOnBridge=false, but then that behavior (immediate "connected" even while "ringing") is not natural for us humans.

Question

  1. No ringing tone when answerOnBridge=true, is it a bug or expected behavior?
  2. If expected, are apps supposed to play the ringing tone unless call connects?
  3. We didn't find anything similar in Twilio iOS examples, so we are unsure if any special handling is required when answerOnBridge=true is used
  4. If it's a bug, how do we get it resolved.

Thank you

bobiechen-twilio commented 3 years ago

@abhinavsingh Thanks for reaching out and this is a very good question:

By default the answerOnBridge flag is disabled and as you already observed the caller will receive a connected event once the parent call leg (from client to Twilio) is connected. When the flag is turned on, the Voice backend will only signal the caller that the call has been connected when the callee has accepted the call. The media connection is also established at this time so the audio packet can flow.

The bottom line is that no, this is not a bug. If the behavior with the flag enabled is the desired behavior, the app can use the iOS AVAudioPlayer to play the ringback tone while the call is ringing on the caller's end. Here is the example code from our quickstart: https://github.com/twilio/voice-quickstart-ios/blob/master/SwiftVoiceQuickstart/ViewController.swift#L405

Cheers, -bobie

abhinavsingh commented 3 years ago

@bobiechen-twilio Thank you for clarification and pointing this out. Feels embarrassing that we missed it in the sample code. Thank you!!!

bobiechen-twilio commented 3 years ago

Glad that I (or the sample code) can help. Feel free reach out again if you need further assistance.

abhinavsingh commented 3 years ago

We did the integration and then realized there is an edge case :). As in, if user wants to go to speaker immediately, ringtone routing must be done separately. Overall, we feel answerOnBridge is a Twilio provided switch and SDK must know how to work with this flag. Without putting the onus on the SDK users. I see, the workflow remains the same and should not change for SDK users, hence this handling itself can be baked within the SDK itself (provide ringtone file as a configurable option or use a default). Thank you!!!