AudioKit 4.9.3
iOS 11+

I am working on a project where the user is recording on the device using the microphone and it continues to record, even if the app is in the background. This works fine but when receiving a phone call I get an AudioKit error. I assume it has something to do with the phone taking over the mic or something. here is the error:

> 
> [avae] AVAEInternal.h:109  
> 
>  [AVAudioEngineGraph.mm:1544:Start: (err = PerformCommand(\*ioNode,
>  kAUStartIO, NULL, 0)): error 561017449
>  AudioKit+StartStop.swift:restartEngineAfterRouteChange(\_:):198:error
>  restarting engine after route change
> 
> 
> 

basically everything that i have recording up until that point is lost. 

here is my set up AudioKit code:

```
func configureAudioKit() {
        AKSettings.audioInputEnabled = true
        AKSettings.defaultToSpeaker = true
        do {
            try try audioSession.setCategory((AVAudioSession.Category.playAndRecord), options: AVAudioSession.CategoryOptions.mixWithOthers)
            try audioSession.setActive(true)
            audioSession.requestRecordPermission({ allowed in
                DispatchQueue.main.async {
                    if allowed {
                        print("Audio recording session allowed")
                        self.configureAudioKitSession()
                    } else {
                        print("Audio recoding session not allowed")
                    }
                }
            })
        } catch let error{
            print("Audio recoding session not allowed: \(error.localizedDescription)")
        }
    }

func configureAudioKitSession() {
        isMicPresent = AVAudioSession.sharedInstance().isInputAvailable
        if !isMicPresent {
            return
        }
        print("mic present and configuring audio session")
        mic = AKMicrophone()
        do{
        let _ = try AKNodeRecorder(node: mic)
        let recorderGain = AKBooster(mic, gain: 0)
        AudioKit.output = recorderGain
        //try AudioKit.start()
        }
        catch let error{
            print("configure audioKit error: ", error)
        }
}

```

and when tapping on the record button code:

```
    do {
         audioRecorder = try AVAudioRecorder(url: actualRecordingPath, settings: audioSettings)
         audioRecorder?.record()
         //print("Recording: \(isRecording)")
         do{
           try AudioKit.start()
          }
          catch let error{
            print("Cannot start AudioKit", error.localizedDescription)
          }
}

```

Current audio Settings:

```
private let audioSettings = [
        AVFormatIDKey : Int(kAudioFormatMPEG4AAC),
        AVSampleRateKey : 44100,
        AVNumberOfChannelsKey : 2,
        AVEncoderAudioQualityKey : AVAudioQuality.medium.rawValue
    ]

```

What can I do to ensure that I can get a proper recording, even when receiving a phone call? The error happens as soon as you receive the call - whether you choose to answer it or decline. 

Any thoughts?