简体   繁体   English

如何恢复保留的CallKit呼叫

[英]How to resume a CallKit call on hold

I'm using CallKit in my Objective-C app. 我在我的Objective-C应用程序中使用CallKit。

I'm able to make a call using CallKit. 我可以使用CallKit拨打电话。 If a second call comes in, I successfully set it on hold. 如果第二个电话打进来,我成功将其设置为保留。 When I end the second call, the 当我结束第二个通话时,

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

and the

- (void)callObserver:(CXCallObserver *)callObserver callChanged:(CXCall *)call

methods do get called. 方法确实被调用。

But the 但是

 - (void)provider:(CXProvider *)provider performSetHeldCallAction:(CXSetHeldCallAction *)action

method won't get called automatically. 方法不会自动调用。

Do I have to trigger it manually, for example from a method like 我是否必须手动触发它,例如通过类似方法

- (void)performHoldCallActionWithUUID:(NSUUID *)uuid onHold:(BOOL)onHold {
    //...

    CXSetHeldCallAction *holdCallAction = [[CXSetHeldCallAction alloc] initWithCallUUID:uuid onHold:onHold];
    CXTransaction *transaction = [[CXTransaction alloc] initWithAction:holdCallAction];

    [self.callKitCallController requestTransaction:transaction completion:^(NSError *error) {
        //...
    }];
}

or is there a way to make the provider call it "automatically", when the second call is ended by the user? 还是当用户结束第二次呼叫时,有没有办法让提供商“自动”调用它?

Thanks. 谢谢。

The system only notify you that a call is ended (with UUID) and a call status was changed, but it don't change your call status, you need do this manually. 系统仅通知您呼叫已终止(使用UUID)并且呼叫状态已更改,但不会更改呼叫状态,您需要手动执行此操作。

An option is quit from on hold when system notify you through 系统通过通知您时,保留中的选项退出

- (void)callObserver:(CXCallObserver *)callObserver callChanged:(CXCall *)call

For do it, you receive the call that was changed and you can access call's UUID. 为此,您会收到已更改的呼叫,并且可以访问呼叫的UUID。 You can know that call was ended and compare UUID to know if this call is app's call. 您可以知道该呼叫已结束,并比较UUID以了解该呼叫是否是应用程序的呼叫。 If: 如果:

  • app has an active call, 应用程式有通话中,
  • and it is on hold, 它被搁置,
  • and call received as parameter in method isn't your call (UUIDs aren't equals) 并且在方法中作为参数接收的呼叫不是您的呼叫(UUID不等于)
  • and the call received as parameter was ended, 并且作为参数接收的呼叫已结束,

then you can quit from on hold your call with: 那么您可以通过以下方式退出保留的通话:

CXSetHeldCallAction *holdCallAction = [[CXSetHeldCallAction alloc] initWithCallUUID:appCallUUID onHold:NO];
CXTransaction *transaction = [[CXTransaction alloc] initWithAction:holdCallAction];

[self.callKitCallController requestTransaction:transaction completion:^(NSError *error) {
    //...
}];

I would like help you more writing code, but I am writing in a mobile phone and i don't remember how to access call's info. 我想帮助您更多地编写代码,但是我在用手机书写,所以我不记得如何访问通话信息。

I hope that it is help you 希望对您有帮助

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

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