Когда вы отвечаете на звонок .. Проверьте, активирован ли сеанс аудио сессии или нет, после этого вам необходимо активировать состояние мультимедийных сообщений.
- (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];
}
Также проверьте метод завершения вызова.
- (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];
}
А также добавить, чтобы проверить аудио сессии включить или выключить или нет. Вы вызываете звук, который должен быть активирован только и только после активации аудио сессии. Добавьте ниже делегата для отслеживания аудиозаписей.
// Активация сеанса
- (void)provider:(CXProvider *)provider didActivateAudioSession:(AVAudioSession *)audioSession {
NSLog(@"Received: %s",__FUNCTION__);
}
// Деактивировать сеанс
- (void)provider:(CXProvider *)provider didDeactivateAudioSession:(AVAudioSession *)audioSession {
NSLog(@"Received: %s",__FUNCTION__);
}