voice-quickstart-ios: Receive didReceiveIncomingPushWith But CallKit not fired

I am facing very wired bug in Voice Quick start Swift.

I tested few times and got the exact scenario,

I never receive call in inactive mode of app if i terminated app, After dialing once i am start to receive call.

while first time after terminating app from background tray, I receive call notification but callkit not fired and after few seconds debug triggered to

func pushRegistry(_ registry: PKPushRegistry, didUpdate credentials: PKPushCredentials, forType type: PKPushType) {

once it done, and i call again everything works fine.

    func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
        print(payload.dictionaryPayload)
        if (type == PKPushType.voIP) {
                TwilioVoice.handleNotification(payload.dictionaryPayload, delegate: self)
        }
        
        completion()
    }
 

this is happening in demo code of swift as well as objective c

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 33 (12 by maintainers)

Most upvoted comments

The case that Voip notification could not wake up the app is similar to us, especially when app has been suspended after few minutes in background.

In our case, dispatching completion() handler to main queue alone will not solve problem. I did something like:

DispatchQueue.global().asyncAfter(deadline: .now() + 5.0) {
      DispatchQueue.main.async {
          completion?()
      }
  }

the 5s completion delay is to allow the service to make proper connection and get proper signalling done before showing phone notification UI.

Hope it helps