Get Started: Voice & Video Calls

Estimated reading time: 5 minutes

In this part, we will learn how to use Mesibo’s Voice and Video Call Features

Prerequisites

  • Read the First App Guide.
  • Read one of the Android, iOS, JS section of this tutorial.
  • You can refer to First app source code for ready-to-run examples.

Voice and Video Calls

Mesibo allows you to enable peer-to-peer HD video and voice calls between your users, in just a few lines of code. As with messaging, Mesibo video and voice calls are encrypted and hence secure. Mesibo does not bill any additional amount for the voice or video call API.

Making and receiving voice & video calls with Mesibo is simple. You only need to initialize the MesiboCall module, and you will be ready to make and receive calls using Mesibo. You can then invoke the Call API to make voice and video calls as needed.

Runtime Permissions

When you make or receive calls with Mesibo, it asks you to grant a few permissions which are required to place the call.

You need to give access to these permissions as the call functionality will not work without these permissions.

Record Audio

This permission is required to access the microphone and record your voice.

Record Video

This permission is required to access the camera to make video calls.

Call Modules

To use Mesibo Call Modules,

  1. You need to add the MesiboCall module in your project
  2. Initialize Mesibo API with access token as described in the Android, or iOS section
  3. Launch Mesibo Call Modules

MesiboCall.Call()

To make a voice or video call you should use the call method which takes the following parameters:

call(context, callId, profile, isVideoCall)
  • context, Application Context
  • callId, a unique ID (similar to Message-ID), can be generated using Mesibo random API
  • profile, UserProfile object of the user to whom you are making a call
  • isVideoCall, true if placing a video call, false otherwise

Making a call in Android

Install Voice/Video Calls Framework for Android as described here and Import the MesiboCall module as follows,

import com.mesibo.calls.MesiboCall

If you need to customize how the call dialler looks, you need to modify and launch your custom UI Fragment. To learn more about this see Get Started: UI Modules.

To start making calls, initialize MesiboCall

MesiboCall.getInstance().init(applicationContext)
MesiboCall.getInstance().setListener(this)

Here is an example in Java for making audio and video calls.

public void onAudioCall(View view) {
    MesiboCall.getInstance().call(this, 0, mProfile, false);
}

public void onVideoCall(View view) {
    MesiboCall.getInstance().call(this, 0, mProfile, true);
}

Here is an example in Kotlin for making audio and video calls.

fun onAudioCall(view: View?) {
    MesiboCall.getInstance().call(this, 0, mProfile, false)
}

fun onVideoCall(view: View?) {
    MesiboCall.getInstance().call(this, 0, mProfile, true)
}

Making a call in iOS

Install Voice/Video Calls Framework for iOS as described here and Import the MesiboCall module as follows,

In Objective-C,

#import "MesiboCall/MesiboCall.h"

In Swift,

import MesiboCall

If you need to customize how the call dialler looks, you need to modify and launch your custom UI Fragment. To learn more about this see Get Started: UI Modules.

To start making calls, initialize MesiboCallInstance

[MesiboCallInstance setListener:self];
[MesiboCallInstance start];

Here is an example in Objective-C for making audio and video calls.

`/* ensure to grant background mode and microphone permissions */
- (IBAction)onAudioCall:(id)sender {
    [MesiboCallInstance call:self callid:0 address:mRemoteUser video:NO incoming:NO];
}

- (IBAction)onVideoCall:(id)sender {
    [MesiboCallInstance call:self callid:0 address:mRemoteUser video:YES incoming:NO];
}

Here is an example in Swift for making audio and video calls.

@IBAction func onAudioCall(_ sender: Any) {
    MesiboCall.sharedInstance()!.call(self, callid: 0, address: mRemoteUser, video: false, incoming: false)
}

@IBAction func onVideoCall(_ sender: Any) {
    MesiboCall.sharedInstance()!.call(self, callid: 0, address: mRemoteUser, video: true, incoming: false)
}

We will get into conferencing in the next step.

Conferencing >>

mesibo, android, ios