iOS: AVAudioSession turn off bluetooth headset
===

I write this code to record and play feature in an app:
        AVAudioSession *audioSession = [AVAudioSession sharedInstance];

    
	NSError *err = nil;
	
	[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&err];
	if(err){
        NSLog(@"audioSession: %@ %d %@", [err domain], [err code], [[err userInfo] description]);
        return NO;
	}
	
	//	mix category to allow listening to music (on headphone) while recording
	OSStatus propertySetError = 0;
	UInt32 allowMixing = true;
	propertySetError = AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryEnableBluetoothInput,
												sizeof (allowMixing),
												&allowMixing);
	if( propertySetError ) {
		NSLog(@"error mixing audioSession");
		return NO;
	}
    
    UInt32 size = sizeof(CFStringRef);
    CFStringRef route;
    OSStatus result = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &size, &route);
    if (result) {
        NSLog(@"error audio route");
        return NO;
    }

	
	[audioSession setActive:YES error:&err];
	err = nil;
	if(err){
        NSLog(@"audioSession: %@ %d %@", [err domain], [err code], [[err userInfo] description]);
        return NO;
	}
	
	//	check for audio available
	return audioSession.inputIsAvailable;

Everything run fine with record and play feature. But I have a problem when my ipad is playing audio on bluetooth headset. When I start to record, the audio playing will turn off immediately. To turn on audio again, I must end the app in task tray. How can I can record but still listen on audio on bluetooth headset.

Thanks