2 Replies
      Latest reply on Aug 5, 2019 8:24 AM by folcher
      toziact Level 1 Level 1 (0 points)

        I'm using AVAudioSession in my VOIP app (using also CallKit).
        I understand that the session can get interrupted by a number of things, for example by a second incoming call.
        Apple states towards the bottom of this page

        "Note: There is no guarantee that a begin interruption will have a corresponding end interruption. Your app needs to be aware of a switch to a foreground running state or the user pressing a Play button. In either case, determine whether your app should reactivate its audio session."


        On the mentioned page there is an example, when the user ignores the incoming call and in that case AVAudioSessionInterruptionTypeEnded is being sent.
        But what should I do in every other case, when I don't get an AVAudioSessionInterruptionTypeEnded? (E.g. When the user answers the 2nd call and puts me on hold and later he ends the 2nd call?)



        • Re: AVAudioSession resume
          ptank Level 1 Level 1 (0 points)



          We are also running into the similar problem -



          1. User is on CallKit VoIP call using our app.

          2. User receives incoming GSM call.

          3. CallKit UI is being displayed and user answers the GSM call. The app receives `AVAudioSessionInterruptionTypeBegan`, and the voip call goes on hold.

          4. Now user swaps between calls and goes to VoIP call. At this point, our app is not able to play or record audio because it has received `AVAudioSessionInterruptionTypeBegan` on step#3 but it has not received `AVAudioSessionInterruptionTypeEnded` yet. I noticed if I bring the app to the foreground, the app receives `AVAudioSessionInterruptionTypeEnded` but not before that.

          Is there a recommendation on how should we handle this scenario.


          Thank you,