【问题标题】:CallKit - displaying outgoing call into recent call listCallKit - 在最近通话列表中显示拨出电话
【发布时间】:2017-01-05 09:30:11
【问题描述】:

我正在实现一个 VoIP 应用程序,在那里我处理了远程方的来电,例如

- (NSUUID *)reportIncomingCallWithContactIdentifier:(NSString *)identifier name:(NSString *)name telNumber:(NSString *)telnum completion:(ADCallKitManagerCompletion)completion {
    NSUUID *callUUID = [NSUUID UUID];

    CXCallUpdate *callUpdate = [[CXCallUpdate alloc] init];
    //callUpdate.callerIdentifier = identifier;
    callUpdate.localizedCallerName = name;
    callUpdate.supportsHolding = NO;
    callUpdate.supportsUngrouping = NO;
    callUpdate.supportsGrouping = NO;
    callUpdate.remoteHandle = [[CXHandle alloc] initWithType:CXHandleTypePhoneNumber value:telnum];
    [self.provider reportNewIncomingCallWithUUID:callUUID update:callUpdate completion:completion];
    return callUUID;
}

因此,来电显示在最近的电话列表中。但是当我拨出电话时,该号码未显示在最近通话列表(系统的电话应用程序)中。当前实现:

- (NSUUID *)reportOutgoingCallContactIdentifier:(NSString *)identifier destination:(NSString *)name telNumber:(NSString *)telnum completion:(ADCallKitManagerCompletion)completion {
    NSUUID *callUUID = [NSUUID UUID];
    //MARK::change in constructor, defined new handler
    CXHandle *handle = [[CXHandle alloc] initWithType:CXHandleTypePhoneNumber value:telnum];
    CXStartCallAction *action = [[CXStartCallAction alloc] initWithCallUUID:callUUID handle:handle];
    action.contactIdentifier = identifier;
    action.destination = name;

    [self.callController requestTransaction:[CXTransaction transactionWithActions:@[action]] completion:^(NSError * _Nullable error) {
        NSLog(@"error %@",[error description]);
    }];
    return callUUID;
}

我需要知道如何为任何拨出电话更新远程处理程序,以便这将显示在远程电话列表中。

谢谢你:)

【问题讨论】:

  • 您的拨出电话是否真正开始成功,您是如何结束通话的?通话仅在通话结束时添加到系统的“最近通话”列表中,并且应用使用CXEndCallAction-reportCallWithUUID:endedAtDate:reason:
  • 对不起,我的回复晚了,是的,我早先这样做了,但是在建立呼叫时忘记更新提供程序。现在它显示在最近的列表中,但不是按名称显示。对于来电,它工作正常。

标签: objective-c ios10 callkit


【解决方案1】:

对于拨出电话,在执行requestTransaction 后立即使用reportCallWithUUID 更新呼叫就可以了。但我不确定这是否是正确的方法,因为reportCallWithUUID 用于更新正在进行的呼叫中的任何更改。

- (NSUUID *)reportOutgoingCallContactIdentifier:(NSString *)identifier destination:(NSString *)name telNumber:(NSString *)telnum completion:(ADCallKitManagerCompletion)completion {
    NSUUID *callUUID = [NSUUID UUID];
    //MARK::change in constructor, defined new handler
    CXHandle *handle = [[CXHandle alloc] initWithType:CXHandleTypePhoneNumber value:telnum];
    CXStartCallAction *action = [[CXStartCallAction alloc] initWithCallUUID:callUUID handle:handle];
    action.contactIdentifier = identifier;
    action.destination = name;
    [self.callController requestTransaction:[CXTransaction transactionWithActions:@[action]] completion:^(NSError * _Nullable error) {
        NSLog(@"error %@",[error description]);
    }];

    CXCallUpdate *callUpdate = [[CXCallUpdate alloc] init];
    [callUpdate setRemoteHandle:[[CXHandle alloc] initWithType:CXHandleTypePhoneNumber value:telnum]];
    callUpdate.localizedCallerName = @"NAME";
    [_provider reportCallWithUUID:callUUID updated:callUpdate];

    return callUUID;
}

【讨论】:

    【解决方案2】:

    您需要创建一个 CXStartCallAction 并使用此操作请求一个 CXTransaction 才能使您的 reportOutgoingCall 起作用。

    【讨论】:

    • @makboney:然后您是否在您的提供者委托中实现了-provider:performStartCallAction: 以实际开始拨出电话?
    • 是的,我已经实现了,并且拨出电话正在工作。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多