【问题标题】:Migrate to the Twilio Voice 5.0 (iOS 13, Xcode 11): Custom incoming call view controller, reject incoming call issue迁移到 Twilio Voice 5.0(iOS 13,Xcode 11):自定义来电视图控制器,拒绝来电问题
【发布时间】:2019-12-22 05:49:37
【问题描述】:

我正在将 iOS 应用程序迁移到 Twilio Voice 5.x API(iOS 13 和 Xcode 11)并且有一些问题:

  1. 我的应用程序使用来电。 Twilio 要求: 3. 向 CallKit 报告呼叫。有关如何向 CallKit 报告调用,请参阅此示例。 我的问题:这是否意味着我不能在前台模式下使用更多自定义来电视图控制器?

  2. 在收到呼叫邀请后,我立即发送请求以获取有关呼叫者的信息并显示它。我在后台做。它在以前的版本中有效,但 现在不起作用,因为中断和处理程序必须立即在同一个线程上工作。你有什么建议?

【问题讨论】:

    标签: ios swift twilio ios13 twilio-api


    【解决方案1】:
    1. 您可以像这样使用 reportCall 来更新 CallKit 入站呼叫屏幕上的值:

      扩展 TwilioInteractor:TVONotificationDelegate {

      func callInviteReceived(_ callInvite: TVOCallInvite) {
          let from = callInvite.from ?? "?"
          let uuid = callInvite.uuid
          displayIncomingCall(from: from, uuid: uuid)
          fetcher.fetchCaller(for: from, callInvite: callInvite) { caller in
              self.updateIncomingCall(from: caller, uuid: uuid)
          }
      }
      
      private func displayIncomingCall(from: String, uuid: UUID) {
          let callHandle = CXHandle(type: .generic, value: from)
          let callUpdate = CXCallUpdate()
          callUpdate.remoteHandle = callHandle
          callUpdate.hasVideo = false
          callUpdate.supportsDTMF = true
          callUpdate.supportsHolding = false
          callUpdate.supportsGrouping = false
          callUpdate.supportsUngrouping = false
      
          self.callKitProvider.reportNewIncomingCall(with: uuid, update: callUpdate) { (error) in
              if let error = error {
                  Log.e("Failed to report incoming call successfully: \(error.localizedDescription).")
              } else {
                  Log.twilio("Incoming call successfully reported.")
              }
          }
      }
      
      private func updateIncomingCall(from: String, uuid: UUID) {
          let callHandle = CXHandle(type: .generic, value: from)
          let callUpdate = CXCallUpdate()
          callUpdate.remoteHandle = callHandle
          self.callKitProvider.reportCall(with: uuid, updated: callUpdate)
      }
      

      }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多