繁体   English   中英

使用CallKit将GSM呼叫切换到VOIP呼叫会导致声音损失

[英]Handing over GSM call to VOIP call with CallKit leads to sound loss

我已经在VoIP应用程序中实现了CallKit,除了一种情况之外,其他一切都很好:

当VoIP呼叫中断电话呼叫且用户选择“结束并应答”时,电话呼叫结束,将应答VoIP呼叫,但几秒钟后声音消失。

当电话处于保持状态或VoIP通话中断另一个VoIP通话(甚至来自另一个VoIP应用程序)时,不会发生此行为

要恢复声音,您需要暂停并继续通话。

任何人都重现此问题或有想法吗?

提前致谢 !

当您接听电话时。检查惠特尔是否已激活音频会话,之后需要激活呼叫媒体状态。

- (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__);
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM