The following section explains on how to receive incoming calls on the Plivo iOS SDK v2 using pushkit. To receiving an incoming call, you must:
Let us see each of these steps in detail.
To enable VoIP services from XCode, select the “Capabilities” tab and enable the following settings:
On the “Info” tab, add “App provides Voice over IP services” to list of Required Background Modes.
To create a VoIP service certificate, you must:
Certificate signing request (CSR) is a prerequisite for creating a certificate in the iOS Dev Center. To generate the CSR:
To create a provisioning profile for your app
Navigate to the Provisioning Profiles section on Apple Developer Portal.
Click ‘+’ to add a new Provisioning Profile.
Select “iOS App Development” as the provisioning profile type.
Select your App ID.
Select the developer certificates you’d like to include in this provisioning profile.
Select the developer devices you’d like to include in this provisioning profile.
Enter a name for the provisioning profile.
Click Download to download and save the generated profile.
If you intend to submit your app to the app store, select “App Store” under Distribution for production environment. Else, select ‘Ad Hoc’ distribution type.
Select your App ID.
Select the iOS distribution certificate you wish to include in this provisioning profile. (This should be the ‘App Store or Ad Hoc’ certificate for your production app.)
Enter a name the provisioning profile.
Click ‘Download’ to download and save the generated profile.
The file is downloaded with .mobileprovision extension.
To create a Push Credential with your VoIP Service Certificate
To create Push Credentials with your VoIP Service Certificate
Export your VoIP Service Certificate as a
.p12 file from Keychain Access.
Enter a unique name for the certificate and then click Save.
You need not enter a password to create the .p12 file. Click **OK** if you are prompted to enter a password to protect the exported item. The app private key will get stored in `.p12` format.
The certificate key and the private key need to be generated from the .p12 file. To generate the files:
Run the following command in terminal to generate the Certificate key:
openssl pkcs12 -in VOIP_SNS.p12 -nokeys -out cert.pem -nodes
openssl pkcs12 -in Certificates.p12 -nocerts -out key.pem -nodes
Run the following command to process the RSA key:
openssl rsa -in key.pem -out key.pem ``` The RSA Key and Certificate will be generated.
Paste this text into the UI available in the Plivo Dashboard.
Based on the types of profile and certificate generated from Apple Developer console, choose from either Production or Sandbox environment.
You can change the environment from sandbox to production, but not from production to sandbox. To change your environment to sandbox from production, delete the certificate and create a new one for sandbox. By deleting the production certificate, you will stop receiving incoming calls by all live apps.