Giter Site home page Giter Site logo

plivo-ios-sdk2-examples's Introduction

Plivo Voice Quickstart for iOS

plivo-iOSsdk-2.0-example

The Plivo iOS SDK v2 allows you to make outgoing and receive incoming calls in your iOS application.

Supports Pushkit and Callkit. Eliminates the need for persistent connections to recieve incoming calls.

Compatible with iOS version 8 and above.

Plivo iOS SDK now supports IPv6 networks. Users can make and receive calls when their device is connected to a network that uses IPv4, IPv6, or both versions of the protocol.

To get started with the quickstart application follow these steps. Steps 1-3 will enable the application to make a call. The remaining steps 4-5 will enable the application to receive incoming calls in the form of push notifications using Apple’s VoIP Service.

  1. Install the PlivoVoiceKit framework using Cocoapods

  2. Create Endpoints

  3. Run the app

  4. Plivo iOS SDK V2 with Push Kit integration

  5. Receive an incoming call

1. Install the PlivoVoiceKit framework using Cocoapods

It's easy to install the Voice framework if you manage your dependencies using Cocoapods. Simply add the following to your Podfile:

pod 'PlivoVoiceKit'

SDK Reference - More documentation related to the Voice iOS SDK

2. Create Endpoints

Signup and create endpoints with Plivo using below link

Plivo Dashboard

3. Run the app

Open SwiftVoiceCallingApp.xcworkspace.

Build and run the app.

Enter sip endpoint username and password.

After successful login make VoiceCalls.

4. Plivo iOS SDK V2 with Push Kit integration

To enable Pushkit Integration in the SDK, please refer to below link on Generating VoIP Certificate.

Generating VoIP Certificate

5. Receive an incoming call

// MARK: PKPushRegistryDelegate
func pushRegistry(_ registry: PKPushRegistry, didUpdate credentials: PKPushCredentials, forType type: PKPushType) {
            
    if credentials.token.count == 0 {
        print("VOIP token NULL")
        return
    }
    
    // This method is used to register the device token for VOIP push notifications.
    endpoint.registerToken(credentials.token)
}

//When the push arrives below delegate method will be called. 
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, forType type: PKPushType) {
            
    if (type == PKPushType.voIP) {
        
        DispatchQueue.main.async(execute: {() -> Void in
            endpoint.relayVoipPushNotification(payload.dictionaryPayload)
        })
    }
}

PushInfo is the NSDictionary object forwarded by the apple push notification. This will enable the application to receive incoming calls even the app is not in foreground.

You are now ready to receive incoming calls.

plivo-iOSsdk-2.0-example

License

MIT

plivo-ios-sdk2-examples's People

Contributors

mike-plivo avatar sivaplivo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.