1

我正在实现一个 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;
}

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

谢谢 :)

4

2 回答 2

4

对于拨出呼叫,reportCallWithUUID执行后立即使用更新呼叫requestTransaction就可以了。但我不确定这是否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;
}
于 2017-01-10T10:46:50.790 回答
0

您需要创建一个 CXStartCallAction 并使用此操作请求一个 CXTransaction 以使您的 reportOutgoingCall 正常工作。

于 2017-01-05T10:46:52.380 回答