When you are answer call.. Check wheather is audio session activated or not, after that you need to activate your call media state.
- (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAction *)action {
NSLog(@"Provider perform Answer Call Action");
// Retrieve the instance corresponding to the action's call UUID
SIPCall *call = [_callManager callWithUUID:action.callUUID];
if (!call) {
[action fail];
return;
}
/*
Configure the audio session, but do not start call audio here, since it must be done once
the audio session has been activated by the system after having its priority elevated.
*/
[[AudioManager sharedManager] configureAudioSession];
// Trigger the call to be answered via the underlying network service.
[call answer];
// Signal to the system that the action has been successfully performed.
[action fulfill];
}
Also check end call method.
- (void)provider:(CXProvider *)provider performEndCallAction:(CXEndCallAction *)action {
NSLog(@"Provider perform End Call Action");
// Retrieve the Voifinity PBX instance corresponding to the action's call UUID
SIPCall *call = [_callManager callWithUUID:action.callUUID];
if (!call) {
[action fail];
return;
}
// Stop call audio whenever ending the call.
//[[AudioManager sharedManager] disableSoundDevices];
// Trigger the call to be ended via the underlying network service.
[call hangUp];
// Signal to the system that the action has been successfully performed.
[action fulfill];
// Remove the ended call from the app's list of calls.
[_callManager removeCall:call];
}
And also add to check audio session activate or deactivate or not.
You call audio should be activated only and only after audio session activation.
Add below delegate to track of audio sessions.
//Activate session
- (void)provider:(CXProvider *)provider didActivateAudioSession:(AVAudioSession *)audioSession {
NSLog(@"Received: %s",__FUNCTION__);
}
//Deactivate session
- (void)provider:(CXProvider *)provider didDeactivateAudioSession:(AVAudioSession *)audioSession {
NSLog(@"Received: %s",__FUNCTION__);
}