Simply calling toggleAudioRoute(toSpeaker: true doesn't do anything during ringing with a custom ringtone. In fact, you get this error:
AVAudioSession setAggregatedIOPreference:error: Error Domain=NSOSStatusErrorDomain Code=560030580 "Operation not permitted while session has running audio I/Os" UserInfo={NSLocalizedDescription=Operation not permitted while session has running audio I/Os}
What is the correct way to allow the user to activate the speaker while the call is still ringing using a custom ringtone?
I saw a similar comment about this here but no solution https://github.com/twilio/twilio-voice-ios/issues/85#issuecomment-950894282.
Simply calling
toggleAudioRoute(toSpeaker: true
doesn't do anything during ringing with a custom ringtone. In fact, you get this error:AVAudioSession setAggregatedIOPreference:error: Error Domain=NSOSStatusErrorDomain Code=560030580 "Operation not permitted while session has running audio I/Os" UserInfo={NSLocalizedDescription=Operation not permitted while session has running audio I/Os}
What is the correct way to allow the user to activate the speaker while the call is still ringing using a custom ringtone?