简体   繁体   English

进入蜂窝电话时保持呼叫套件呼叫

[英]Hold callkit call when incoming cellular call

I have a problem (but not really) with callkit. 我有一个问题(但不是真的)与callkit。

I implemented callkit in my app and it works great. 我在我的应用程序中实现了callkit,它运行良好。 I can get a second call to my app and callkit offeres me options to End&Accept, Decline or Hold&Accept. 我可以第二次打电话给我的应用程序和callkit,向我提供结束和接受,拒绝或保留和接受的选项。 Same goes if I am in a cellular (gsm) call and I get a call on my app. 如果我正在进行蜂窝电话(gsm)呼叫并且我在我的应用上接听电话,那也是如此。 But when I am in app call (on callkit) and get a cellular(gsm) call I only get 2 options: Decline or End&Accept. 但是当我在应用程序调用(在callkit上)并获得蜂窝(gsm)调用时,我只获得2个选项:拒绝或结束并接受。

Any idea why? 知道为什么吗? Or how I can get all 3 options? 或者我如何获得所有3个选项?

static var providerConfiguration: CXProviderConfiguration {

    var providerConfiguration: CXProviderConfiguration
    providerConfiguration = CXProviderConfiguration(localizedName: "app name")

    providerConfiguration.supportsVideo = false
    providerConfiguration.maximumCallsPerCallGroup = 1
    providerConfiguration.maximumCallGroups = 3
    providerConfiguration.supportedHandleTypes = [.phoneNumber]
    return providerConfiguration
}

I have implemented: 我已实施:

providerDidReset, 
CXStartCallAction, 
CXAnswerCallAction, 
CXEndCallAction, 
CXSetHeldCallAction, 
CXSetMutedCallAction, 
timedOutPerforming action, 
didActivate audioSession, 
didDeactivate audioSession.

In my app delegate I have function that checks useractivity. 在我的app委托中,我有检查useractivity的功能。 I put breakpoints in all of the functions but nothing gets called before the view for incoming cellular (gsm) call is shown. 我在所有函数中都放置了断点,但在显示传入蜂窝(gsm)调用的视图之前没有调用任何内容。

I googled but couldn't find the solution. 我用Google搜索但无法找到解决方案。 As far as I can see, callkit is working perfectly. 据我所知,callkit工作正常。

I struggled with this for outgoing calls. 对于传出电话我一直在努力。 For outgoing calls, make sure you call this method for the call once it is answered by the remote side: 对于拨出电话,请确保在远程方应答后呼叫此方法:

[self.provider reportOutgoingCallWithUUID:currentCall.uuid connectedAtDate:[NSDate date]];

If you do not, the call is stuck "connecting" from CallKit's perspective and I have found that the native incoming call UI for other calls will not provide the "send to voicemail" and "hold and accept" options for incoming calls while another call is "connecting". 如果你不这样做,那么呼叫就会从CallKit的角度“连接”,我发现其他呼叫的本地呼入UI不会为另一个呼叫提供“发送到语音邮件”和“保持和接受”选项。是“连接”。

I struggled with this for a bit today until I figured that part out. 今天我一直在努力解决这个问题,直到我发现这一部分。 I also am calling: 我也在打电话:

 [self.provider reportOutgoingCallWithUUID:currentCall.uuid startedConnectingAtDate:[NSDate date]];

from within: 从内部:

- (void)provider:(CXProvider *)provider performStartCallAction:(CXStartCallAction *)action

Not sure if that part is necessary but I'm doing it because that's what the Speakerbox demo does. 不确定这部分是否必要,但我这样做是因为这就是Speakerbox演示的功能。 Kind of, they do it in a callback... I just do it immediately. 有点,他们在回调中做到了......我只是马上做。

While you were sending CXCallUpdate object to CallKit before calling, make sure you kept supportsHolding value as true . 在调用之前将CXCallUpdate对象发送到CallKit时,请确保将supportsHolding值保持为true

My CXCallUpdate looks something like below: 我的CXCallUpdate如下所示:

let callHandle = CXHandle(type: .phoneNumber, value: handle)
let callUpdate = CXCallUpdate()
if userName != nil{
       callUpdate.localizedCallerName = userName;
}
callUpdate.remoteHandle = callHandle
callUpdate.supportsDTMF = true
callUpdate.supportsHolding = true
callUpdate.supportsGrouping = false
callUpdate.supportsUngrouping = false
callUpdate.hasVideo = false  

Meaning of above different properties: 以上不同属性的含义:

localizedCallerName = If you want to show name of user on system's call screen, otherwise phone number/email based on type of handle will be shown localizedCallerName =如果要在系统的呼叫屏幕上显示用户名,否则将显示基于句柄类型的电话号码/电子邮件

supportsDTMF = On system's main screen, if you want to allow keypad numbers to be typed while call is running, if you make it false , keypad option get disabled. supportsDTMF =在系统的主屏幕上,如果要在呼叫正在运行时键入小键盘数字,如果将其设置为false ,则键盘选项将被禁用。

supportsHolding = If you want your call to be held, when some other call get triggered, keep this property true supportsHolding =如果您希望保持呼叫,当某个其他呼叫被触发时,请保持此属性为true

supportsGrouping = If you want to allow conference calling(Merge call option enabled in calling screen), then keep this one true supportsGrouping =如果要允许电话会议(在呼叫屏幕中启用合并呼叫选项),请保持此状态为true

supportsUngrouping = Inverse of last one, After call getting merged(conference call), should allow it to ungroup or not. supportsUngrouping =最后一个的反转,在呼叫合并(电话会议)之后,应该允许它取消组合。

hasVideo = If you support video call, the system will automatically start camera for you. hasVideo =如果您支持视频通话,系统会自动为您启动相机。

@Redssie, let me know if any further help related to Callkit required. @Redssie,如果需要任何与Callkit相关的进一步帮助,请告诉我。

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

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