简体   繁体   English

CallKit处理iOS中的多个呼叫(VOIP和GSM)问题

[英]CallKit Handling multiple calls(VOIP and GSM) issue in iOS

I have integrated CallKit in my VOIP app. 我已经在我的VOIP应用程序中集成了CallKit I have made a VOIP call and the other end answered my call. 我打了一个VOIP电话,另一端接了我的电话。 Later I have received GSM call when the VOIP call is active. 稍后,当VOIP通话处于活动状态时,我已收到GSM通话。 I have accepted GSM call by releasing audio and my VOIP app went to the background. 我已经通过释放音频来接受GSM通话,而我的VOIP应用程序已进入后台。 After few seconds I have disconnected the GSM call but then I am getting delegate callback to below method: 几秒钟后,我断开了GSM通话,但是随后我得到了以下方法的委托回调:

- (void)provider:(CXProvider *)provider performEndCallAction:(CXEndCallAction *)action

In this method, I am actually disconnecting all my incoming/outgoing calls, so at the same time, both GSM and my VOIP calls got disconnected. 用这种方法,我实际上断开了所有传入/传出的呼叫,因此,同时GSM和VOIP呼叫都断开了。

I am not sure why above delegate method getting called when I disconnect the GSM call if I am right... this method should be called only when I disconnect the VOIP call. 我不确定在正确的情况下断开GSM呼叫时为什么会调用上述委托方法...仅在断开VOIP呼叫时才应调用此方法。

My roadmap is: After disconnecting GSM call I will start my audio service and will resume the VOIP call. 我的路线图是:断开GSM通话后,我将启动音频服务并恢复VOIP通话。 But I am not able to proceed further since my VOIP call also getting disconnected. 但是我无法继续进行,因为我的VOIP通话也断开了。

The correct way (according to the sample code provided by Apple) to integrate with CallKit is that, all the actions you make should be done by using CXCallController to call requestTransaction:completion: method, and wait for CXProviderDelegate to trigger corresponding delegate method, and do the actual work there. 正确的方法(根据Apple提供的示例代码)是与CallKit集成的,应该执行所有操作,方法是使用CXCallController调用requestTransaction:completion:方法,并等待CXProviderDelegate触发相应的委托方法,并且在那儿做实际的工作。

For example, if you want to hold the call, what you need to do is 例如,如果您要保留通话,您需要做的是

CXSetHeldCallAction *setHeldCallAction = [[CXSetHeldCallAction alloc] initWithCallUUID:UUID onHold:onHold];
CXTransaction *transaction = [[CXTransaction alloc] initWithAction:setHeldCallAction];
[self.callController requestTransaction:transaction completion:^(NSError * _Nullable error) {
    if (error) {
        NSLog(@"%@", error);
    }
}];

Then the CXProviderDelegate will trigger provider:performSetHeldCallAction: , and you perform your handling inside that. 然后,CXProviderDelegate将触发provider:performSetHeldCallAction: :,然后您在其中执行处理。

I am not sure why above delegate method getting called when I disconnect the GSM call if I am right... this method should be called only when I disconnect the VOIP call 我不确定为什么在我断开GSM呼叫时会调用上面的委托方法...仅当我断开VOIP呼叫时才应调用此方法

There's no mention in the documentation that this method will be called only for calls made by your app. 在文档中没有提到仅在您的应用程序进行调用时才调用此方法。 I assume this is right behavior and you need to get the call UUID to identify the call as one of yours else ignore. 我认为这是正确的行为,您需要获取呼叫UUID才能将呼叫标识为其他呼叫之一。

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

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