2016-09-19 33 views
0

我最近更新了我的Linphone庫,從最新版本開始遵循Apple的IPV6標準支持。 但它無法創建安全呼叫。 每次我嘗試將呼叫轉換爲安全呼叫時,確認失敗並且SAS返回空值。 與舊圖書館(IPV4支持)一起工作。 我正在使用ZRTP加密進行安全呼叫。Linphone無法爲ZRTP創建SAS安全呼叫

我在過去15天以來一直在掙扎。 下面一行代碼返回SAS值爲空。

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; 
        }]; 
      } 
     } 
    } 
    } 
} 

任何幫助應該是明顯的。

在此先感謝。

+0

嘿!你有沒有發現問題是什麼?我有同樣的問題。 –

回答

0

所以我想出了什麼是我的問題。也許可以對你有用。

呼叫狀態改爲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() 
     } 
    } 
}