The recommended way is to use CallKit. Your VoIP application will then receive many things โfor free.โ When you enter an incoming call using CallKit, iOS automatically plays the correct ringtone.
https://developer.apple.com/documentation/callkit
There are many things that CallKit handles for you. Things like:
- displaying the correct incoming call screen when the phone is locked
- what happens if the user is already on another call
- Do Not Disturb Enabled (either driving or in sleep mode)
- the phone is disconnected
- plays the right tune
source share