# Flutter Callkit Incoming ## Setup Pushkit for IOS. If you are making VoIP application than you definitely want to update your application in the background state as well as wake your application when any VoIP call is being received. ## 🚀  Setup Make sure when you create Bundle ID(https://developer.apple.com/account/resources/identifiers) for app you have checked `Push Notifications` 1. Enable Voice over IP Setting * Xcode Project > Capabilities ![image info](https://raw.githubusercontent.com/hiennguyen92/flutter_callkit_incoming/master/images/Setting.png)
* VoIP Services Certificate Go to https://developer.apple.com/account/resources/certificates/add ![image info](https://raw.githubusercontent.com/hiennguyen92/flutter_callkit_incoming/master/images/VoIPServicesCertificate.png) Download the certificate and install it into the Keychain Access app(download .cer and double click to install).
* Export .p12 ![image info](https://raw.githubusercontent.com/hiennguyen92/flutter_callkit_incoming/master/images/KeychainAccess.png)
* Convert .p12 to .pem (VOIP.pem) ```console openssl pkcs12 -in YOUR_CERTIFICATES.p12 -out VOIP.pem -nodes -clcerts ```
2. Configure VoIP Push Notifications in Xcode project (Swift) * Setup VoIP ![image info](https://raw.githubusercontent.com/hiennguyen92/flutter_callkit_incoming/master/images/Xcode-S1.png)
* DeviceToken and handle incoming pushs ![image info](https://raw.githubusercontent.com/hiennguyen92/flutter_callkit_incoming/master/images/Xcode-S2.png)
* Start call from Recent history on click (add if necessary) ![image info](https://raw.githubusercontent.com/hiennguyen92/flutter_callkit_incoming/master/images/Xcode-S3.png)
* Example https://github.com/hiennguyen92/flutter_callkit_incoming/blob/master/example/ios/Runner/AppDelegate.swift

3. Testing * Using App https://github.com/onmyway133/PushNotifications ![image info](https://raw.githubusercontent.com/hiennguyen92/flutter_callkit_incoming/master/images/TestingApp.png)
* Using Curl ``` curl -v \ -d '{"aps":{"alert":"Hien Nguyen Call"},"id":"44d915e1-5ff4-4bed-bf13-c423048ec97a","nameCaller":"Hien Nguyen","handle":"0123456789","isVideo":true}' \ -H "apns-topic: com.hiennv.testing.voip" \ -H "apns-push-type: voip" \ --http2 \ --cert VOIP.pem:'' \ https://api.development.push.apple.com/3/device/ ``` * NOTE To be able to testing in Terminated State `Xcode -> Edit Schema -> Wait for the executable to be launched`