带有两个来电的 CallKit [英] CallKit with two incoming calls

查看:100
本文介绍了带有两个来电的 CallKit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 CallKit 开发了一个 VoIP 应用.

I develop a VoIP app with CallKit.

如果用户收到两个来电并且他/她接听其中一个,另一个将关闭.

In the case that the user receives two incoming calls and he/she accepts one of them the other one will be closed.

例如报告两个来电:

reportInComingCall uuid: 70D506FB-6A9D-4111-8828-35DB8F330A26  
reportInComingCall uuid: 129A6D67-AC6A-480E-BCD7-ED14F7961CE5  

当用户接受其中之一时,我会从 CallKit 中获得此操作:

When the user accepts one of them I get this actions from CallKit:

perform action: CXEndCallAction uuid: 129A6D67-AC6A-480E-BCD7-ED14F7961CE5  
perform action: CXAnswerCallAction uuid: 70D506FB-6A9D-4111-8828-35DB8F330A26 

问:是否可以接听一个电话而不关闭另一个?

Q: Is it possible to accept one call without closing the other one?

最后我需要以下场景:当我接听一个电话时,另一个电话保持等待,直到我挂断第一个电话.CallKit 向我展示了另一个我可以接受的.

At the end I need the following scenario: When I accept one call the other one stays on hold until I hung up the first call. CallKit shows me then the other one that I can accept it.

拉尔夫

推荐答案

你需要设置为CXProviderConfiguration 应用允许呼叫分组和多个呼叫,如

You need to set to CXProviderConfiguration that the app allows call grouping and multiple calls, like

let configuration = CXProviderConfiguration(localizedName: applicationName)
configuration.supportsVideo = supportsVideo
configuration.supportedHandleTypes = [.phoneNumber]
configuration.maximumCallGroups = 3
configuration.maximumCallsPerCallGroup = 2 /// 2 calls max per call group. Excluding host call

另外,您需要在收到来电时设置CXCallUpdate来告诉CXProvider来电可以保持/取消保持和分组

Also, you need to set CXCallUpdate when receiving the incoming call to tell CXProvider that the incoming call can be held/un-held and grouped

let callUpdate = CXCallUpdate()
callUpdate.supportsGrouping = true
callUpdate.supportsUngrouping = true
callUpdate.supportsHolding = true

每次您要向 CXProvider

这篇关于带有两个来电的 CallKit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆