Reputation: 89
I am facing issue with multiple calls when start using CallKit in my VOIP application.
When there is one to one VOIP call, sound is working fine. But once one party gets another VOIP call, and choose to Hold and Accept option; First call is put on hold successfully and second call is answered; But sound gets closed now. Even swapping between calls also does not work. and Dropping one call also does not work. I am using RTP for voice.
I tried to put breakpoints and check if the AVAudioSession's category and mode are correct.
In the console I can check at my end that the device which has more than one calls, stop sending sound packets.
I am enabling VOIP just before reportNewIncomingCallWithUUID and CXStartCallAction of Provider.
Same case with GSM call. If there is one to one VOIP call with sound is ok and GSM call is received at one side and user choose to Hold and Accept option, sound in GSM call is working fine. But if user makes VOIP call as active and put GSM call on hold by swapping calls, there is no sound in VOIP call. Swapping calls and making GSM call active, sound again works fine. But no sound for VOIP call.
In this case, we are getting AVAudioSessionInterruptionTypeBegan but AVAudioSessionInterruptionTypeEnded is never called. Even after the GSM call is ended.
Has anyone run into similar issues?
Upvotes: 2
Views: 1512
Reputation: 1454
Had the same issue. If I have 1 active call, then new calls is incoming, I tap hold&accept. New call works, but after using Swap in CallKit audio stopped working.
After long debug found the spot where actually audio is deactivating/activating for Swap calls via CallKit native interface - that is provider:performSetHeldCallAction:
method from CXProviderDelegate
protocol.
In my case I used the [audioController deactivateAudioSession]
method for the call was putting in OnHold.
But I found that the same method provider:performSetHeldCallAction:
was fired for other call that is being put active (from OnHold state), when tap Swap
button via CallKit.
So in my case I first toggle hold for call (it put call either on hold or put it active out of hold). Then I check what is call condition (whether hold or not) and then deactivate or activate audio respectively.
In common way it looks this way:
- (void)provider:(CXProvider *)provider performSetHeldCallAction:(CXSetHeldCallAction *)action {
SomeCallClass *call = [self.callManager callWithUUID:action.callUUID];
if (!call) {
[action fail];
return;
}
NSError *holdError;
[call toggleHold:&holdError];
if (holdError) {
[action fail];
} else {
if (call.onHold)
[self.audioController deactivateAudioSession];
else
[self.audioController activateAudioSession];
[action fulfill];
}
}
This code should be in the class that works as a CallKit provider delegate.
Upvotes: 1