【问题标题】:Linphone fails to create SAS for ZRTP Secure callLinphone 无法为 ZRTP 安全呼叫创建 SAS
【发布时间】:2016-09-19 15:37:58
【问题描述】:

我最近更新了最新版本的 Linphone 库,以遵循 Apple 的 IPV6 标准支持。 但它无法创建安全呼叫。 每次我尝试将呼叫转换为安全呼叫时,确认失败并且 SAS 返回 null。 与旧库(IPV4 支持)一起工作也是如此。 我正在使用 ZRTP 加密进行安全通话。

自过去 15 天以来,我一直在苦苦挣扎。 下面的代码行返回 SAS 值 null。

NSString *localLize = NSLocalizedString(@"Confirm the following SAS with peer:\n%s", nil);
            const char *authToken = linphone_call_get_authentication_token(call);
            NSLog(@"localize %@ authToken %s",localLize,authToken);

以下是将呼叫转换为安全呼叫的完整功能。

- (IBAction)onSecurityClick:(id)sender {
if (linphone_core_get_calls_nb(LC)) {
    LinphoneCall *call = linphone_core_get_current_call(LC);
    if (call != NULL) {

        //force encryption ZRTP
        LinphoneMediaEncryption enc = LinphoneMediaEncryptionZRTP;

        if (enc == LinphoneMediaEncryptionZRTP) {

            NSString *localLize = NSLocalizedString(@"Confirm the following SAS with peer:\n%s", nil);
            const char *authToken = linphone_call_get_authentication_token(call);
            NSLog(@"localize %@ authToken %s",localLize,authToken);


            NSString *message =
                [NSString stringWithFormat:NSLocalizedString(@"Confirm the following SAS with peer:\n%s", nil),
                                           linphone_call_get_authentication_token(call)];
            if (securityDialog == nil) {
                __block __strong StatusBarView *weakSelf = self;
                securityDialog = [UIConfirmationDialog ShowWithMessage:message
                    cancelMessage:NSLocalizedString(@"DENY", nil)
                    confirmMessage:NSLocalizedString(@"ACCEPT", nil)
                    onCancelClick:^() {
                      if (linphone_core_get_current_call(LC) == call) {
                          linphone_call_set_authentication_token_verified(call, NO);
                      }
                      weakSelf->securityDialog = nil;
                    }
                    onConfirmationClick:^() {
                      if (linphone_core_get_current_call(LC) == call) {
                          linphone_call_set_authentication_token_verified(call, YES);
                      }
                      weakSelf->securityDialog = nil;
                    }];
            }
        }
    }
   }
}

任何帮助都应该是可观的。

提前致谢。

【问题讨论】:

  • 嘿!你找出问题所在了吗?我也遇到了同样的问题。

标签: security encryption voip linphone linphone-sdk


【解决方案1】:

所以我弄清楚了我的问题所在。也许对你也有用。

我在呼叫状态更改为LinphoneCallOutgoingProgress 后立即呼叫linphone_call_get_authentication_token。我所要做的就是启动一个Timer,它在调用状态更改为LinphoneCallOutgoingProgress 时每1 秒调用一次方法,因为它似乎需要一些时间来生成SAS。这对我有用:

timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) {

    DispatchQueue.main.async {

        let sas = linphone_call_get_authentication_token(Call.current())

        if sas != nil {

            self!.sasLabel.text = String(cString: sas!)
            timer.invalidate()
        }
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-09-10
    • 1970-01-01
    • 2015-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多