【问题标题】:Handing over GSM call to VOIP call with CallKit leads to sound loss使用 CallKit 将 GSM 呼叫移交给 VOIP 呼叫会导致声音丢失
【发布时间】:2017-01-17 11:08:10
【问题描述】:

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

当 VoIP 呼叫中断电话呼叫并且用户选择“结束并接听”时,电话会结束,VoIP 呼叫会被接听,但几秒钟后声音会丢失。

当电话被搁置或 VoIP 呼叫中断另一个 VoIP 呼叫(甚至来自另一个 VoIP 应用程序)时,不会发生此行为

要恢复声音,您需要暂停和恢复通话。

有人重现这个问题或有想法吗?

提前致谢!

【问题讨论】:

    标签: ios voip callkit


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多