0

我正在使用 Linphone SDK 构建一个安全的 VoIP iOS 应用程序。

我在应用程序启动时设置了媒体加密:

linphone_core_set_media_encryption(theLinphone.lc, LinphoneMediaEncryptionZRTP)

我正在尝试像这样检索 SAS:

linphone_call_get_authentication_token(Call.current())

大多数时候它返回零。但有时它会返回一个十六进制值,例如0x35422f6e6f697461

我什至得到了这个日志: ortp-message-ZRTP secrets on: SAS is xxxx previously verified no成为“xxxx”正确的 SAS。

4

1 回答 1

0

所以我弄清楚发生了什么。

linphone_call_get_authentication_token(Call.current())通话状态更改为 后,我立即拨打电话LinphoneCallOutgoingProgress。我所要做的就是修复它,Timer当调用状态更改为时,每 1 秒启动一个方法,LinphoneCallOutgoingProgress因为它似乎需要一段时间才能生成 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()
        }
    }
}
于 2017-05-09T23:12:43.457 回答