I start a voip call from user A to user B using call kit, sound is routed correctly. I receive other voip call on user A (user C calls A). The user A choose "Hold & Answer" option, so the B user call will set on Hold while the C user call will be routed correctly. At some point of time the C user ends the call so I will end up having the B user call ongoing which is on hold at this time. When the C user call is ended also the "didDeactivateAudioSession" is called. When I unhold the voip call I made the next actions:
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord mode:AVAudioSessionModeVoiceChat options:AVAudioSessionCategoryOptionMixWithOthers error:nil];
// unhold call
pjsua_call_reinvite([self identifier], PJSUA_CALL_UNHOLD, NULL);
Reinvite is working and properly unhold, but the AVAudiosession is not activate, and of course the sound is not workign any more in the call between A and B.
Also when I receive on user A the C user call disconnect, Imake the next action in order to end the C user call:
CXEndCallAction *endAction = [[CXEndCallAction alloc] initWithCallUUID:callUUID];
CXTransaction *transaction = [[CXTransaction alloc] initWithAction:endAction];
// perform transaction
[self.callController requestTransaction:transaction completion:^(NSError * _Nullable error) {
if (error != nil) {
NSLog(TALoggerLevelCritical, @"\n\n ***** ERROR: Faield to end call transaction ****** \n\n");
}
}];
I had notice that when I call the request transaction also the didDeactivateAudioSession is called, even If I had other call active.
After some investigation I've realize that I had to unhold call in pjsip and call kit too. I had only unhold the call in the pjsip, but this isn't necessary because call kit controll the AVAudioSession and disable sound while call is on hold.
CXSetHeldCallAction *unholdAction = [[CXSetHeldCallAction alloc] initWithCallUUID:callUUID onHold:NO];
CXTransaction *transaction = [[CXTransaction alloc] initWithAction:unholdAction];
// perform transaction
[self.callController requestTransaction:transaction completion:^(NSError * _Nullable error) {
// finished unhold call
}];