Calculating Usage for Billing Purpose with Session Monitoring Calculating Usage for Billing Purpose with Session Monitoring

Calculating Usage for Billing Purpose with Session Monitoring

Maria Scieranska

Objective

Calculating usage for billing purposes with the Session Monitoring API.

Applies To

  • Session Monitoring API
  • Billing
  • Usage
  • Video API

Procedure

To track and maintain call logs, you need to have a database of all the calls happening on a particular API key. For this, you can use the Session Monitoring API on the server side. On the server, the app will get all the events happening on clients, allowing logging for billing and other purpose.

On the client side, you have the following options:

An alternative to using Session Monitoring, or as a redundant method, is to log the events using AJAX calls from you clients to your server and have your server persist the event data.

You can listen to the Connection and Stream Events in your client application. These events are fired by the Tokbox APIs as and when they happen. Your application can log the time when the connection was created or destroyed and when the publisher started or stopped streaming in the application (through StreamCreated Event).

Using these APIs you can track the total minutes the two users are connected to each other. Post monitoring and capturing the data, the users can send the information to your hosted server. Or they can keep the information logged with themselves and send them in batches to your server.