Introduction

The Kandy WebRTC API by Ribbon lets you implement web real-time communication (WebRTC) in your application for safe and stable video calls using the Kandy platform. It provides you with a simple model for connecting 2 parties into a call and simplifies the developer experience with its SDKs.

This API is used to create subscribers on the Kandy platform that can make and receive voice and video calls using the Kandy SDKs.


Conceptual model

Conceptual model


Definitions

Products

You must add products to your account’s product inventory before any of your application’s users can make voice and video calls. At the moment only 1 product is exposed in the KPN API store: KPN-VoiceVideo-C. This product entitles a user of your application to take part in a voice and video call.

You will be charged on a monthly basis according to the peak number of products in your inventory during the month.

Orders

Manage your account’s product inventory by making increment or decrement orders. You can add products to the inventory up to an agreed limit and you can decrement the product inventory if you have less demand.

Subscribers

You must define each of your application’s users as a subscriber on the Kandy platform. The subscriber can make or receive voice and video calls when it is created with a KPN-VoiceVideo-C product. Each subscriber will consume 1 of the products in your account’s available product inventory. A subscriber can make calls to other subscribers using the subscriber identity.

The subscriber's identity, and its authentication credentials, are used to initialize the Kandy SDK for making and receiving calls. When a subscriber is deleted, the product that it was using will be returned to your account’s available product inventory. When a subscriber is deleted, any application using this subscriber will be 'forced out' of the Kandy SDK.

Depending on your use case, a subscriber might be persistent (for example, a customer services agent who regularly uses your application to make and receive calls) or temporary (for example, a customer who uses your application infrequently to the customer services agent).

Kandy SDK

Voice and video calls require 3 elements:

  • A WebRTC engine
  • A subscriber on the Kandy platform
  • The application’s user interface

The Kandy SDK provides coordination of these 3 elements to simplify the task of integrating voice and video into an application. The Kandy SDK for JavaScript relies on a WebRTC engine provided by the browser, whereas the Kandy SDKs for iOS and Android come with their own WebRTC engine.


API workflow

Sequence Diagram


WebRTC workflow

API workflow


Prerequirements

This API allows you to provision subscribers and products in order to use Kandy WebRTC. The actual video solution is provided by Kandy. Depending on your platform, you can use web browsers, such as Google Chrome, Mozilla Firefox and Safari – or Software Development Kits (SDK) for Android, iOS or JavaScript.


Constraints

Security

WebRTC is a technology with security as a high priority. Browser applications that wish to use WebRTC must be operating from secure sources so that the media can be secured between the parties in a call.


How to...

Provision products and subscribers

Follow these steps to get provisioned for the Kandy WebRTC API:

  1. POST /order: Order the required number of KPN-VoiceVideo-C products into your account’s product inventory. An order number is returned.
  2. GET /order: Retrieve the order number to verify that the order has been fulfilled. If not, contact us. Orders should be fulfilled automatically up to an agreed total EUR limit for your account’s product inventory.
  3. GET /inventory: Check your account’s product inventory to ensure you have the expected number of products.
  4. POST /subscriber: Create a subscriber. Creating a subscriber consumes 1 KPN-VoiceVideo-C product from your account’s product inventory. An error will occur if you don't have sufficient products in your inventory.
  5. Use the subscriber's credentials in your application.
  6. DELETE /subscriber: Delete subscribers after your users have finished with them.
  7. POST /order: If you need to reduce your product inventory, you can make a decrement order.

Note: You don’t need to immediately decrement the product that had been used by the subscriber from your account’s product inventory. You can keep KPN-VoiceVideo-C products available so that you can create more subscribers when needed. See Step 4.

How does KPN charge you?

You are charged for the peak number of products you have in your account’s product inventory for a month.

Note: There is no need to order a new product every time you create a new subscriber. Products will be returned to your account’s product inventory when a subscriber is deleted. You can keep KPN-VoiceVideo-C products in your account’s product inventory so that they are ready and available when you need to create new subscribers.

Use the Kandy SDKs

For more information on how to use Kandy WebRTC SDKs with your applications, please refer to the latest tutorials and documentation on GitHub:

JavaScript (kandy-link-js-sdk)

Check out the SDK documentation and tutorials that guide through the configurations, how to connect users and how to make video and voice calls:

Android (kandy-link-android-sdk)

Check out the tutorials and the SDK reference:

iOS (kandy-link-ios-sdk)

Check out the tutorials and the SDK reference:


Return codes

Code   Description
200   Success.
201   Created.
202   Accepted.
302   Found. Link in location header.
400   Bad request.
401   Unauthorized.
403   Forbidden.
404   Not found.
405   Method not allowed.
412   Precondition failed.
429   Too many requests.
500   Internal server error.
502   Bad gateway.
503   Service unavailable.